Skip to content

Non-root minion not work with state.sls module #30130

Closed

Description

@dreampuf

Issue description

Executing the state.sls module get the error with non-root user in saltstack minion client:

cm1:
    Data failed to compile:
----------
    The function "state.sls" is running as PID 8276 and was started at 2016, Jan 04 09:09:46.394825 with jid 20160104090946394825

The reason

salt/modules/saltutil.py#L633 suppose return the running job list without query job self, but it is include itself. Because salt/utils/minion.py#L66 not compatible with sudo executor condition(salt/executors/sudo.py).

Suggestion Solution

Is that passible to dedicate a PROCESSID as envinroment varibale saved executor id? It's hard to track the pid through sudo.

# salt --versions-report
Salt Version:
           Salt: 2015.8.1

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Feb 11 2014, 07:46:25)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 1.4.1
       cherrypy: 3.2.2
       dateutil: 1.5
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: redhat 7.1 Maipo
        machine: x86_64
        release: 3.10.0-123.el7.x86_64
         system: Red Hat Enterprise Linux Server 7.1 Maipo


# salt cm1 test.versions_report
cm1:
    Salt Version:
               Salt: 2015.8.1

    Dependency Versions:
             Jinja2: 2.7.2
           M2Crypto: 0.21.1
               Mako: Not Installed
             PyYAML: 3.11
              PyZMQ: 14.7.0
             Python: 2.7.5 (default, Feb 11 2014, 07:46:25)
               RAET: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.0.5
               cffi: 1.4.1
           cherrypy: 3.2.2
           dateutil: 1.5
              gitdb: Not Installed
          gitpython: Not Installed
              ioflo: Not Installed
            libnacl: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.4.6
       mysql-python: 1.2.3
          pycparser: 2.14
           pycrypto: 2.6.1
             pygit2: Not Installed
       python-gnupg: Not Installed
              smmap: Not Installed
            timelib: Not Installed

    System Versions:
               dist: redhat 7.1 Maipo
            machine: x86_64
            release: 3.10.0-123.el7.x86_64
             system: Red Hat Enterprise Linux Server 7.1 Maipo

Activity

  1. ssgward commented on Jan 4, 2016

    @ssgward

    @dreampuf - thanks for the report and the attached version reports.

    What is the exact command you are running to produce the error?

  2. added this to the Approved milestone on Jan 4, 2016
  3. added
    bug
    severity-medium
    P3
    Platform
    on Jan 4, 2016
  4. dreampuf commented on Jan 5, 2016

    @dreampuf
    ContributorAuthor

    @ssgward Here is the produce

    ### assuming you have a couple of salstack master&minion
    ### setting the minion with right permission
    $ egrep _?user: /etc/salt/minion
    user: deploy
    sudo_user: root
    
    ### restart the minion make the process under `deploy` user
    $ /etc/init.d/salt-minion restart
    
    ### make the simple test state file
    $ cat > /srv/test.sls <<EOF
    hello:
      cmd.run:
        - name: date >> /etc/issue_30130
    EOF
    
    ### execute it
    $ salt YOUR_MINION_NAME state.sls test
    cm1:
        Data failed to compile:
    ----------
        The function "state.sls" is running as PID 31701 and was started at 2016, Jan 05 02:24:09.038984 with jid 20160105022409038984
    ERROR: Minions returned with non-zero exit code
  5. added
    Core
    and removed
    Platform
    on Apr 12, 2016
  6. added a commit that references this issue on May 17, 2016
    fe5f1d6
  7. added
    fixed-pls-verify
    on May 17, 2016
  8. added a commit that references this issue on May 18, 2016
    8c1f19a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreP3State-Modulebugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions