Skip to content

sudo.salt_call is broken #21520

Closed
Closed

Description

@jfindlay

I cannot get #20226 to work.

versions

centos-7-main salt sudo_tests # lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.0.1406 (Core)
Release:        7.0.1406
Codename:       Core
centos-7-main salt sudo_tests # salt --versions
           Salt: 2015.2.0rc1-842-gec8df42
         Python: 2.7.5 (default, Jun 17 2014, 18:11:42)
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
 msgpack-python: 0.4.5
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.11
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.4
           Mako: Not Installed

setup

centos-7-main salt sudo_tests # adduser dude
centos-7-main salt sudo_tests # finger dude
Login: dude                             Name:
Directory: /home/dude                   Shell: /bin/bash
Never logged in.
No mail.
No Plan.

execution

centos-7-main salt sudo_tests # salt centos-7-main test.ping
centos-7-main:
    True
centos-7-main salt sudo_tests # salt centos-7-main sudo.salt_call root test.ping
centos-7-main:
    The minion function caused an exception: Traceback (most recent call last):
      File "/root/salt/salt/minion.py", line 1112, in _thread_return
        return_data = func(*args, **kwargs)
      File "/root/salt/salt/modules/sudo.py", line 40, in salt_call
        cmd_meta = json.loads(cmd_ret['stdout'])['local']
      File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
        return _default_decoder.decode(s)
      File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
        raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded
centos-7-main salt sudo_tests # salt centos-7-main sudo.salt_call dude test.ping
centos-7-main:
    The minion function caused an exception: Traceback (most recent call last):
      File "/root/salt/salt/minion.py", line 1112, in _thread_return
        return_data = func(*args, **kwargs)
      File "/root/salt/salt/modules/sudo.py", line 40, in salt_call
        cmd_meta = json.loads(cmd_ret['stdout'])['local']
      File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
        return _default_decoder.decode(s)
      File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
        raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded

Activity

  1. added
    bug
    severity-low
    on Mar 10, 2015
  2. added this to the Lithium milestone on Mar 10, 2015
  3. jfindlay commented on Mar 10, 2015

    @jfindlay
    ContributorAuthor

    update

    The minion log indicates that sudo refuses to run without a tty. This (dubious) requirement is default on at least redhat systems.

    [INFO    ] User root Executing command sudo.salt_call with jid 20150310173409045759
    [DEBUG   ] Command details {'tgt_type': 'glob', 'jid': '20150310173409045759', 'tgt': 'centos-7-main', 'ret': '', 'user': 'root', 'arg': ['root', 'test.ping'], 'fun': 'sudo.salt_call'}
    [INFO    ] Starting a new job with PID 21758
    [DEBUG   ] LazyLoaded sudo.salt_call
    [INFO    ] Executing command ['sudo', '-u', 'root', 'salt-call', '--out', 'json', '--metadata', '-c', '/etc/salt', 'test.ping', '__pub_user=root', "__pub_arg=['root', 'test.ping']", '__pub_fun=sudo.salt_call', '__pub_jid=20150310173409045759', '__pub_tgt=centos-7-main', '__pub_tgt_type=glob', '__pub_ret='] in directory '/root'
    [ERROR   ] Command ['sudo', '-u', 'root', 'salt-call', '--out', 'json', '--metadata', '-c', '/etc/salt', 'test.ping', '__pub_user=root', "__pub_arg=['root', 'test.ping']", '__pub_fun=sudo.salt_call', '__pub_jid=20150310173409045759', '__pub_tgt=centos-7-main', '__pub_tgt_type=glob', '__pub_ret='] failed with return code: 1
    [ERROR   ] stderr: sudo: sorry, you must have a tty to run sudo
    [ERROR   ] retcode: 1
    
    [WARNING ] The minion function caused an exception
    Traceback (most recent call last):
      File "/root/salt/salt/minion.py", line 1112, in _thread_return
        return_data = func(*args, **kwargs)
      File "/root/salt/salt/modules/sudo.py", line 41, in salt_call
        cmd_meta = json.loads(cmd_ret['stdout'])['local']
      File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
        return _default_decoder.decode(s)
      File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
        raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded
    [DEBUG   ] SaltEvent PUB socket URI: ipc:///var/run/salt/minion/minion_event_5884d89e50_pub.ipc
    [DEBUG   ] SaltEvent PULL socket URI: ipc:///var/run/salt/minion/minion_event_5884d89e50_pull.ipc
    [DEBUG   ] Sending event - data = {'message': u'The minion function caused an exception', 'args': ('The minion function caused an exception',), '_stamp': '2015-03-10T23:34:10.073619'}
    [DEBUG   ] Handling event "_salt_error\n\n\x83\xa7message\xda\x00'The minion function caused an exception\xa4args\x91\xda\x00'The minion function caused an exception\xa6_stamp\xba2015-03-10T23:34:10.073619"
    [DEBUG   ] Forwarding salt error event tag=_salt_error
    [DEBUG   ] Re-using SAuth for ('/etc/salt/pki/minion', 'centos-7-main', 'tcp://127.0.0.1:4506')
    [INFO    ] Returning information for job: 20150310173409045759
    [DEBUG   ] Re-using SAuth for ('/etc/salt/pki/minion', 'centos-7-main', 'tcp://127.0.0.1:4506')
  4. jfindlay commented on Mar 11, 2015

    @jfindlay
    ContributorAuthor

    @thatch45, any ideas on this?

  5. modified the milestones: , Lithium on Mar 17, 2015
  6. ssgward commented on Mar 17, 2015

    @ssgward

    To be addressed in next release.

  7. added
    Core
    P2
    on Apr 16, 2015
  8. modified the milestone: on Jun 18, 2015
  9. modified the milestone: Approved on Jun 19, 2015
  10. added
    severity-medium
    needs-testcase
    and removed
    severity-low
    on Jun 19, 2015
  11. modified the milestones: Be 3, Approved on Jun 22, 2015
  12. added and removed
    needs-testcase
    on Jun 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CoreP2TestsZRELEASED - Berylliumbugseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions