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

Can't use : sign in cmd.run #61266

Open
gotsmth opened this issue Nov 19, 2021 · 1 comment
Open

Can't use : sign in cmd.run #61266

gotsmth opened this issue Nov 19, 2021 · 1 comment
Assignees
Labels
Bug broken, incorrect, or confusing behavior cannot-reproduce cannot be replicated with info/context provided
Milestone

Comments

@gotsmth
Copy link

gotsmth commented Nov 19, 2021

Hey.

Simple example:

[user@master ~]1$ sudo salt 'host' cmd.run 'echo "test: # test"'
host:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/salt/minion.py", line 1890, in _thread_return
        function_name, function_args, executors, opts, data
      File "/usr/lib/python3.6/site-packages/salt/minion.py", line 1846, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/usr/lib/python3.6/site-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/modules/cmdmod.py", line 1203, in run
        **kwargs
      File "/usr/lib/python3.6/site-packages/salt/modules/cmdmod.py", line 401, in _run
        _log_cmd(cmd),
      File "/usr/lib/python3.6/site-packages/salt/modules/cmdmod.py", line 83, in _log_cmd
        return cmd[0].strip()
    KeyError: 0
ERROR: Minions returned with non-zero exit code

But this one will work:

[user@master ~]130$ sudo salt 'host' cmd.run 'echo "test:# # test"'
host:
    test:# # test

Escaping : does not help.
Any clue?

Thank you.

Salt Version:
          Salt: 3002.7

Dependency Versions:
          cffi: Not Installed
      cherrypy: unknown
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.8.1
       libgit2: Not Installed
      M2Crypto: 0.33.0
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: 1.3.12
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Aug 13 2020, 07:46:32)
  python-gnupg: Not Installed
        PyYAML: 3.11
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4

System Versions:
          dist: rhel 7.9 Maipo
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1160.45.1.el7.x86_64
        system: Linux
       version: Red Hat Enterprise Linux Server 7.9 Maipo
``
@gotsmth gotsmth added Bug broken, incorrect, or confusing behavior needs-triage labels Nov 19, 2021
@OrangeDog
Copy link
Contributor

I'm not seeing any issue in 3004:

$ sudo salt 'host' cmd.run 'echo ":"'
host:
    :

$ sudo salt 'host' cmd.run 'echo "test: # test"'
host:
    /bin/sh: 1: Syntax error: Unterminated quoted string
ERROR: Minions returned with non-zero exit code

If you want to pass # to a shell command it needs further escaping or it will be interpreted as a comment.

@OrangeDog OrangeDog added the cannot-reproduce cannot be replicated with info/context provided label Nov 22, 2021
@frogunder frogunder added this to the Blocked milestone Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior cannot-reproduce cannot be replicated with info/context provided
Projects
None yet
Development

No branches or pull requests

3 participants