Salt: Compound command execution doesn't handle multiple calls of same command

Created on 9 Aug 2017  路  10Comments  路  Source: saltstack/salt

Description of Issue/Question

When running a compound command if I use the same command twice, then only the last result is returned.

For example:

[boucha@elsapo ~]$ sudo salt \* service.available,service.available salt-api,nonexistingservice
dasalt:
    ----------
    service.available:
        False
ERROR: Minions returned with non-zero exit code

We can see from the above command that only the False return from the second command is returned. If I swap the salt-api and nonexistingservice then we can see that the True from the last call is then returned:

[boucha@elsapo ~]$ sudo salt \* service.available,service.available nonexistingservice,salt-api
dasalt:
    ----------
    service.available:
        True
ERROR: Minions returned with non-zero exit code

Here's an example of just calling service.available once:

[boucha@elsapo ~]$ sudo salt \* service.available salt-api
dasalt:
    True

Here's an example of using two different salt commands:

[boucha@elsapo ~]$ sudo salt \* service.status,service.available ufw,salt-api
dasalt:
    ----------
    service.available:
        True
    service.status:
        True
ERROR: Minions returned with non-zero exit code

This is probably because it's returning a Python dictionary with the command as a key.

Here's my versions report:

[boucha@elsapo ~]$ sudo salt \* test.versions_report
dasalt:
    Salt Version:
               Salt: 2017.7.0

    Dependency Versions:
               cffi: 1.9.1
           cherrypy: 6.0.1
           dateutil: 2.6.0
          docker-py: Not Installed
              gitdb: 0.5.4
          gitpython: 0.3.2 RC1
              ioflo: Not Installed
             Jinja2: 2.8.1
            libgit2: Not Installed
            libnacl: 1.4.4
           M2Crypto: 0.21.1
               Mako: 0.9.1
       msgpack-pure: Not Installed
     msgpack-python: 0.4.8
       mysql-python: Not Installed
          pycparser: 2.17
           pycrypto: 2.6.1
       pycryptodome: Not Installed
             pygit2: Not Installed
             Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
       python-gnupg: 0.3.7
             PyYAML: 3.12
              PyZMQ: 14.0.1
               RAET: Not Installed
              smmap: 0.8.2
            timelib: Not Installed
            Tornado: 4.3
                ZMQ: 4.0.5

    System Versions:
               dist: Ubuntu 14.04 trusty
             locale: ANSI_X3.4-1968
            machine: x86_64
            release: 3.13.0-126-generic
             system: Linux
            version: Ubuntu 14.04 trusty
Bug Core P4 ZD severity-medium stale

Most helpful comment

I noticed the exact same problem. Also, why are we always getting an error code on compound command execution, even when the calls are of different commands?

# salt 'minion' test.ping,test.echo  ,'a'
minion:
    ----------
    test.echo:
        a
    test.ping:
        True
ERROR: Minions returned with non-zero exit code

All 10 comments

ZD 1670

Here's the documentation that I used for the compound command: https://docs.saltstack.com/en/latest/topics/execution/remote_execution.html#compound-command-execution

I have been able to replicate this.

I noticed the exact same problem. Also, why are we always getting an error code on compound command execution, even when the calls are of different commands?

# salt 'minion' test.ping,test.echo  ,'a'
minion:
    ----------
    test.echo:
        a
    test.ping:
        True
ERROR: Minions returned with non-zero exit code

I would bet that what is happening is the compound command stuff is making a dictionary, and the second one in the list is overwritting the first.

Right, that explains why we get only the result of the last command in the queue.
And what about the error message?

That I am not sure, it is definitely a bug, but it is not on our list to get fixed right now.

On the first: would returning a list of dictionaries be a viable fix?

No, because the return is still a dictionary, so the return output will be overwritten.

It is entirely possible that both commands are being run, just that whichever one returns second is the one that gets spit out in the output.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

icycle77 picture icycle77  路  3Comments

saurabhnemade picture saurabhnemade  路  3Comments

nixjdm picture nixjdm  路  3Comments

Arguros picture Arguros  路  3Comments

golmaal picture golmaal  路  3Comments