Bug 888070

Summary: Agent prompt-command doesn't properly parse command-line arguments
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: AgentAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: JON 3.1.1CC: jshaughn, skondkar
Target Milestone: ER01   
Target Release: JON 3.2.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.