[
https://issues.jboss.org/browse/WFCORE-1614?page=com.atlassian.jira.plugi...
]
Petr Kremensky commented on WFCORE-1614:
----------------------------------------
I see a problem with control flow statements usage, as all commands are printed first,
creating a lot of noise in output.
It could be quite difficult to re-create a problematic situation using the echoed commands
(we should take into account that customer's scripts could have thousand of lines) -
see 'set prop', reload, stop-embedded-server, asdqwe-error from else branch which
was not executed.
{noformat}
[pkremens@dlocalhost]$ cat test.cli
embed-server
try
:read-attribute(name=foo)
catch
/system-property=catch:add(value=bar)
finally
/system-property=finally:add(value=bar)
end-try
/system-property=*:read-resource
if (outcome == success) of /system-property=catch:read-attribute(name=value)
set prop=Catch\ block\ was\ executed
/system-property=finally:write-attribute(name=value, value=if)
else
set prop=Catch\ block\ wasn\'t\ executed
reload
stop-embedded-server
asdqwe-error
/system-property=finally:write-attribute(name=value, value=else)
end-if
reload
stop-embedded-server
{noformat}
Run the script
{noformat}
./jboss-cli.sh --echo-command
--file=/home/pkremens/workspace/wildfly-core-3.0.0.Alpha3-SNAPSHOT/bin/test.cli
[disconnected /] embed-server
[standalone@embedded /] try
[standalone@embedded /] :read-attribute(name=foo)
[standalone@embedded /] catch
[standalone@embedded /] /system-property=catch:add(value=bar)
[standalone@embedded /] finally
[standalone@embedded /] /system-property=finally:add(value=bar)
[standalone@embedded /] end-try
[standalone@embedded /] :read-attribute(name=foo)
[standalone@embedded /] /system-property=catch:add(value=bar)
{"outcome" => "success"}
[standalone@embedded /] /system-property=finally:add(value=bar)
{"outcome" => "success"}
[standalone@embedded /] /system-property=*:read-resource
{
"outcome" => "success",
"result" => [
{
"address" => [("system-property" =>
"catch")],
"outcome" => "success",
"result" => {"value" => "bar"}
},
{
"address" => [("system-property" =>
"finally")],
"outcome" => "success",
"result" => {"value" => "bar"}
}
]
}
[standalone@embedded /] if (outcome == success) of
/system-property=catch:read-attribute(name=value)
[standalone@embedded /] set prop=Catch\ block\ was\ executed
[standalone@embedded /] /system-property=finally:write-attribute(name=value, value=if)
[standalone@embedded /] else
[standalone@embedded /] set prop=Catch\ block\ wasn\'t\ executed
[standalone@embedded /] reload
[standalone@embedded /] stop-embedded-server
[standalone@embedded /] asdqwe-error
[standalone@embedded /] /system-property=finally:write-attribute(name=value, value=else)
[standalone@embedded /] end-if
[standalone@embedded /] set prop=Catch\ block\ was\ executed
[standalone@embedded /] /system-property=finally:write-attribute(name=value, value=if)
{"outcome" => "success"}
[standalone@embedded /] reload
[standalone@embedded /] stop-embedded-server
{noformat}
Bash debugging
{noformat}
[pkremens@dlocalhost]$ cat test.sh
set -x
if true ; then
echo yes
TEST=ANO
else
echo no
TEST=NE
fi
set +x
{noformat}
else branch is not echoed
{noformat}
[pkremens@dlocalhost]$ ./test.sh
++ true
++ echo yes
yes
++ TEST=ANO
++ set +x
{noformat}
Requesting CLI Equivalent of Remote Echo / set -x in non-interactive
mode (from within scripts)
-----------------------------------------------------------------------------------------------
Key: WFCORE-1614
URL:
https://issues.jboss.org/browse/WFCORE-1614
Project: WildFly Core
Issue Type: Feature Request
Components: CLI
Reporter: Jean-Francois Denise
Assignee: Jean-Francois Denise
Fix For: 3.0.0.Alpha3
We are proposing here to add a Cli option (command line option and an XML element) to
make the CLI to echo the command and its options in non interactive mode. This will help
to match a given command and its output.
For example, the "ls -l" command output would be:
[standalone@localhost:9990 /] ls -l
ATTRIBUTE VALUE TYPE
launch-type STANDALONE STRING
management-major-version 5 INT
management-micro-version 0 INT
management-minor-version 0 INT
...
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)