salt icon indicating copy to clipboard operation
salt copied to clipboard

error when which is not available

Open unicolet opened this issue 11 years ago • 11 comments

salt installed with salt-bootstrap -X git develop on a docker container based on the saltstack/centos-6-minimal image gives an error because the which command is not available:

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'cmd.run_stdout'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 222, in salt_call
    client.run()
  File "/usr/lib/python2.7/site-packages/salt/cli/call.py", line 40, in run
    caller = salt.cli.caller.Caller.factory(self.config)
  File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 71, in factory
    return ZeroMQCaller(opts, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 254, in __init__
    super(ZeroMQCaller, self).__init__(opts)
  File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 94, in __init__
    self.minion = salt.minion.SMinion(opts)
  File "/usr/lib/python2.7/site-packages/salt/minion.py", line 300, in __init__
    opts['grains'] = salt.loader.grains(opts)
  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 475, in grains
    ret = fun()
  File "/usr/lib/python2.7/site-packages/salt/grains/core.py", line 1031, in os_data
    if _linux_bin_exists('selinuxenabled'):
  File "/usr/lib/python2.7/site-packages/salt/grains/core.py", line 977, in _linux_bin_exists
    return len(__salt__['cmd.run_stdout'](

installing which (yum -y install which) fixes the issue

unicolet avatar Apr 13 '15 10:04 unicolet

@unicolet, what is the output of salt --versions-report?

jfindlay avatar Apr 14 '15 18:04 jfindlay

bash-4.1# salt --versions-report
Salt Version:
           Salt: 2015.2.0rc1-5294-gb7362ee

Dependency Versions:
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
           Mako: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.3.1
         Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
           RAET: Not Installed
            ZMQ: 3.2.4
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.4
       pycrypto: 2.0.1

System Versions:
           dist: centos 6.6 Final
        machine: x86_64
        release: 3.13.0-34-generic
         system: CentOS 6.6 Final

unicolet avatar Apr 15 '15 07:04 unicolet

@unicolet, I've fixed this in #22806.

jfindlay avatar Apr 17 '15 19:04 jfindlay

Thank you guys, you're the best!

unicolet avatar Apr 18 '15 10:04 unicolet

#22806 also fixes problem with an absent selinuxenabled command. I have no libselinux-utils installed by default on my OpenVZ CentOS 7.1 container

TriAnMan avatar May 17 '15 20:05 TriAnMan

@jfindlay, I'm not sure that fix was correct because it works after yum install --assumeyes which and if which is not installed I got same error.

alexanderilyin avatar May 22 '15 02:05 alexanderilyin

@unicolet, what is the version of salt you are using, what command are you using to get the error, and what is the debug log output?

jfindlay avatar May 22 '15 02:05 jfindlay

@jfindlay see above. I was running a fairly complex state.highstate.

unicolet avatar May 22 '15 05:05 unicolet

@unicolet, sorry, I meant that for @alexanderilyin. @alexanderilyin, will you provide the info requested in https://github.com/saltstack/salt/issues/22574#issuecomment-104482987? Thanks.

jfindlay avatar May 22 '15 15:05 jfindlay

Unfortunately, I applied the fix for this issue to the wrong branch. Once it's backported, it will be available in 2015.5.2 in about 2.5 weeks.

jfindlay avatar May 22 '15 18:05 jfindlay

@jfindlay

salt-call --versions-report
           Salt: 2015.5.0
         Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
         Jinja2: unknown
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed
Step 6 : RUN salt-call --local --id $ID --hard-crash --retcode-passthrough state.highstate
 ---> Running in 3151d19e6fc9
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'cmd.run_stdout'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 227, in salt_call
    client.run()
  File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 59, in run
    caller = salt.cli.caller.Caller.factory(self.config)
  File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 69, in factory
    return ZeroMQCaller(opts, **kwargs)
  File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 92, in __init__
    self.minion = salt.minion.SMinion(opts)
  File "/usr/lib/python2.6/site-packages/salt/minion.py", line 298, in __init__
    opts['grains'] = salt.loader.grains(opts)
  File "/usr/lib/python2.6/site-packages/salt/loader.py", line 508, in grains
    ret = fun()
  File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 1005, in os_data
    if _linux_bin_exists('selinuxenabled'):
  File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 951, in _linux_bin_exists
    return len(__salt__['cmd.run_stdout'](
KeyError: 'cmd.run_stdout'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 227, in salt_call
    client.run()
  File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 59, in run
    caller = salt.cli.caller.Caller.factory(self.config)
  File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 69, in factory
    return ZeroMQCaller(opts, **kwargs)
  File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 92, in __init__
    self.minion = salt.minion.SMinion(opts)
  File "/usr/lib/python2.6/site-packages/salt/minion.py", line 298, in __init__
    opts['grains'] = salt.loader.grains(opts)
  File "/usr/lib/python2.6/site-packages/salt/loader.py", line 508, in grains
    ret = fun()
  File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 1005, in os_data
    if _linux_bin_exists('selinuxenabled'):
  File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 951, in _linux_bin_exists
    return len(__salt__['cmd.run_stdout'](
KeyError: 'cmd.run_stdout'
INFO[0053] The command [/bin/sh -c salt-call --local --id $ID --hard-crash --retcode-passthrough state.highstate] returned a non-zero code: 1 

alexanderilyin avatar May 22 '15 18:05 alexanderilyin