Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3662

CLI: non-batchable commands appearing in control flow statements executed regardless of condition

    Details

      Description

      The CLI control flows, such as if-then-else, are not working for CLI commands, such as echo or module. Using commands in control flows results in the strange behavior that these commands are executed in each case without respecting to what the if-statement evaluated.

      I am trying to customize a fresh wildfly server with some modules and settings for our development process. I decided to add modules using a CLI script that gets executed by maven, but when the script declares the following the module command in the 'then' block is executed in each case:

      if (outcome == failed) of /core-service=module-loading:list-resource-loader-paths(module=oracle.jdbcaq)
        module add --name=oracle.jdbcaq ...
      end-if
      ...
      

      I've also verified this behavior with another structure that just checks a property and echos something and both echos were executed:

      /system-property=x:add(value=123)
      if (result == 123) of /system-property=x:read-attribute(name=value)
        echo "If block"
        /system-property=x:read-attribute(name=value)
      else
        echo "Else block"
        /system-property=x:read-attribute(name=value)
      end-if
      

      The next thing is that if you just put echos into the if and else blocks, the CLI processor complains about an empty if-block. Try this one:

      /system-property=x:add(value=123)
      if (result == 123) of /system-property=x:read-attribute(name=value)
        echo "If block"
      else
        echo "Else block"
      end-if
      

      This behavior has also been observed by other users (see the forum reference) and for me it is critical to our setup since the only alternative would be copying modules manually to the modules folder. Furthermore, there might be other commands required for us to adapt the standalone configuration that need to be nested in an if-statement.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                aloubyansky Oleksiy Lubyanskyy
                Reporter:
                stanley.hillner Stanley Hillner
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: