Bug 621545

Summary: Provide an API for a script to invoke other scripts in non-interactive mode
Product: [Other] RHQ Project Reporter: John Sanda <jsanda>
Component: CLIAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: low    
Version: 3.0.0CC: jshaughn
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-18 19:48:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Sanda 2010-08-05 13:08:59 UTC
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):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jay Shaughnessy 2014-06-18 19:48:51 UTC
You can use modules for this.