[jboss-jira] [JBoss JIRA] (WFCORE-1614) Requesting CLI Equivalent of Remote Echo / set -x in non-interactive mode (from within scripts)

Petr Kremensky (JIRA) issues at jboss.org
Mon Jun 27 04:00:01 EDT 2016


    [ https://issues.jboss.org/browse/WFCORE-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257178#comment-13257178 ] 

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 at 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 at embedded /] try
[standalone at embedded /] :read-attribute(name=foo)
[standalone at embedded /] catch
[standalone at embedded /] /system-property=catch:add(value=bar)
[standalone at embedded /] finally
[standalone at embedded /] /system-property=finally:add(value=bar)
[standalone at embedded /] end-try
[standalone at embedded /] :read-attribute(name=foo)
[standalone at embedded /] /system-property=catch:add(value=bar)
{"outcome" => "success"}
[standalone at embedded /] /system-property=finally:add(value=bar)
{"outcome" => "success"}
[standalone at 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 at embedded /] if (outcome == success) of /system-property=catch:read-attribute(name=value)
[standalone at embedded /] set prop=Catch\ block\ was\ executed
[standalone at embedded /] /system-property=finally:write-attribute(name=value, value=if)
[standalone at embedded /] else
[standalone at embedded /] set prop=Catch\ block\ wasn\'t\ executed
[standalone at embedded /] reload
[standalone at embedded /] stop-embedded-server
[standalone at embedded /] asdqwe-error
[standalone at embedded /] /system-property=finally:write-attribute(name=value, value=else)
[standalone at embedded /] end-if
[standalone at embedded /] set prop=Catch\ block\ was\ executed
[standalone at embedded /] /system-property=finally:write-attribute(name=value, value=if)
{"outcome" => "success"}
[standalone at embedded /] reload
[standalone at embedded /] stop-embedded-server
{noformat}

Bash debugging
{noformat}
[pkremens at 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 at 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 at 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)


More information about the jboss-jira mailing list