winterhazel opened a new pull request, #12515: URL: https://github.com/apache/cloudstack/pull/12515
### Description Before commit 03a4b9f4fd, preset variables were injected into the JS interpreter by directly prepending them as a string to the script. 03a4b9f4fd changed the interpreter so that preset variables are injected via bindings instead. However, all preset variables are still injected as a string. Due to this, variables that were previously interpreted as objects are now interpreted as strings. This broke the Quota activation rules and secondary storage selectors features. This PR changes the code to inject the preset variables using their expected types. Also, the test files of most preset variables have been removed because the tests do not make sense anymore with the new injection mechanism. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Bug Severity - [X] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### How Has This Been Tested? - I created a Quota tariff with an activation rule, ran the Usage job, and debugged `org.apache.cloudstack.utils.jsinterpreter.JsInterpreter#executeScriptInThread` to validate that the preset variables had their expected type in the JS interpreter. - I created a secondary storage selector for templates, registered a template, and debugged `org.apache.cloudstack.utils.jsinterpreter.JsInterpreter#executeScriptInThread` to validate that the preset variables had their expected type in the JS interpreter. - I added a flexible host tag to one of my hosts, deployed a VM using an offering that matched the tag, and debugged `org.apache.cloudstack.utils.jsinterpreter.JsInterpreter#executeScriptInThread` to validate that the offering's host tags were correctly injected into the JS interpreter as a list. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
