Salt: Salt-key unable to delete the certificate Test=True

Created on 10 Jul 2018  路  6Comments  路  Source: saltstack/salt

Description of Issue/Question

For some reason my output of salt-key list has a strange key Test=True and I wasn't able to delete them unless I used a glob matching.

Setup

Steps to Reproduce Issue

~# salt-key list |grep =
Test=True

~# salt-key -d Test=True
The following keyword arguments are not valid: Test=True

~# salt-key -d "Test*True"
The following keys are going to be deleted:
Accepted Keys:
Test=True
Proceed? [N/y] y
Key for minion Test=True deleted.

Versions Report

root@jenkins:~# salt --versions-report
Salt Version:
           Salt: 2018.3.0-624-ge8fc110

Dependency Versions:
           cffi: 1.11.2
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: 1.7.2
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Dec  4 2017, 14:50:18)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-1043-aws
         system: Linux
        version: Ubuntu 16.04 xenial
Bug fixed-pending-your-verification

Most helpful comment

All 6 comments

Looking at the code it looks like the parser looks through each arg and checks to see if its a kwarg here: https://github.com/saltstack/salt/blob/v2018.3.1/salt/utils/args.py#L98 and compares this re match: '^([^\d\W][\w.-]*)=(?!=)(.*)$'

I want to say this is expected behavior but want to make sure @saltstack/team-core is this expected bheavior or could we possibly handle this befor it looks to see if the argument to salt-key -d is a kwarg?

If we support = in the minion id, we should support deleting the key with = in it.

Agree with @gtmanfred

Can we have an argument termination? I tried this without success:

salt-key -d -- Test=True

@icy the issue is not there. Arg parser correctly parses the Test=True as -d's value. After that salt-key passes that line to a matching function but not directly but using reverse-lookup mechanism to determine the function args/kwargs. We use it for all functions. So it looks we should avoid this mechanism in some cases like this.
But I have no time to look for the solution deeper so there could be more elegant way to resolve this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peter-slovak picture peter-slovak  路  49Comments

chrismoos picture chrismoos  路  54Comments

xiaopanggege picture xiaopanggege  路  158Comments

Zogg picture Zogg  路  80Comments

tjyang picture tjyang  路  98Comments