Bug 738063
Summary: | CLI Documentation example doesn't show full usage() method | ||||||
---|---|---|---|---|---|---|---|
Product: | [Other] RHQ Project | Reporter: | Nabeel Saad <nsaad> | ||||
Component: | Documentation | Assignee: | Deon Ballard <dlackey> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | high | ||||||
Version: | unspecified | CC: | gcooper, hrupp, jsanda, mfoley | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2013-09-01 19:20:28 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: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 625146 | ||||||
Attachments: |
|
Description
Nabeel Saad
2011-09-13 18:50:56 UTC
I am pretty certain that this example was originally on the RHQ wiki -- but I can't find it there. The only community procedure I see like this is on the jboss.org wiki: http://community.jboss.org/wiki/JON23ScriptedGroupDeploymentsUsingTheCLIAPI Which references this section in the 2.3 docs (which does *not* contain the usage() thing): http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.3/html/Installation_Guide/Installation_Guide-Working_with_the_CLI-Script_Arguments.html So, I don't have a clue what usage() is doing. Sanda, do you know 1) what the usage() function is doing in this example and 2) if this is the right function to use? I will try to track down that script, but I am almost certain it is a function defined within that script. There is no usage function or API of which I am aware that we support. If I understand the bug description correctly, Nabeel is asking for a way to terminate a script other than throwing an exception. This can be accomplished simply by calling java.lang.System.exit which takes an integer argument. For more information about regarding integration with the underlying Java platform, take a look at the docs at http://www.mozilla.org/rhino/doc.html. Lastly, it would be great if questions like these could be directed to the rhq mailing lists and/or the community forums so that they reach a wider audience. Created attachment 529002 [details]
copy of script referenced in the bug
I believe that this is the script being referenced. Please note that I did not write this script so I may not be able to answer all questions about it. You will find that the script does define a usage function.
I just checked and the RHQ CLI does provide a quit command from the interactive shell, but I am almost certain that the quit command is not available in non-interactive mode. Please feel free to file a separate bug for that if you would like to see that added. Until then, you can use java.lang.System.exit as I stated previously.
Thank you John, yes I believe the java.lang.System.exit should provide what's needed. I did also find that by creating functions within my JS scripts, I could have them do a "return" and then handle things from there so that I do not throw errors, but informative text with steps to fix the problem. Many thanks, you can feel free to close this bug. Is there any way the script that you attached can be added into some example files provided with JON or somehow referenced in the docs or put in the docs as an appendix, I prove it can be quite useful for people starting out. Cheers, Nabeel *** Bug 744004 has been marked as a duplicate of this bug. *** Hopefully, this is clarified in the intro to the chapter here: http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/3.1/html/Dev_Writing_JON_Command-Line_Scripts/Control_Grouped_Servers_via_the_CLI.html Bulk closing of BZs that have no target version set, but which are ON_QA for more than a year and thus are in production for a long time. |