Bug 1284885 - [GSS](6.4.z) CLI Lists in non-interactive mode are erroneously split into multiple commands
[GSS](6.4.z) CLI Lists in non-interactive mode are erroneously split into mul...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI (Show other bugs)
6.4.4
Unspecified Unspecified
medium Severity medium
: CR1
: EAP 6.4.11
Assigned To: Ryan Emerson
Peter Mackay
:
Depends On:
Blocks: eap6411-payload
  Show dependency treegraph
 
Reported: 2015-11-24 06:51 EST by Tom Fonteyne
Modified: 2017-01-17 08:15 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-01-17 08:13:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker JBEAP-2318 Blocker Closed CLI Lists in non-interactive mode are erroneously split into multiple commands 2017-06-23 05:40 EDT
JBoss Issue Tracker WFCORE-1199 Major Resolved CLI Lists in non-interactive mode are erroneously split into multiple commands 2017-06-23 05:40 EDT
JBoss Issue Tracker WFCORE-1360 Major Resolved CLI Options missed in WFCORE-1199 2017-06-23 05:40 EDT

  None (edit)
Description Tom Fonteyne 2015-11-24 06:51:00 EST
Installing CP4 on a EAP 6.4 which had some files modified:

Login in the CLI and apply the patch:

[standalone@localhost:9999 /] patch apply jboss-eap-6.4.4-patch.zip
Conflicts detected: bin/init.d/jboss-as-domain.sh, bin/init.d/jboss-as-standalone.sh
Use the --override-all, --override=[] or --preserve=[] arguments in order to resolve the conflict.

Login in the CLI and apply the patch with the -preserve option:
[standalone@localhost:9999 /] patch apply jboss-eap-6.4.4-patch.zip --preserve=bin/init.d/jboss-as-domain.sh,bin/init.d/jboss-as-standalone.sh
{
    "outcome" : "success",
    "response-headers" : {
        "operation-requires-restart" : true,
        "process-state" : "restart-required"
    }
}

=> all fine.

But doing the same directly from bash:

# ./jboss-cli.sh --connect --controller=localhost --commands="patch apply jboss-eap-6.4.4-patch.zip --preserve=bin/init.d/jboss-as-domain.sh,bin/init.d/jboss-as-standalone.sh"
Username: user
Password:
Conflicts detected: bin/init.d/jboss-as-standalone.sh
Use the --override-all, --override=[] or --preserve=[] arguments in order to resolve the conflict.

Playing around with the options (qoutes, escaping) makes no difference.

In this particular case the root cause was the init.d directory had been deleted, but this is of course irrelevant as using the command inside the CLI works ok.
Comment 1 Ryan Emerson 2015-12-09 06:24:17 EST
The problem arises because commands entered in non-interactive mode are split by the "," character.  Therefore, in the case of:

 "--commands="patch apply jboss-eap-6.4.4-patch.zip --preserve=bin/init.d/jboss-as-domain.sh,bin/init.d/jboss-as-standalone.sh""

the cli is incorrectly splitting the request into two distinct commands:

1. --commands="patch apply jboss-eap-6.4.4-patch.zip --preserve=bin/init.d/jboss-as-domain.sh
2. bin/init.d/jboss-as-standalone.sh



The reason this behaviour is not observed in interactive mode is because multiple commands can not be specified.  However, in non-interactive mode --commands=ls,pwd is valid and should result in the execution of ls followed by pwd.  

This problem is not restricted to the patch command, as it affects all commands entered in non-interactive mode that require a comma-separated list as an argument.  So far this appears to be PatchHanlder.java and ASModuleHandler.java.  Therefore I have renamed this BZ to better reflect the overarching issue.  

My proposed solution requires that lists containing > 1 value must be contained within [] brackets.  This prevents the list from being perceived as multiple commands and allows the list to be passed to the appropriate handler where the [] brackets can be removed and the list processed as expected.
Comment 2 Ryan Emerson 2015-12-09 06:26:40 EST
Example input for non-interactive mode with the above solution:

./bin/jboss-cli.sh --connect --controller=localhost --commands= ls,patch apply ~/Downloads/jboss-eap-6.4.4-patch.zip  --override=[bin/init.d/jboss-as-domain.sh,bin/init.d/jboss-as-standalone.sh]
Comment 6 JBoss JIRA Server 2016-02-02 05:07:52 EST
Ryan Emerson <remerson@redhat.com> updated the status of jira JBEAP-2318 to Resolved
Comment 7 JBoss JIRA Server 2016-02-04 11:20:18 EST
Ryan Emerson <remerson@redhat.com> updated the status of jira WFCORE-1199 to Reopened
Comment 8 JBoss JIRA Server 2016-02-04 11:39:44 EST
Ryan Emerson <remerson@redhat.com> updated the status of jira JBEAP-2318 to Reopened
Comment 9 JBoss JIRA Server 2016-02-04 11:43:28 EST
Brian Stansberry <brian.stansberry@redhat.com> updated the status of jira WFCORE-1199 to Resolved
Comment 11 Mike McCune 2016-03-28 19:25:37 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 12 JBoss JIRA Server 2016-07-13 12:41:21 EDT
Jiri Pallich <jpallich@redhat.com> updated the status of jira JBEAP-2318 to Closed
Comment 13 Peter Mackay 2016-10-03 13:08:02 EDT
Verified with EAP 6.4.11.CP.CR1
Comment 14 Petr Penicka 2017-01-17 08:13:51 EST
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.
Comment 15 Petr Penicka 2017-01-17 08:15:20 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

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