Bug 1083176 - Batch mode does not support conditional statements
Summary: Batch mode does not support conditional statements
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CLI
Version: 6.1.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Alexey Loubyansky
QA Contact: Petr Kremensky
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-01 15:27 UTC by J marley
Modified: 2018-12-05 17:58 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-16 11:17:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
batch mode example (207 bytes, text/plain)
2014-04-01 15:27 UTC, J marley
no flags Details

Description J marley 2014-04-01 15:27:30 UTC
Created attachment 881389 [details]
batch mode example

Description of problem:
When running eap cli batch scripts, it is expected that conditional statements would work as they work in cli mode, but I get an error saying it doesn't support if statements.


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


How reproducible:
Always

Steps to Reproduce:
1. ./JBOSS_HOME/bin/standalone.sh -c standalone.xml 
2. ./JBOSS_HOME/jboss-cli.sh --connect controller=$HOSTNAME:9999 --file=/DIR-TO-BATCH/if-else-test

Actual results:
if is not allowed while in batch mode.


Expected results:
#1 /subsystem=web/connector=ajp:add(protocol=AJP/1.3,scheme=http,socket-binding=ajp)
11:25:32,752 INFO  [org.apache.coyote.ajp] (MSC service thread 1-3) JBWEB003046: Starting Coyote AJP/1.3 on ajp-/127.0.0.1:8009
The batch executed successfully


Additional info:
If the resource exists I expect the if statement to gracefully handle the successful exit of batch mode.

Comment 1 Brian Stansberry 2014-04-01 15:37:51 UTC
Unless someone has some great ideas around this, I recommend that this be converted into a docs / help issue to document the supported behavior of a batch (which does not include client-side conditional logic.)

Supporting client-side conditional logic would require client-side control of transaction boundaries, which should be a WildFly RFE.

Comment 2 Alexey Loubyansky 2014-04-07 12:59:20 UTC
This restriction was intentional. The problem is the batch is translated into a single composite operation request which has no notion of conditional flow of control. So, the CLI resolves these conditions when it creates the composite request before sending it to the controller.
The problem is that the CLI cannot take into account the effects of the commands and operations on the domain model preceding the if-else statements that may affect the how these if-else statements are resolved.
For this reason, the CLI (as it is implemented now) can't take the responsibility for the accuracy of resolving if-else conditions in the batch mode during the batch execution. This may lead to unexpected results for the users.
So, at this point, either we allow if-else in batches at user's own risk or we keep this restriction and document it.

Comment 3 Alexey Loubyansky 2014-04-07 13:00:40 UTC
This restriction was intentional. The problem is the batch is translated into a single composite operation request which has no notion of conditional flow of control. So, the CLI resolves these conditions when it creates the composite request before sending it to the controller.
The problem is that the CLI cannot take into account the effects of the commands and operations on the domain model preceding the if-else statements that may affect the how these if-else statements are resolved.
For this reason, the CLI (as it is implemented now) can't take the responsibility for the accuracy of resolving if-else conditions in the batch mode during the batch execution. This may lead to unexpected results for the users.
So, at this point, either we allow if-else in batches at user's own risk or we keep this restriction and document it.

Comment 4 Petr Kremensky 2014-07-16 11:17:18 UTC
According to previous comments closing this as notabug. 

Created BZ1120184 for documentation.


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