saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

__salt__[at.at]() concatenates command <cmd> and tag= #53852

Closed rso-support closed 5 years ago

rso-support commented 5 years ago

Description of Issue

salt[at.at]() concatenates command and tag=

Setup

at.at, when called within a custom remote execution modules, concatenates the and tag= args

Code snip as follows: atcmd='rm -f ' + sudof + lecturef attag='tag=' + approval atret = salt['at.at']('now + ' + str(kwargs['hours']) + ' hours ', atcmd, attag)

results in the following (note the ### SALT: tag is never added. Instead, the tag is appended to the command to be executed:

[root@somehost ~]# grep rm /var/spool/at/a0003b018d8bd8 rm -f /file1 /file2 tag=usertag

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

----------------- salt master Salt Version: Salt: 2018.3.4

Dependency Versions: cffi: 1.6.0 cherrypy: unknown dateutil: 1.5 docker-py: Not Installed gitdb: 2.0.0 gitpython: 2.1.1 ioflo: Not Installed Jinja2: 2.7.2 libgit2: 0.24.3 libnacl: Not Installed M2Crypto: 0.21.1 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.8 mysql-python: Not Installed pycparser: 2.14 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.24.2 Python: 2.7.5 (default, Apr 9 2019, 16:02:27) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 RAET: Not Installed smmap: 2.0.1 timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: oracle 7.6 locale: UTF-8 machine: x86_64 release: 4.14.35-1844.4.5.el7uek.x86_64 system: Linux version: Oracle Linux Server 7.6

---------------salt minion: Salt Version: Salt: 2018.3.4

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.7.2 libgit2: Not Installed libnacl: Not Installed M2Crypto: 0.21.1 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.5 (default, Nov 1 2018, 03:12:47) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: oracle 7.6 locale: UTF-8 machine: x86_64 release: 3.10.0-957.5.1.el7.x86_64 system: Linux version: Oracle Linux Server 7.6

rso-support commented 5 years ago

Bug will be closed - syntax issue. The following solved my issue

Note: tag= did not require quoting.

atret = __salt__['at.at'](timespec,atcmd,tag=kwargs['approval'])