Bug 734895

Summary: error running CLI samples
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: CLIAssignee: Deon Ballard <dlackey>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: high    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-31 06:50:38 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 625146, 734807    

Description Mike Foley 2011-08-31 15:19:50 EDT
Description of problem:  error running CLI samples


Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1.  ./rhq-cli.sh -u rhqadmin -p rhqadmin -f /home/mfoley/rhq-remoting-cli-4.1.0-SNAPSHOT/rhq-remoting-cli-4.1.0-SNAPSHOT/bin/measurement_utils.js 

  
Actual results:
error (see below)

Expected results:
samples work without error

Additional info:
[mfoley@foleymonsterbox1 bin]$ ./rhq-cli.sh -u rhqadmin -p rhqadmin -f /home/mfoley/rhq-remoting-cli-4.1.0-SNAPSHOT/rhq-remoting-cli-4.1.0-SNAPSHOT/bin/measurement_utils.js 
Remote server version is: 4.1.0-SNAPSHOT (5d4fbbe)
Login successful
Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "minutes" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
	at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:266)
	at org.rhq.enterprise.client.commands.ScriptCommand.execute(ScriptCommand.java:90)
	at org.rhq.enterprise.client.ClientMain.processArguments(ClientMain.java:505)
	at org.rhq.enterprise.client.ClientMain.main(ClientMain.java:106)
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "minutes" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:133)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
	at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:255)
	... 3 more
Caused by: sun.org.mozilla.javascript.EcmaError: ReferenceError: "minutes" is not defined. (<Unknown source>#1)
	at sun.org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
	at sun.org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
	at sun.org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3717)
	at sun.org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1692)
	at sun.org.mozilla.javascript.gen.c469._c0(<Unknown source>:1)
	at sun.org.mozilla.javascript.gen.c469.call(<Unknown source>)
	at sun.org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
	at sun.org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
	at sun.org.mozilla.javascript.gen.c469.call(<Unknown source>)
	at sun.org.mozilla.javascript.gen.c469.exec(<Unknown source>)
	at sun.org.mozilla.javascript.Context.evaluateReader(Context.java:1135)
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:123)
	... 5 more
[mfoley@foleymonsterbox1 bin]$
Comment 1 Heiko W. Rupp 2011-10-18 11:38:32 EDT
b95445e in master

Question is if actually a user is supposed to run them on their own - or if they are "libraries" that are supposed to be pulled in by other scripts.
Comment 2 Mike Foley 2011-10-18 11:58:52 EDT
That is a good question.  The samples should be more consumable by endusers ...and I think the issue here is the with the associated documenation.  changing to a doc issue.
Comment 3 Charles Crouch 2011-11-02 10:09:48 EDT
(8:54:07 AM) pilhuhn: ccrouch they do no longer "crash", but on their own not 
necessarily produce output. jsanda has encoded helpers in them that a user can 
copy or import for his own tools
(8:54:43 AM) pilhuhn: I've added links to (some of) his wiki articles hat 
explain the scripts more
Comment 4 Deon Ballard 2012-06-28 11:50:41 EDT
My underlying confusion was that I didn't understand (and I *think* this was Michael's issue, too) what the support scripts were supposed to do. 

I've added a small reference section to the CLI guide covering these support scripts:
http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/3.1/html/Dev_Writing_JON_Command-Line_Scripts/tips.html#utility-scripts