From a82e158f2d874450c374f90c38e7134cbd4e4158 Mon Sep 17 00:00:00 2001 From: David Boucha Date: Tue, 9 Jan 2018 15:52:16 -0700 Subject: [PATCH] gate the minion data cache refresh events. --- doc/ref/configuration/master.rst | 16 ++++++++++++++++ salt/config/__init__.py | 4 ++++ salt/daemons/masterapi.py | 3 ++- salt/master.py | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/ref/configuration/master.rst b/doc/ref/configuration/master.rst index e9790de762..96ad30aa3f 100644 --- a/doc/ref/configuration/master.rst +++ b/doc/ref/configuration/master.rst @@ -973,6 +973,22 @@ a minion performs an authentication check with the master. auth_events: True +.. conf_master:: minion_data_cache_events + +``minion_data_cache_events`` +-------------------- + +.. versionadded:: 2017.7.3 + +Default: ``True`` + +Determines whether the master will fire minion data cache events. Minion data +cache events are fired when a minion requests a minion data cache refresh. + +.. code-block:: yaml + + minion_data_cache_events: True + .. _salt-ssh-configuration: Salt-SSH Configuration diff --git a/salt/config/__init__.py b/salt/config/__init__.py index ad610b997f..f25cff293a 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -1087,6 +1087,9 @@ VALID_OPTS = { # Whether to fire auth events 'auth_events': bool, + + # Whether to fire Minion data cache refresh events + 'minion_data_cache_events': bool, } # default configurations @@ -1654,6 +1657,7 @@ DEFAULT_MASTER_OPTS = { 'drop_messages_signature_fail': False, 'schedule': {}, 'auth_events': True, + 'minion_data_cache_events': True, } diff --git a/salt/daemons/masterapi.py b/salt/daemons/masterapi.py index 7fb38eae00..343bc90376 100644 --- a/salt/daemons/masterapi.py +++ b/salt/daemons/masterapi.py @@ -741,7 +741,8 @@ class RemoteFuncs(object): self.cache.store('minions/{0}'.format(load['id']), 'data', {'grains': load['grains'], 'pillar': data}) - self.event.fire_event('Minion data cache refresh', tagify(load['id'], 'refresh', 'minion')) + if self.opts.get('minion_data_cache_events') is True: + self.event.fire_event('Minion data cache refresh', tagify(load['id'], 'refresh', 'minion')) return data def _minion_event(self, load): diff --git a/salt/master.py b/salt/master.py index e0ccb6e5f3..7157200f90 100644 --- a/salt/master.py +++ b/salt/master.py @@ -1355,7 +1355,8 @@ class AESFuncs(object): 'data', {'grains': load['grains'], 'pillar': data}) - self.event.fire_event({'Minion data cache refresh': load['id']}, tagify(load['id'], 'refresh', 'minion')) + if salt.opts.get('minion_data_cache_events') is True: + self.event.fire_event({'Minion data cache refresh': load['id']}, tagify(load['id'], 'refresh', 'minion')) return data def _minion_event(self, load):