Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2019.2.1] Sudo user error #54429

Closed
frogunder opened this issue Sep 6, 2019 · 1 comment

Comments

@frogunder
Copy link
Contributor

commented Sep 6, 2019

Description of Issue

Running commands with sudo user fails.
This is a regression from 2019.2.0, where it is working fine.
Fails on 2019.2.1.

This in minion config file:

sudo_user: root
user: saltdev

Fails with this exception:

    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1663, in _thread_return
        return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
      File "/usr/lib/python2.7/site-packages/salt/executors/sudo.py", line 69, in execute
        cmd_ret = __salt__['cmd.run_all'](cmd, use_vt=True, python_shell=False)
      File "/usr/lib/python2.7/site-packages/salt/utils/context.py", line 236, in __getitem__
        return self._dict()[key]
    KeyError: u'cmd.run_all'

Setup

On <minion>:
- useradd saltdev
- add saltdev ALL=(ALL) NOPASSWD:ALL in sudoers file
- echo sudo_user: root >> /etc/salt/minion
- echo user: saltdev >> /etc/salt/minion
- service salt-minion restart

Run Salt-minion in debug mode

run:
chown -R saltdev /var/log/salt /etc/salt /var/cache/salt /var/log/salt/minion /var/run/salt

Steps to Reproduce Issue

salt \* grains.item ipv4
cent7:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1663, in _thread_return
        return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
      File "/usr/lib/python2.7/site-packages/salt/executors/sudo.py", line 69, in execute
        cmd_ret = __salt__['cmd.run_all'](cmd, use_vt=True, python_shell=False)
      File "/usr/lib/python2.7/site-packages/salt/utils/context.py", line 236, in __getitem__
        return self._dict()[key]
    KeyError: u'cmd.run_all'
ERROR: Minions returned with non-zero exit code
ps aux  | grep salt
root       745  0.0  0.0 112708   984 pts/1    S+   15:36   0:00 grep --color=auto salt
root     27714  0.0  4.3 391184 44148 ?        Ss   14:45   0:00 /usr/bin/python2 /usr/bin/salt-master
root     27723  0.0  2.7 352500 28180 ?        S    14:45   0:00 /usr/bin/python2 /usr/bin/salt-master
root     27731  0.0  3.7 471612 37772 ?        Sl   14:45   0:00 /usr/bin/python2 /usr/bin/salt-master
root     27732  0.0  3.7 390092 37516 ?        S    14:45   0:00 /usr/bin/python2 /usr/bin/salt-master
root     27742  0.3  7.3 425924 74132 ?        S    14:45   0:10 /usr/bin/python2 /usr/bin/salt-master
root     27744  0.0  3.7 390876 38068 ?        S    14:45   0:00 /usr/bin/python2 /usr/bin/salt-master
root     27745  0.0  3.8 767632 38620 ?        Sl   14:45   0:02 /usr/bin/python2 /usr/bin/salt-master
root     27746  0.0  5.1 484828 51888 ?        Sl   14:45   0:01 /usr/bin/python2 /usr/bin/salt-master
root     27747  0.0  5.3 568492 53736 ?        Sl   14:45   0:01 /usr/bin/python2 /usr/bin/salt-master
root     27748  0.0  5.1 484876 51976 ?        Sl   14:45   0:01 /usr/bin/python2 /usr/bin/salt-master
root     27749  0.0  5.3 486496 53632 ?        Sl   14:45   0:01 /usr/bin/python2 /usr/bin/salt-master
root     27756  0.1  3.8 464916 38444 ?        Sl   14:45   0:04 /usr/bin/python2 /usr/bin/salt-master
root     27757  0.0  5.1 566964 52020 ?        Sl   14:45   0:01 /usr/bin/python2 /usr/bin/salt-master
root     28988  0.0  3.3 376128 33444 pts/2    S+   14:46   0:00 /usr/bin/python2 /usr/bin/salt-minion -ldebug
saltdev  28997  0.1  4.7 698036 47564 pts/2    Sl+  14:46   0:03 /usr/bin/python2 /usr/bin/salt-minion -ldebug
saltdev  28999  0.0  2.8 450520 28752 pts/2    S+   14:46   0:00 /usr/bin/python2 /usr/bin/salt-minion -ldebug

Versions Report

Salt Version:
           Salt: 2019.2.1
 
Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Apr  9 2019, 14:30:50)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-957.21.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core
@frogunder

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2019

Fixed, thanks.

@frogunder frogunder closed this Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.