saltstack / saltstack/salt

Can't use `:` sign in cmd.run

Open
#61,266 1 comment 0 reactions 1 assignee View on GitHub

@frogunder is already working on this.

Since Nov 19, 2021.

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

Description

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
``

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.