Bug 1284885 - [GSS](6.4.z) CLI Lists in non-interactive mode are erroneously split into multiple commands
Summary: [GSS](6.4.z) CLI Lists in non-interactive mode are erroneously split into mul...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI
Version: 6.4.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: CR1
: EAP 6.4.11
Assignee: Ryan Emerson
QA Contact: Peter Mackay
URL:
Whiteboard:
Depends On:
Blocks: eap6411-payload
TreeView+ depends on / blocked
 
Reported: 2015-11-24 11:51 UTC by Tom Fonteyne
Modified: 2019-12-16 05:07 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-17 13:13:51 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Issue Tracker JBEAP-2318 Blocker Closed CLI Lists in non-interactive mode are erroneously split into multiple commands 2017-10-09 08:02:38 UTC
Red Hat Issue Tracker WFCORE-1199 Major Resolved CLI Lists in non-interactive mode are erroneously split into multiple commands 2017-10-09 08:02:38 UTC
Red Hat Issue Tracker WFCORE-1360 Major Resolved CLI Options missed in WFCORE-1199 2017-10-09 08:02:38 UTC

Description Tom Fonteyne 2015-11-24 11:51:00 UTC
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 11:24:17 UTC
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 11:26:40 UTC
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 10:07:52 UTC
Ryan Emerson <remerson@redhat.com> updated the status of jira JBEAP-2318 to Resolved

Comment 7 JBoss JIRA Server 2016-02-04 16:20:18 UTC
Ryan Emerson <remerson@redhat.com> updated the status of jira WFCORE-1199 to Reopened

Comment 8 JBoss JIRA Server 2016-02-04 16:39:44 UTC
Ryan Emerson <remerson@redhat.com> updated the status of jira JBEAP-2318 to Reopened

Comment 9 JBoss JIRA Server 2016-02-04 16:43:28 UTC
Brian Stansberry <brian.stansberry@redhat.com> updated the status of jira WFCORE-1199 to Resolved

Comment 11 Mike McCune 2016-03-28 23:25:37 UTC
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 16:41:21 UTC
Jiri Pallich <jpallich@redhat.com> updated the status of jira JBEAP-2318 to Closed

Comment 13 Peter Mackay 2016-10-03 17:08:02 UTC
Verified with EAP 6.4.11.CP.CR1

Comment 14 Petr Penicka 2017-01-17 13:13:51 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 15 Petr Penicka 2017-01-17 13:15:20 UTC
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.