The final module
With all of our code in place, the final module will look like:
''' Scan Minions for various pieces of information This file should be saved as salt/runners/scan.py ''' import salt.client import salt.key __func_alias__ = { 'up_': 'up' } def up_(tgt='*', tgt_type='glob'): ''' Return a list of minions which are responding ''' client = salt.client.get_local_client(__opts__['conf_file']) minions = client.cmd( tgt, 'test.ping', expr_form=tgt_type, timeout=__opts__['timeout'] ''' Return a list of minions which are NOT responding ''' minions = up_(tgt, tgt_type) key = salt.key.Key(__opts__) keys = key.list_keys() return sorted(set(keys['minions']) - set(minions)) def hypers(client=None): ''' Return a list of Minions that are running hypervisors ''' if client is None: client = salt.client.get_local_client(__opts__['conf_file']) minions = client.cmd( '*...