Skip to content

Grain targeting matches any minion (when it's cache directory is missing) #54730

Description

@adamlamers

Description of Issue

When targeting minions with the -G flag in the salt CLI, salt will match any minion that does not have an existing directory in /var/cache/salt/master/minions. This leads to many unwanted minions being targeted when attempting to match a grain.

Setup

  • Have an offline salt minion with an accepted key on the master.
  • Delete directory /var/cache/salt/master/minions/<minion_id>

Steps to Reproduce Issue

  • Run salt -G 'asd:def' test.ping
  • The offline minion will be targeted by this, even though it most likely doesn't have a grain of "asd" with value "def". These can be arbitrary values.
  • Create a directory /var/cache/salt/master/minions/<minion_id> and run the same grain targeting call, and it will no longer be targeted.

Versions Report

(My main salt master versions, however it appears to also happen in 2019.2)

Salt Version:
Salt: 2017.7.2

Dependency Versions:
cffi: 1.11.2
cherrypy: 3.2.3
dateutil: 2.2
docker-py: Not Installed
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.9.6
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.2.3
pycparser: 2.18
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.5.2
ZMQ: 4.1.6

System Versions:
dist: debian 8.1
locale: UTF-8
machine: x86_64
release: 3.16.0-4-amd64
system: Linux
version: debian 8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Featurenew functionality including changes to functionality and code refactors, etc.ZRELEASED - 2017.7retired label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions