def _cached_roles(search):
"""
Return the cached roles in a convenient structure. Trust the cached
values from the master pillar since a downed minion will be absent
from any dynamic query. Also, do not worry about downed minions that
are outside of the search criteria.
"""
pillar_util = salt.utils.master.MasterPillarUtil(search, "compound",
use_cached_grains=True,
grains_fallback=False,
opts=__opts__)
cached = pillar_util.get_minion_pillar()
roles = {}
for minion in cached:
if 'roles' in cached[minion]:
for role in cached[minion]['roles']:
roles.setdefault(role, []).append(minion)
log.debug(pprint.pformat(roles))
return roles.keys()
评论列表
文章目录