Salt: Return code 0 on rejected minion key

Created on 26 Oct 2018  路  2Comments  路  Source: saltstack/salt

Description of Issue/Question

Running a new minion that gets rejected because of an existing key doesn't fail the salt-call state.highstate command

Setup

  • Create a minion
  • Create another minion with the same /etc/salt/minion_id
  • Run salt-call state.highstate --retcode-passthrough on the latter

Steps to Reproduce Issue

ubuntu@ip-10-0-2-101:~$ salt-call --version
salt-call 2017.7.5 (Nitrogen)
ubuntu@ip-10-0-2-101:~$ cat /etc/salt/minion_id 
elife-xpub--prod--1
ubuntu@ip-10-0-2-101:~$ sudo salt-call --force-color state.highstate -l debug --retcode-passthrough                                                                       
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/mysql-defaults.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/mysql-defaults.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: elife-xpub--prod--1
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/mysql-defaults.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/mysql-defaults.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Connecting to master. Attempt 1 of 1
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'elife-xpub--prod--1', 'tcp://10.0.2.198:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (4127)
[DEBUG   ] Setting zmq_reconnect_ivl to '4127ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'elife-xpub--prod--1', 'tcp://10.0.2.198:4506', 'clear')
[CRITICAL] The Salt Master has rejected this minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
ubuntu@ip-10-0-2-101:~$ echo $?
0

Versions Report

Salt Version:
           Salt: 2017.7.5

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   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.12 (default, Dec  4 2017, 14:50:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        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-1030-aws
         system: Linux
        version: Ubuntu 16.04 xenial
Bug P4 fixed-pending-your-verification severity-low

All 2 comments

this was fixed here: https://github.com/saltstack/salt/pull/41472 i've requested for it to be backported to 2017.7

Thank you, I could not easily find a similar bug report. We will upgrade sooner or later to Salt 2018 but it seems the previous versions are still supported and maintained :+1:

Was this page helpful?
0 / 5 - 0 ratings