add refresh_beacons and sync_beacons

This allows them to be used in the gitfs too in /srv/salt/_beacons
This commit is contained in:
Daniel Wallace 2015-05-17 23:26:48 -05:00 committed by rallytime
parent 61c922ea1a
commit 4a94b2c17b

View file

@ -245,6 +245,25 @@ def update(version=None):
return ret
def sync_beacons(saltenv=None, refresh=True):
'''
Sync the beacons from the _beacons directory on the salt master file
server. This function is environment aware, pass the desired environment
to grab the contents of the _beacons directory, base is the default
environment.
CLI Example:
.. code-block:: bash
salt '*' saltutil.sync_beacons
'''
ret = _sync('beacons', saltenv)
if refresh:
refresh_beacons()
return ret
def sync_modules(saltenv=None, refresh=True):
'''
Sync the modules from the _modules directory on the salt master file
@ -395,6 +414,7 @@ def sync_all(saltenv=None, refresh=True):
'''
log.debug('Syncing all')
ret = {}
ret['beacons'] = sync_beacons(saltenv, False)
ret['modules'] = sync_modules(saltenv, False)
ret['states'] = sync_states(saltenv, False)
ret['grains'] = sync_grains(saltenv, False)
@ -407,6 +427,24 @@ def sync_all(saltenv=None, refresh=True):
return ret
def refresh_beacons():
'''
Signal the minion to refresh the beacons.
CLI Example:
.. code-block:: bash
salt '*' saltutil.refresh_beacons
'''
try:
ret = __salt__['event.fire']({}, 'beacons_refresh')
except KeyError:
log.error('Event module not available. Module refresh failed.')
ret = False # Effectively a no-op, since we can't really return without an event system
return ret
def refresh_pillar():
'''
Signal the minion to refresh the pillar data.