Nice improvement: different behaviour with exec args




  • Avatar
    Anush Ramani

    Hi Brett,

    Could you please elaborate a bit more on what you mean by "not parsed"? I just tried a very quick and simple "echo" command with both types of arguments and they both appear identical. In what particular scenario is this an issue for you?

    My simple echo job:

    <exec command="echo">
    <arg>something else</arg>
    <exec command="echo" args="one two 'something else'" />
    Comment actions Permalink
  • Avatar
    Brett Cave

    Yes, i see it does work correctly as it is supposed to

    If executing a native application: I am updating an item in our monitoring system (zabbix), using the zabbix_sender native CLI app. Command line: zabbix_sender -z server -s host -k somekey -o 'someval'

    Without nested, <exec command="/usr/bin/zabbix_sender" args="-z server -s host -k somekey -o 'someval'" /> works fine.

    Using a nested <arg>, <exec command="/usr/bin/zabbix_sender"><arg value="-z server -s host -k somekey -o 'someval' /></exec> then the single arg is passed as 1 arg. I know that if using Runtime.exec or Processbuilder, the single arg is passed as one arg, so the equivalent shell command becomes: zabbix_sender "-z server -s host -k somekey -o 'someval'" which doesn't work. I.e. in order to get it to work, I have to use a long list args - 8 of them with this suggestion was to allow a child element of "<args>" so that if i wanted to put the args into a child element, it would still be parsed in the same way as an exec parameter. "args" as a child element is not supported.

    I've run some more tests, and it works fine when using <exec command="command" args="multiple args"><runif status="xyz" /></exec>. The documentation was a bit misleading, I didn't realise that args could still be used in the exec tag when using a runif. This is from the runif in the configuration ref:


    If <runif> is under <exec> while the <exec> has some <arg>s, the <runif>s should be defined before <arg>, e.g.

        <exec command="echo">
    <runif status="passed" />
    <arg value="test" />

    Comment actions Permalink

Please sign in to leave a comment.