saltutil模块用于管理minion的状态
/usr/lib/python2.6/site-packages/salt/modules/saltutil.py
# -*- coding: utf-8 -*- ''' The Saltutil module is used to manage the state of the salt minion itself. It is used to manage minion modules as well as automate updates to the salt minion. :depends: - esky Python module for update functionality '''
def sync_grains(saltenv=None, refresh=True): ''' Sync the grains from the _grains directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _grains directory, base is the default environment. CLI Example: .. code-block:: bash salt '*' saltutil.sync_grains ''' ret = _sync('grains', saltenv) if refresh: refresh_modules() refresh_pillar() return ret
def sync_all(saltenv=None, refresh=True): ''' Sync down all of the dynamic modules from the file server for a specific environment CLI Example: .. code-block:: bash salt '*' saltutil.sync_all ''' log.debug('Syncing all') ret = {} ret['modules'] = sync_modules(saltenv, False) ret['states'] = sync_states(saltenv, False) ret['grains'] = sync_grains(saltenv, False) ret['renderers'] = sync_renderers(saltenv, False) ret['returners'] = sync_returners(saltenv, False) ret['outputters'] = sync_outputters(saltenv, False) ret['utils'] = sync_utils(saltenv, False) if refresh: refresh_modules() return ret