saltstack / saltstack/salt

[BUG] DN string like argument taken as invalid keyword argument

Open
#59,542 3 comments 0 reactions 2 assignees View on GitHub

@xeacott is already working on this.

Since Feb 22, 2021.

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

Description

Description
Custom module create by customer expects 3 positional arguments, the second one is a Active Directory DN string, ex: "cn=Users,dc=cselab,dc=local"

This strign seems to be interpreted as a keyword argument by Salt client, throwing:
The following keyword arguments are not valid: CN=Users,DC=cselab,DC=local

Workaround is to escape the '=' signs using '='

Setup
A simple module to show received args is provided.

Steps to Reproduce the behavior
Observe the output execution failing when using "cn=Users,dc=cselab,dc=local" vs escaped "cn=Users,dc=cselab,dc=local"

`
$ salt win* saltutil.sync_modules
winad01:
- modules.dn_test

$ cat dn_test.py
def show_args(groupname,base_dn,description):
return "Group Name: {gname}, DN: {DN}, Desc: {desc}".format(gname = groupname, DN = base_dn, desc = description)

$ salt win* dn_test.show_args my_group3 "cn=Users,dc=cselab,dc=local" "This is my new group."
winad01:
ERROR executing 'dn_test.show_args': The following keyword arguments are not valid: cn=Users,dc=cselab,dc=local
ERROR: Minions returned with non-zero exit code

$ salt win* dn_test.show_args my_group3 "cn=Users,dc=cselab,dc=local" "This is my new group."
winad01:
Group Name: my_group3, DN: cn=Users,dc=cselab,dc=local, Desc: This is my new group.

`

Expected behavior
While the workaround escaping code is acceptable, would be nice to have some logic to avoid this failure and take this type of string as a valid argument

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report

Salt Version:
Salt: 3002.2

Dependency Versions:
cffi: 1.9.1
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.14
pycrypto: Not Installed
pycryptodome: 3.10.1
pygit2: Not Installed
Python: 3.6.8 (default, Aug 13 2020, 07:46:32)
python-gnupg: Not Installed
PyYAML: 3.13
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.15.2.el7.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 7.9 Maipo

Windows MInion:
c:\salt\bin>salt-call test.versions
local:
Salt Version:
Salt: 3002.2

Dependency Versions:
          cffi: 1.12.2
      cherrypy: 17.4.1
      dateutil: 2.8.0
     docker-py: Not Installed
         gitdb: 2.0.5
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.0.7
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
  python-gnupg: 0.4.4
        PyYAML: 5.3.1
         PyZMQ: 18.0.1
         smmap: 2.0.5
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist:
        locale: cp1252
       machine: AMD64
       release: 2016Server
        system: Windows
       version: 2016Server 10.0.14393 SP0

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.