Bug 621545 - Provide an API for a script to invoke other scripts in non-interactive mode
Summary: Provide an API for a script to invoke other scripts in non-interactive mode
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 3.0.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-05 13:08 UTC by John Sanda
Modified: 2014-06-18 19:48 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-06-18 19:48:51 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.