Bug 888070 - Agent prompt-command doesn't properly parse command-line arguments
Summary: Agent prompt-command doesn't properly parse command-line arguments
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Agent
Version: JON 3.1.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ER01
: JON 3.2.0
Assignee: Jay Shaughnessy
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-17 23:31 UTC by Larry O'Leary
Modified: 2014-01-02 20:39 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Larry O'Leary 2012-12-17 23:31:10 UTC
Description of problem:
When attempting to execute the discovery --resourceType=<resource> command, the command syntax is not properly parsed when the long form is used with a argument that contains a space (such as a resourceType).

For example:

    discovery --resourceType="JBossAS Server"

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

How reproducible:
Always

Steps to Reproduce:
1. Install the JBoss AS and AS5 plug-ins
2. From the agent prompt command, execute:

       discovery --resourceType="JBossAS Server"

 
Actual results:
Command fails and the agent simply spits out:

    Syntax: discovery [--plugin=<plugin name>] [--resourceType=<type name>]
                      [--resourceId=<id>] [--verbose]
            discovery --full [--verbose]
            discovery --blacklist={list|clear}


Expected results:
Command should succeed and the following should be output:

    JBossAS.JBossAS Server: Starting discovery...
    JBossAS.JBossAS Server: Process scan detected a server - scan=[ProcessScan: query=[process|basename|match=^java.*,arg|org.jboss.Main|match=.*], name=[JBoss4]], process=[process: pid=[25545], name=[/etc/alternatives/java_sdk/bin/java], ppid=[25535]]
    JBossAS.JBossAS Server: key=[/home/loleary/workspace/Cases/00750460/test-env/jon-server/jbossas/server/default], name=[loleary:2099 RHQ Server], version=[AS 4.2.3.GA], description=[JBoss Application Server 4 hosting the RHQ Server]
    JBossAS.JBossAS Server: Done.

    JBossAS5.JBossAS Server: Starting discovery...
    JBossAS5.JBossAS Server: Process scan detected a server - scan=[ProcessScan: query=[process|basename|match=^java.*,arg|org.jboss.Main|match=.*], name=[jbossas]], process=[process: pid=[25545], name=[/etc/alternatives/java_sdk/bin/java], ppid=[25535]]
    JBossAS5.JBossAS Server: Done.


Additional info:
To get this command to successfully execute, the equal sign (=) can be removed from the argument assignment. Please note that although this works, it is not the expected behavior considering the command syntax is resourceType=<resource_type>

    discovery --resourceType "JBossAS Server"

Equally, the short form of the command also works:

    discovery -r "JBossAS Server"

Comment 1 Jay Shaughnessy 2013-02-27 23:08:10 UTC
master commit 3bed8cb705a9c4662b69891c1ec1c833ba8dbc64
Jay Shaughnessy <jshaughn>
Wed Feb 27 17:59:39 2013 -0500

A sort of annoying parsing issue affecting topmost command line parsing in
AgentMain.

Comment 2 Larry O'Leary 2013-09-06 14:33:00 UTC
As this is MODIFIED or ON_QA, setting milestone to ER1.

Comment 3 Sunil Kondkar 2013-11-15 13:59:25 UTC
Verified on version : 3.2.0.ER5 Build Number : 2cb2bc9:225c796

> discovery --resourceType="JBossAS Server"
JBossAS.JBossAS Server: Starting discovery...
JBossAS.JBossAS Server: Process scan detected a server - scan=[ProcessScan: query=[process|basename|match=^java.*,arg|org.jboss.Main|match=.*], name=[JBoss4]], process=[process: pid=[20185], name=[/store/java/jdk1.6.0_18/bin/java], ppid=[20141]]
JBossAS.JBossAS Server: Done.

JBossAS5.JBossAS Server: Starting discovery...
JBossAS5.JBossAS Server: Process scan detected a server - scan=[ProcessScan: query=[process|basename|match=^java.*,arg|org.jboss.Main|match=.*], name=[jbossas]], process=[process: pid=[20185], name=[/store/java/jdk1.6.0_18/bin/java], ppid=[20141]]
JBossAS5.JBossAS Server: key=[/store/EAP/eap5.1.2/jboss-eap-5.1/jboss-as/server/default], name=[EAP localhost.localdomain:1199 default], version=[EAP 5.1.2], description=[JBoss Enterprise Application Platform 5]
JBossAS5.JBossAS Server: Done.


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