Red Hat Bugzilla – Bug 621545
Provide an API for a script to invoke other scripts in non-interactive mode
Last modified: 2014-06-18 15:48:51 EDT
Description of problem:
At the interactive you can execute a script with the built-in exec command as follows,
$ exec -f path/to/my/script.js
The exec command is built into the CLI and only available in interactive mode. Providing a means for a script to invoke other scripts would provide a much more robust scripting environment. Consider this. We have a number of common utility functions and/or objects that we put into common_util.js. When we execute some other script, we'd like to have access the functions/objects in common_util.js.
Adding this capability is really straightforward. We have already made the built-in login and logout commands available through the class Controller. An instance of Controller is bound under the name 'rhq' in every script context. We could expose a new method in Controller that takes a single string argument which should be the path to the script.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
You can use modules for this.