MCPcopy
hub / github.com/saltstack/salt / check_minion_cache

Method check_minion_cache

salt/key.py:470–498  ·  view source on GitHub ↗

Check the minion cache to make sure that old minion data is cleared Optionally, pass in a list of minions which should have their caches preserved. To preserve all caches, set __opts__['preserve_minion_cache']

(self, preserve_minions=None)

Source from the content-addressed store, hash-verified

468 return self.master_keys.gen_signature(priv, pub, sign_path)
469
470 def check_minion_cache(self, preserve_minions=None):
471 """
472 Check the minion cache to make sure that old minion data is cleared
473
474 Optionally, pass in a list of minions which should have their caches
475 preserved. To preserve all caches, set __opts__['preserve_minion_cache']
476 """
477 if self.opts.get("preserve_minion_cache", False):
478 return
479
480 if preserve_minions is None:
481 preserve_minions = []
482 preserve_minions = set(preserve_minions)
483
484 keys = self.list_keys()
485
486 for val in keys.values():
487 preserve_minions.update(val)
488
489 # we use a new cache instance here as we dont want the key cache
490 cache = salt.cache.factory(self.opts)
491
492 for bank in ["grains", "pillar"]:
493 clist = set(cache.list(bank))
494 for minion in clist - preserve_minions:
495 # pillar optionally encodes pillarenv in the key as minion:$pillarenv
496 if ":" in minion and minion.split(":")[0] in preserve_minions:
497 continue
498 cache.flush(bank, minion)
499
500 def check_master(self):
501 """

Callers 5

delete_keyMethod · 0.95
delete_denMethod · 0.95
delete_allMethod · 0.95
rejectMethod · 0.95
reject_allMethod · 0.95

Calls 8

list_keysMethod · 0.95
setFunction · 0.50
getMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45
factoryMethod · 0.45
listMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected