saltstack / saltstack/salt

[BUG] run python script occur error message

Open
#58,707 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-more-info
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
run python script occur error message

Setup
image

salt minion error message
2020-10-10 17:00:19,965 [salt.loaded.int.module.cmdmod:290 ][WARNING ][28010] Attempt to run a shell command with what may be an invalid shell! Check to ensure that the shell </usr/bin/python> is valid for this user. 2020-10-10 17:00:20,012 [salt.loaded.int.module.cmdmod:518 ][ERROR ][28010] Environment could not be retrieved for user 'root': stderr=u' File "<string>", line 1\n /usr/bin/python\n ^\nSyntaxError: invalid syntax\n' stdout=u''

Steps to Reproduce the behavior
salt "192.168.23.22" cmd.run "print 'hello'" shell="/usr/bin/python" runas=root group=root

Expected behavior

Screenshots
image

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3000.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.3
        libgit2: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Apr  2 2020, 13:16:51)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.7.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.3.1611 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-514.el7.x86_64
         system: Linux
        version: CentOS Linux 7.3.1611 Core

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported salt cmd.run command with shell="/usr/bin/python" on the stated Salt 3000.2, Python 2.7.5, and CentOS 7 setup. Trace how cmd.run validates the shell and retrieves the root user's environment; the issue's missing expected behavior means the intended successful result must be clarified before work can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.