Bug 1040828

Summary: CLI: Certain command line batch operations doesn't work on Windows
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Michal Karm Babacek <mbabacek>
Component: CLIAssignee: Alexey Loubyansky <olubyans>
Status: CLOSED NOTABUG QA Contact: Petr Kremensky <pkremens>
Severity: medium Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.2.0CC: brian.stansberry, rsvoboda
Target Milestone: ---   
Target Release: EAP 6.3.0   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-07 16:04:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michal Karm Babacek 2013-12-12 08:08:52 UTC
Hi guys, these operations work splendidly with jboss-cli.sh:

{code}
./jboss-cli.sh --connect --commands='/extension=org.jboss.as.modcluster:add()' --timeout=12000
./jboss-cli.sh --connect --commands='/subsystem=web/connector=ajp:add(name=ajp,protocol=ajp,scheme=ajp,socket-binding=ajp)' --timeout=120000
./jboss-cli.sh --connect --commands='batch,/:composite(steps=[{"operation"=>"add","address"=>[("subsystem"=>"modcluster")]},{"operation"=>"add","address"=>[("subsystem"=>"modcluster"),("mod-cluster-config"=>"configuration")],"connector"=>"ajp","balancer"=>"qacluster","advertise"=>"true","advertise-socket"=>"modcluster"},{"operation"=>"add","address"=>[("socket-binding-group"=>"standard-sockets"),("socket-binding"=>"modcluster")],"port"=>0,"multicast-address"=>"224.0.5.213","multicast-port"=>"23364"}]),run-batch' --timeout=120000
{code}

whereas on Windows, these first two pass:

{code}
jboss-cli.bat --connect --commands=/extension=org.jboss.as.modcluster:add() --timeout=12000
jboss-cli.bat --connect --commands=/subsystem=web/connector=ajp:add(name=ajp,protocol=ajp,scheme=ajp,socket-binding=ajp) --timeout=120000
{code}

and this last one just hangs in cmd and terminates on hitting Return, leaving no output, no error message, nothing.

{code}
jboss-cli.bat --connect --commands=batch,/:composite(steps=[{"operation"=>"add","address"=>[("subsystem"=>"modcluster")]},{"operation"=>"add","address"=>[("subsystem"=>"modcluster"),("mod-cluster-config"=>"configuration")],"connector"=>"ajp","balancer"=>"qacluster","advertise"=>"true","advertise-socket"=>"modcluster"},{"operation"=>"add","address"=>[("socket-binding-group"=>"standard-sockets"),("socket-binding"=>"modcluster")],"port"=>0,"multicast-address"=>"224.0.5.213","multicast-port"=>"23364"}]),run-batch --timeout=120000
{code}

I tried to escape ' " ' and ' , ' with both ^ and \ and it didn't help. I also tried to swap " with ', no luck either. As you might see, I omitted all the spaces as well and again, it didn't bring any improvement.

I admit my knowledge of Windows and Batch is rather limited, so it's possible that someone might know how to make jboss-cli.bat swallow this batch operation of mine. THX for comments.

Comment 1 Alexey Loubyansky 2014-01-07 16:04:26 UTC
This is windows command line specific. The correct syntax would be to escape and quote all the special characters, e.g. the line would start as:

jboss-cli.bat --connect --commands=batch,/:composite(steps=[{\"operation\"=">"\"add\"...

And so on.

'>' character is treated as outout redirection which explains why there is no output on the terminal.

The other thing is, I don't know whether that is intentional, but using composite inside a batch doesn't make any sense. It simply further and unnecessary complicates the line. Since that is what the batch is all about - to create a single composite operation out of the commands and operations included into the batch.