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)
| 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 | """ |
no test coverage detected