repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/modules/saltutil.py
_sync
python
def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None): ''' Sync the given directory in the given environment ''' if saltenv is None: saltenv = _get_top_file_envs() if isinstance(saltenv, six.string_types): saltenv = saltenv.split(',') ret, touched = salt.uti...
Sync the given directory in the given environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L101-L123
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
update
python
def update(version=None): ''' Update the salt minion from the URL defined in opts['update_url'] SaltStack, Inc provides the latest builds here: update_url: https://repo.saltstack.com/windows/ Be aware that as of 2014-8-11 there's a bug in esky such that only the latest version available in the ...
Update the salt minion from the URL defined in opts['update_url'] SaltStack, Inc provides the latest builds here: update_url: https://repo.saltstack.com/windows/ Be aware that as of 2014-8-11 there's a bug in esky such that only the latest version available in the update_url can be downloaded and insta...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L126-L189
null
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_beacons
python
def sync_beacons(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 2015.5.1 Sync beacons from ``salt://_beacons`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-sep...
.. versionadded:: 2015.5.1 Sync beacons from ``salt://_beacons`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. If not passed, then all environments configured in the :ref:`top files <st...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L192-L228
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_sdb
python
def sync_sdb(saltenv=None, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 2015.5.8,2015.8.3 Sync sdb modules from ``salt://_sdb`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated li...
.. versionadded:: 2015.5.8,2015.8.3 Sync sdb modules from ``salt://_sdb`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. If not passed, then all environments configured in the :ref:`top files ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L231-L264
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_modules
python
def sync_modules(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 0.10.0 Sync execution modules from ``salt://_modules`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a c...
.. versionadded:: 0.10.0 Sync execution modules from ``salt://_modules`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. If not passed, then all environments configured in the :ref:`top files ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L267-L320
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
refresh_grains
python
def refresh_grains(**kwargs): ''' .. versionadded:: 2016.3.6,2016.11.4,2017.7.0 Refresh the minion's grains without syncing custom grains modules from ``salt://_grains``. .. note:: The available execution modules will be reloaded as part of this proceess, as grains can affect which...
.. versionadded:: 2016.3.6,2016.11.4,2017.7.0 Refresh the minion's grains without syncing custom grains modules from ``salt://_grains``. .. note:: The available execution modules will be reloaded as part of this proceess, as grains can affect which modules are available. refresh_pilla...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L362-L392
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_grains
python
def sync_grains(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 0.10.0 Sync grains modules from ``salt://_grains`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-...
.. versionadded:: 0.10.0 Sync grains modules from ``salt://_grains`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. If not passed, then all environments configured in the :ref:`top files ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L395-L433
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_matchers
python
def sync_matchers(saltenv=None, refresh=False, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 2019.2.0 Sync engine modules from ``salt://_matchers`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a...
.. versionadded:: 2019.2.0 Sync engine modules from ``salt://_matchers`` to the minion saltenv The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. If not passed, then all environments configured in the :ref:`top files ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L553-L588
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
list_extmods
python
def list_extmods(): ''' .. versionadded:: 2017.7.0 List Salt modules which have been synced externally CLI Examples: .. code-block:: bash salt '*' saltutil.list_extmods ''' ret = {} ext_dir = os.path.join(__opts__['cachedir'], 'extmods') mod_types = os.listdir(ext_dir) ...
.. versionadded:: 2017.7.0 List Salt modules which have been synced externally CLI Examples: .. code-block:: bash salt '*' saltutil.list_extmods
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L859-L880
[ "def os_walk(top, *args, **kwargs):\n '''\n This is a helper than ensures that all paths returned from os.walk are\n unicode.\n '''\n if six.PY2 and salt.utils.platform.is_windows():\n top_query = top\n else:\n top_query = salt.utils.stringutils.to_str(top)\n for item in os.walk(t...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_pillar
python
def sync_pillar(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionadded:: 2015.8.11,2016.3.2 Sync pillar modules from the ``salt://_pillar`` directory on the Salt fileserver. This function is environment-aware, pass the desired environment to grab the contents...
.. versionadded:: 2015.8.11,2016.3.2 Sync pillar modules from the ``salt://_pillar`` directory on the Salt fileserver. This function is environment-aware, pass the desired environment to grab the contents of the ``_pillar`` directory from that environment. The default environment, if none is specified,...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L922-L960
[ "def _sync(form, saltenv=None, extmod_whitelist=None, extmod_blacklist=None):\n '''\n Sync the given directory in the given environment\n '''\n if saltenv is None:\n saltenv = _get_top_file_envs()\n if isinstance(saltenv, six.string_types):\n saltenv = saltenv.split(',')\n ret, touch...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
sync_all
python
def sync_all(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None): ''' .. versionchanged:: 2015.8.11,2016.3.2 On masterless minions, pillar modules are now synced, and refreshed when ``refresh`` is set to ``True``. Sync down all of the dynamic modules from the file serv...
.. versionchanged:: 2015.8.11,2016.3.2 On masterless minions, pillar modules are now synced, and refreshed when ``refresh`` is set to ``True``. Sync down all of the dynamic modules from the file server for a specific environment. This function synchronizes custom modules, states, beacons, g...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L963-L1034
[ "def sync_clouds(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None):\n '''\n .. versionadded:: 2017.7.0\n\n Sync cloud modules from ``salt://_cloud`` to the minion\n\n saltenv : base\n The fileserver environment from which to sync. To sync from more than\n one enviro...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
refresh_pillar
python
def refresh_pillar(**kwargs): ''' Signal the minion to refresh the pillar data. .. versionchanged:: Neon The ``async`` argument has been added. The default value is True. CLI Example: .. code-block:: bash salt '*' saltutil.refresh_pillar salt '*' saltutil.refresh_pillar a...
Signal the minion to refresh the pillar data. .. versionchanged:: Neon The ``async`` argument has been added. The default value is True. CLI Example: .. code-block:: bash salt '*' saltutil.refresh_pillar salt '*' saltutil.refresh_pillar async=False
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1073-L1104
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
is_running
python
def is_running(fun): ''' If the named function is running return the data associated with it/them. The argument can be a glob CLI Example: .. code-block:: bash salt '*' saltutil.is_running state.highstate ''' run = running() ret = [] for data in run: if fnmatch.fnm...
If the named function is running return the data associated with it/them. The argument can be a glob CLI Example: .. code-block:: bash salt '*' saltutil.is_running state.highstate
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1143-L1159
[ "def running():\n '''\n Return the data on all running salt processes on the minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' saltutil.running\n '''\n return salt.utils.minion.running(__opts__)\n" ]
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
clear_cache
python
def clear_cache(days=-1): ''' Forcibly removes all caches on a minion. .. versionadded:: 2014.7.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' sa...
Forcibly removes all caches on a minion. .. versionadded:: 2014.7.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' saltutil.clear_cache days=7
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1175-L1204
[ "def safe_walk(top, topdown=True, onerror=None, followlinks=True, _seen=None):\n '''\n A clone of the python os.walk function with some checks for recursive\n symlinks. Unlike os.walk this follows symlinks by default.\n '''\n if _seen is None:\n _seen = set()\n\n # We may not have read perm...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
clear_job_cache
python
def clear_job_cache(hours=24): ''' Forcibly removes job cache folders and files on a minion. .. versionadded:: 2018.3.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bas...
Forcibly removes job cache folders and files on a minion. .. versionadded:: 2018.3.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' saltutil.clear_job_cach...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1207-L1234
[ "def safe_walk(top, topdown=True, onerror=None, followlinks=True, _seen=None):\n '''\n A clone of the python os.walk function with some checks for recursive\n symlinks. Unlike os.walk this follows symlinks by default.\n '''\n if _seen is None:\n _seen = set()\n\n # We may not have read perm...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
find_cached_job
python
def find_cached_job(jid): ''' Return the data for a specific cached job id. Note this only works if cache_jobs has previously been set to True on the minion. CLI Example: .. code-block:: bash salt '*' saltutil.find_cached_job <job id> ''' serial = salt.payload.Serial(__opts__) ...
Return the data for a specific cached job id. Note this only works if cache_jobs has previously been set to True on the minion. CLI Example: .. code-block:: bash salt '*' saltutil.find_cached_job <job id>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1289-L1322
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
signal_job
python
def signal_job(jid, sig): ''' Sends a signal to the named salt job's process CLI Example: .. code-block:: bash salt '*' saltutil.signal_job <job id> 15 ''' if HAS_PSUTIL is False: log.warning('saltutil.signal job called, but psutil is not installed. ' 'Inst...
Sends a signal to the named salt job's process CLI Example: .. code-block:: bash salt '*' saltutil.signal_job <job id> 15
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1325-L1360
[ "def running():\n '''\n Return the data on all running salt processes on the minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' saltutil.running\n '''\n return salt.utils.minion.running(__opts__)\n" ]
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
term_all_jobs
python
def term_all_jobs(): ''' Sends a termination signal (SIGTERM 15) to all currently running jobs CLI Example: .. code-block:: bash salt '*' saltutil.term_all_jobs ''' ret = [] for data in running(): ret.append(signal_job(data['jid'], signal.SIGTERM)) return ret
Sends a termination signal (SIGTERM 15) to all currently running jobs CLI Example: .. code-block:: bash salt '*' saltutil.term_all_jobs
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1376-L1389
[ "def running():\n '''\n Return the data on all running salt processes on the minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' saltutil.running\n '''\n return salt.utils.minion.running(__opts__)\n", "def signal_job(jid, sig):\n '''\n Sends a signal to the named salt job'...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
kill_all_jobs
python
def kill_all_jobs(): ''' Sends a kill signal (SIGKILL 9) to all currently running jobs CLI Example: .. code-block:: bash salt '*' saltutil.kill_all_jobs ''' # Some OS's (Win32) don't have SIGKILL, so use salt_SIGKILL which is set to # an appropriate value for the operating system ...
Sends a kill signal (SIGKILL 9) to all currently running jobs CLI Example: .. code-block:: bash salt '*' saltutil.kill_all_jobs
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1407-L1422
[ "def running():\n '''\n Return the data on all running salt processes on the minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' saltutil.running\n '''\n return salt.utils.minion.running(__opts__)\n", "def signal_job(jid, sig):\n '''\n Sends a signal to the named salt job'...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
regen_keys
python
def regen_keys(): ''' Used to regenerate the minion keys. CLI Example: .. code-block:: bash salt '*' saltutil.regen_keys ''' for fn_ in os.listdir(__opts__['pki_dir']): path = os.path.join(__opts__['pki_dir'], fn_) try: os.remove(path) except os.err...
Used to regenerate the minion keys. CLI Example: .. code-block:: bash salt '*' saltutil.regen_keys
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1425-L1444
[ "def factory(opts, **kwargs):\n # All Sync interfaces are just wrappers around the Async ones\n sync = SyncWrapper(AsyncReqChannel.factory, (opts,), kwargs)\n return sync\n" ]
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
revoke_auth
python
def revoke_auth(preserve_minion_cache=False): ''' The minion sends a request to the master to revoke its own key. Note that the minion session will be revoked and the minion may not be able to return the result of this command back to the master. If the 'preserve_minion_cache' flag is set to True, ...
The minion sends a request to the master to revoke its own key. Note that the minion session will be revoked and the minion may not be able to return the result of this command back to the master. If the 'preserve_minion_cache' flag is set to True, the master cache for this minion will not be removed. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1447-L1483
[ "def factory(opts, **kwargs):\n # All Sync interfaces are just wrappers around the Async ones\n sync = SyncWrapper(AsyncReqChannel.factory, (opts,), kwargs)\n return sync\n" ]
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
cmd
python
def cmd(tgt, fun, arg=(), timeout=None, tgt_type='glob', ret='', kwarg=None, ssh=False, **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``...
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Assuming this minion is a master, execute a salt command CLI Example: .. code-block:: bash salt '*' saltutil.cmd
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1537-L1584
[ "def _exec(client, tgt, fun, arg, timeout, tgt_type, ret, kwarg, **kwargs):\n fcn_ret = {}\n seen = 0\n if 'batch' in kwargs:\n _cmd = client.cmd_batch\n cmd_kwargs = {\n 'tgt': tgt, 'fun': fun, 'arg': arg, 'tgt_type': tgt_type,\n 'ret': ret, 'kwarg': kwarg, 'batch': kwa...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
cmd_iter
python
def cmd_iter(tgt, fun, arg=(), timeout=None, tgt_type='glob', ret='', kwarg=None, ssh=False, **kwargs): ''' .. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, ea...
.. versionchanged:: 2017.7.0 The ``expr_form`` argument has been renamed to ``tgt_type``, earlier releases must use ``expr_form``. Assuming this minion is a master, execute a salt command CLI Example: .. code-block:: bash salt '*' saltutil.cmd_iter
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1587-L1622
[ "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the config and return the correct LocalClient object based on\n ...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
runner
python
def runner(name, arg=None, kwarg=None, full_return=False, saltenv='base', jid=None, asynchronous=False, **kwargs): ''' Execute a runner function. This function must be run on the master, either by targeting a minion running on a master or by using salt-call on a master. .. versionadded:: 2014.7.0 ...
Execute a runner function. This function must be run on the master, either by targeting a minion running on a master or by using salt-call on a master. .. versionadded:: 2014.7.0 name The name of the function to run kwargs Any keyword arguments to pass to the runner function ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1625-L1697
[ "def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False):\n '''\n Reads in the master configuration file and sets up default options\n\n This is useful for running the actual master daemon. For running\n Master-side client interfaces that need the master opts se...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
wheel
python
def wheel(name, *args, **kwargs): ''' Execute a wheel module and function. This function must be run against a minion that is local to the master. .. versionadded:: 2014.7.0 name The name of the function to run args Any positional arguments to pass to the wheel function. A com...
Execute a wheel module and function. This function must be run against a minion that is local to the master. .. versionadded:: 2014.7.0 name The name of the function to run args Any positional arguments to pass to the wheel function. A common example of this would be the ``mat...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1700-L1794
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_function_argspec(func, is_class_method=None):\n '''\n A small wrapper around getargspec that also supports callable classes\n :param is_class_method: Pass True if you are sure that the function being passed\n i...
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/saltutil.py
mmodule
python
def mmodule(saltenv, fun, *args, **kwargs): ''' Loads minion modules from an environment so that they can be used in pillars for that environment CLI Example: .. code-block:: bash salt '*' saltutil.mmodule base test.ping ''' mminion = _MMinion(saltenv) return mminion.functions...
Loads minion modules from an environment so that they can be used in pillars for that environment CLI Example: .. code-block:: bash salt '*' saltutil.mmodule base test.ping
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1830-L1842
null
# -*- 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 ''' from __future__ import absolute_import, print_function, unicode_litera...
saltstack/salt
salt/modules/zenoss.py
_session
python
def _session(): ''' Create a session to be used when connecting to Zenoss. ''' config = __salt__['config.option']('zenoss') session = requests.session() session.auth = (config.get('username'), config.get('password')) session.verify = False session.headers.update({'Content-type': 'applic...
Create a session to be used when connecting to Zenoss.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L68-L78
null
# -*- coding: utf-8 -*- ''' Module for working with the Zenoss API .. versionadded:: 2016.3.0 :depends: requests :configuration: This module requires a 'zenoss' entry in the master/minion config. For example: .. code-block:: yaml zenoss: hostname: https://zenoss.example.com use...
saltstack/salt
salt/modules/zenoss.py
_router_request
python
def _router_request(router, method, data=None): ''' Make a request to the Zenoss API router ''' if router not in ROUTERS: return False req_data = salt.utils.json.dumps([dict( action=router, method=method, data=data, type='rpc', tid=1)]) config = ...
Make a request to the Zenoss API router
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L81-L107
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Module for working with the Zenoss API .. versionadded:: 2016.3.0 :depends: requests :configuration: This module requires a 'zenoss' entry in the master/minion config. For example: .. code-block:: yaml zenoss: hostname: https://zenoss.example.com use...
saltstack/salt
salt/modules/zenoss.py
find_device
python
def find_device(device=None): ''' Find a device in Zenoss. If device not found, returns None. Parameters: device: (Optional) Will use the grain 'fqdn' by default CLI Example: salt '*' zenoss.find_device ''' data = [{'uid': '/zport/dmd/Devices', 'params': {}, 'limit': N...
Find a device in Zenoss. If device not found, returns None. Parameters: device: (Optional) Will use the grain 'fqdn' by default CLI Example: salt '*' zenoss.find_device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L118-L139
[ "def _router_request(router, method, data=None):\n '''\n Make a request to the Zenoss API router\n '''\n if router not in ROUTERS:\n return False\n\n req_data = salt.utils.json.dumps([dict(\n action=router,\n method=method,\n data=data,\n type='rpc',\n tid=1)...
# -*- coding: utf-8 -*- ''' Module for working with the Zenoss API .. versionadded:: 2016.3.0 :depends: requests :configuration: This module requires a 'zenoss' entry in the master/minion config. For example: .. code-block:: yaml zenoss: hostname: https://zenoss.example.com use...
saltstack/salt
salt/modules/zenoss.py
add_device
python
def add_device(device=None, device_class=None, collector='localhost', prod_state=1000): ''' A function to connect to a zenoss server and add a new device entry. Parameters: device: (Optional) Will use the grain 'fqdn' by default. device_class: (Optional) The device class to use. I...
A function to connect to a zenoss server and add a new device entry. Parameters: device: (Optional) Will use the grain 'fqdn' by default. device_class: (Optional) The device class to use. If none, will determine based on kernel grain. collector: (Optional) The collector to us...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L161-L183
[ "def _router_request(router, method, data=None):\n '''\n Make a request to the Zenoss API router\n '''\n if router not in ROUTERS:\n return False\n\n req_data = salt.utils.json.dumps([dict(\n action=router,\n method=method,\n data=data,\n type='rpc',\n tid=1)...
# -*- coding: utf-8 -*- ''' Module for working with the Zenoss API .. versionadded:: 2016.3.0 :depends: requests :configuration: This module requires a 'zenoss' entry in the master/minion config. For example: .. code-block:: yaml zenoss: hostname: https://zenoss.example.com use...
saltstack/salt
salt/modules/zenoss.py
set_prod_state
python
def set_prod_state(prod_state, device=None): ''' A function to set the prod_state in zenoss. Parameters: prod_state: (Required) Integer value of the state device: (Optional) Will use the grain 'fqdn' by default. CLI Example: salt zenoss.set_prod_state 1000 hostname ...
A function to set the prod_state in zenoss. Parameters: prod_state: (Required) Integer value of the state device: (Optional) Will use the grain 'fqdn' by default. CLI Example: salt zenoss.set_prod_state 1000 hostname
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L186-L208
[ "def _router_request(router, method, data=None):\n '''\n Make a request to the Zenoss API router\n '''\n if router not in ROUTERS:\n return False\n\n req_data = salt.utils.json.dumps([dict(\n action=router,\n method=method,\n data=data,\n type='rpc',\n tid=1)...
# -*- coding: utf-8 -*- ''' Module for working with the Zenoss API .. versionadded:: 2016.3.0 :depends: requests :configuration: This module requires a 'zenoss' entry in the master/minion config. For example: .. code-block:: yaml zenoss: hostname: https://zenoss.example.com use...
saltstack/salt
salt/modules/restartcheck.py
_valid_deleted_file
python
def _valid_deleted_file(path): ''' Filters file path against unwanted directories and decides whether file is marked as deleted. Returns: True if file is desired deleted file, else False. Args: path: A string - path to file ''' ret = False if path.endswith(' (deleted)'): ...
Filters file path against unwanted directories and decides whether file is marked as deleted. Returns: True if file is desired deleted file, else False. Args: path: A string - path to file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L93-L112
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_deleted_files
python
def _deleted_files(): ''' Iterates over /proc/PID/maps and /proc/PID/fd links and returns list of desired deleted files. Returns: List of deleted files to analyze, False on failure. ''' deleted_files = [] for proc in psutil.process_iter(): # pylint: disable=too-many-nested-blocks ...
Iterates over /proc/PID/maps and /proc/PID/fd links and returns list of desired deleted files. Returns: List of deleted files to analyze, False on failure.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L115-L182
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_format_output
python
def _format_output(kernel_restart, packages, verbose, restartable, nonrestartable, restartservicecommands, restartinitcommands): ''' Formats the output of the restartcheck module. Returns: String - formatted output. Args: kernel_restart: indicates that newer kernel i...
Formats the output of the restartcheck module. Returns: String - formatted output. Args: kernel_restart: indicates that newer kernel is instaled packages: list of packages that should be restarted verbose: enables extensive output restartable: list of restartable packag...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L185-L240
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_kernel_versions_debian
python
def _kernel_versions_debian(): ''' Last installed kernel name, for Debian based systems. Returns: List with possible names of last installed kernel as they are probably interpreted in output of `uname -a` command. ''' kernel_get_selections = __salt__['cmd.run']('dpkg --get-s...
Last installed kernel name, for Debian based systems. Returns: List with possible names of last installed kernel as they are probably interpreted in output of `uname -a` command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L243-L278
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_kernel_versions_redhat
python
def _kernel_versions_redhat(): ''' Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command. ''' kernel_get_last = __salt__['cmd.run']('rpm -q --last kernel') kernels = [] ...
Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L281-L299
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_kernel_versions_nilrt
python
def _kernel_versions_nilrt(): ''' Last installed kernel name, for Debian based systems. Returns: List with possible names of last installed kernel as they are probably interpreted in output of `uname -a` command. ''' kver = None def _get_kver_from_bin(kbin): '''...
Last installed kernel name, for Debian based systems. Returns: List with possible names of last installed kernel as they are probably interpreted in output of `uname -a` command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L302-L345
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_check_timeout
python
def _check_timeout(start_time, timeout): ''' Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command. ''' timeout_milisec = timeout * 60000 if timeout_milisec < (int(round(tim...
Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L348-L357
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_file_changed_nilrt
python
def _file_changed_nilrt(full_filepath): ''' Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory. Returns: - False if md5sum/timestamp state files don't exist - True/False depending if ``base_filename`` got modified/touch...
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory. Returns: - False if md5sum/timestamp state files don't exist - True/False depending if ``base_filename`` got modified/touched
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L360-L384
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
_sysapi_changed_nilrt
python
def _sysapi_changed_nilrt(): ''' Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an extensible, plugin-based device enumeration and configuration interface named "System API". When an installed package is extending the API it is very hard to know all repercurssio...
Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an extensible, plugin-based device enumeration and configuration interface named "System API". When an installed package is extending the API it is very hard to know all repercurssions and actions to be taken, so reboot...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L402-L438
null
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/modules/restartcheck.py
restartcheck
python
def restartcheck(ignorelist=None, blacklist=None, excludepid=None, **kwargs): ''' Analyzes files openeded by running processes and seeks for packages which need to be restarted. Args: ignorelist: string or list of packages to be ignored blacklist: string or list of file paths to be ignored ...
Analyzes files openeded by running processes and seeks for packages which need to be restarted. Args: ignorelist: string or list of packages to be ignored blacklist: string or list of file paths to be ignored excludepid: string or list of process IDs to be ignored verbose: boolean, ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L442-L645
[ "def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det...
# -*- coding: utf-8 -*- ''' checkrestart functionality for Debian and Red Hat Based systems Identifies services (processes) that are linked against deleted files (for example after downloading an updated binary of a shared library). Based on checkrestart script from debian-goodies (written by Matt Zimmerman for the ...
saltstack/salt
salt/states/pbm.py
default_vsan_policy_configured
python
def default_vsan_policy_configured(name, policy): ''' Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy ''' # TODO Refactor when recurse_differ supports list_differ # It's goi...
Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L138-L275
[ "def recursive_diff(past_dict, current_dict, ignore_missing_keys=True):\n '''\n Returns a RecursiveDictDiffer object that computes the recursive diffs\n between two dictionaries\n\n past_dict\n Past dictionary\n\n current_dict\n Current dictionary\n\n ignore_missing_keys\n ...
# -*- coding: utf-8 -*- ''' Manages VMware storage policies (called pbm because the vCenter endpoint is /pbm) Examples ======== Storage policy -------------- .. code-block:: python { "name": "salt_storage_policy" "description": "Managed by Salt. Random capability values.", "resource_type": "STORAGE", ...
saltstack/salt
salt/states/pbm.py
default_storage_policy_assigned
python
def default_storage_policy_assigned(name, policy, datastore): ''' Assigns a default storage policy to a datastore policy Name of storage policy datastore Name of datastore ''' log.info('Running state %s for policy \'%s\', datastore \'%s\'.', name, policy, datastore...
Assigns a default storage policy to a datastore policy Name of storage policy datastore Name of datastore
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L441-L500
null
# -*- coding: utf-8 -*- ''' Manages VMware storage policies (called pbm because the vCenter endpoint is /pbm) Examples ======== Storage policy -------------- .. code-block:: python { "name": "salt_storage_policy" "description": "Managed by Salt. Random capability values.", "resource_type": "STORAGE", ...
saltstack/salt
salt/modules/cloud.py
_get_client
python
def _get_client(): ''' Return a cloud client ''' client = salt.cloud.CloudClient( os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'), pillars=copy.deepcopy(__pillar__.get('cloud', {})) ) return client
Return a cloud client
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L41-L49
null
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
has_instance
python
def has_instance(name, provider=None): ''' Return true if the instance is found on a provider CLI Example: .. code-block:: bash salt minionname cloud.has_instance myinstance ''' data = get_instance(name, provider) if data is None: return False return True
Return true if the instance is found on a provider CLI Example: .. code-block:: bash salt minionname cloud.has_instance myinstance
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L140-L153
[ "def get_instance(name, provider=None):\n '''\n Return details on an instance.\n\n Similar to the cloud action show_instance\n but returns only the instance details.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minionname cloud.get_instance myinstance\n\n SLS Example:\n\n .. cod...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
get_instance
python
def get_instance(name, provider=None): ''' Return details on an instance. Similar to the cloud action show_instance but returns only the instance details. CLI Example: .. code-block:: bash salt minionname cloud.get_instance myinstance SLS Example: .. code-block:: bash ...
Return details on an instance. Similar to the cloud action show_instance but returns only the instance details. CLI Example: .. code-block:: bash salt minionname cloud.get_instance myinstance SLS Example: .. code-block:: bash {{ salt['cloud.get_instance']('myinstance')['ma...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L156-L183
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def action(\n fun=None,\n cloudmap=None,\n names=None,\n provider=None,\n instance=None,\n **kwargs):\n '''\n Execute a single action on the given provider/instance\n\n CLI Example:\n\n .. code-bloc...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
profile_
python
def profile_(profile, names, vm_overrides=None, opts=None, **kwargs): ''' Spin up an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.profile my-gce-config myinstance ''' client = _get_client() if isinstance(opts, dict): client.opts.update(...
Spin up an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.profile my-gce-config myinstance
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L186-L200
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def profile(self, profile, names, vm_overrides=N...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
map_run
python
def map_run(path=None, **kwargs): ''' Execute a salt cloud map file Cloud Map data can be retrieved from several sources: - a local file (provide the path to the file to the 'path' argument) - a JSON-formatted map directly (provide the appropriately formatted to using the 'map_data' argument) ...
Execute a salt cloud map file Cloud Map data can be retrieved from several sources: - a local file (provide the path to the file to the 'path' argument) - a JSON-formatted map directly (provide the appropriately formatted to using the 'map_data' argument) - the Salt Pillar (provide the map name of und...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L203-L229
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def map_run(self, path=None, **kwargs):\n '''...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
action
python
def action( fun=None, cloudmap=None, names=None, provider=None, instance=None, **kwargs): ''' Execute a single action on the given provider/instance CLI Example: .. code-block:: bash salt minionname cloud.action start instance=myinstance ...
Execute a single action on the given provider/instance CLI Example: .. code-block:: bash salt minionname cloud.action start instance=myinstance salt minionname cloud.action stop instance=myinstance salt minionname cloud.action show_image provider=my-ec2-config image=ami-1624987f
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L247-L272
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def action(\n self,\n fun=None,\n cloud...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
create
python
def create(provider, names, opts=None, **kwargs): ''' Create an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.create my-ec2-config myinstance image=ami-1624987f size='t1.micro' ssh_username=ec2-user securitygroup=default delvol_on_destroy=True ''' c...
Create an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.create my-ec2-config myinstance image=ami-1624987f size='t1.micro' ssh_username=ec2-user securitygroup=default delvol_on_destroy=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L275-L289
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def create(self, provider, names, **kwargs):\n ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
volume_list
python
def volume_list(provider): ''' List block storage volumes CLI Example: .. code-block:: bash salt minionname cloud.volume_list my-nova ''' client = _get_client() info = client.extra_action(action='volume_list', provider=provider, names='name') return info['name']
List block storage volumes CLI Example: .. code-block:: bash salt minionname cloud.volume_list my-nova
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L292-L305
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
volume_attach
python
def volume_attach(provider, names, **kwargs): ''' Attach volume to a server CLI Example: .. code-block:: bash salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf' ''' client = _get_client() info = client.extra_action(provider=provider, names...
Attach volume to a server CLI Example: .. code-block:: bash salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L340-L353
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
network_list
python
def network_list(provider): ''' List private networks CLI Example: .. code-block:: bash salt minionname cloud.network_list my-nova ''' client = _get_client() return client.extra_action(action='network_list', provider=provider, names='names')
List private networks CLI Example: .. code-block:: bash salt minionname cloud.network_list my-nova
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L372-L384
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
network_create
python
def network_create(provider, names, **kwargs): ''' Create private network CLI Example: .. code-block:: bash salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24' ''' client = _get_client() return client.extra_action(provider=provider, names=names, ac...
Create private network CLI Example: .. code-block:: bash salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L387-L399
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
virtual_interface_list
python
def virtual_interface_list(provider, names, **kwargs): ''' List virtual interfaces on a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_list my-nova names=['salt-master'] ''' client = _get_client() return client.extra_action(provider=provider, nam...
List virtual interfaces on a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_list my-nova names=['salt-master']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L402-L414
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/cloud.py
virtual_interface_create
python
def virtual_interface_create(provider, names, **kwargs): ''' Attach private interfaces to a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt' ''' client = _get_client() return client.extra_action(...
Attach private interfaces to a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L417-L429
[ "def _get_client():\n '''\n Return a cloud client\n '''\n client = salt.cloud.CloudClient(\n os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),\n pillars=copy.deepcopy(__pillar__.get('cloud', {}))\n )\n return client\n", "def extra_action(self, names, provider, action, ...
# -*- coding: utf-8 -*- ''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import logging import copy import salt.utils.data # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True excep...
saltstack/salt
salt/modules/netbsd_sysctl.py
show
python
def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' roots = ( 'kern', 'vm', 'vfs', 'net', 'hw', 'machdep', 'user', 'ddb', ...
Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L30-L66
null
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' from __future__ import absolute_import, print_function, unicode_literals import os import re # Import salt libs from salt.ext import six import salt.utils.data import salt.utils.files import salt.utils.stringutils from salt.exceptions i...
saltstack/salt
salt/modules/netbsd_sysctl.py
get
python
def get(name): ''' Return a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.get hw.physmem ''' cmd = 'sysctl -n {0}'.format(name) out = __salt__['cmd.run'](cmd, python_shell=False) return out
Return a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.get hw.physmem
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L69-L81
null
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' from __future__ import absolute_import, print_function, unicode_literals import os import re # Import salt libs from salt.ext import six import salt.utils.data import salt.utils.files import salt.utils.stringutils from salt.exceptions i...
saltstack/salt
salt/modules/netbsd_sysctl.py
persist
python
def persist(name, value, config='/etc/sysctl.conf'): ''' Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 ''' nlines = [] edited = False value = six.text_type(value) # create /e...
Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L106-L162
[ "def encode(data, encoding=None, errors='strict', keep=False,\n preserve_dict_class=False, preserve_tuples=False):\n '''\n Generic function which will encode whichever type is passed, if necessary\n\n If `strict` is True, and `keep` is False, and we fail to encode, a\n UnicodeEncodeError will ...
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' from __future__ import absolute_import, print_function, unicode_literals import os import re # Import salt libs from salt.ext import six import salt.utils.data import salt.utils.files import salt.utils.stringutils from salt.exceptions i...
saltstack/salt
salt/states/pushover.py
post_message
python
def post_message(name, user=None, device=None, message=None, title=None, priority=None, expire=None, retry=None, sound=None, api_version=1, token=None...
Send a message to a PushOver channel. .. code-block:: yaml pushover-message: pushover.post_message: - user: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - title: Salt Returner - device: phone - priority: -1 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pushover.py#L42-L137
null
# -*- coding: utf-8 -*- ''' Send a message to PushOver ========================== This state is useful for sending messages to PushOver during state runs. .. versionadded:: 2015.5.0 .. code-block:: yaml pushover-message: pushover.post_message: - user: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - token...
saltstack/salt
salt/modules/dig.py
check_ip
python
def check_ip(addr): ''' Check if address is a valid IP. returns True if valid, otherwise False. CLI Example: .. code-block:: bash salt ns1 dig.check_ip 127.0.0.1 salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888 ''' try: addr = addr.rsplit('/', 1) exce...
Check if address is a valid IP. returns True if valid, otherwise False. CLI Example: .. code-block:: bash salt ns1 dig.check_ip 127.0.0.1 salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L32-L72
[ "def is_ipv4(ip):\n '''\n Returns a bool telling if the value passed to it was a valid IPv4 address\n '''\n try:\n return ipaddress.ip_address(ip).version == 4\n except ValueError:\n return False\n", "def is_ipv6(ip):\n '''\n Returns a bool telling if the value passed to it was ...
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/dig.py
AAAA
python
def AAAA(host, nameserver=None): ''' Return the AAAA record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.AAAA www.google.com ''' dig = ['dig', '+short', six.text_type(host), 'AAAA'] if nameserver is not None: dig.append('@{0}'.f...
Return the AAAA record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.AAAA www.google.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L105-L132
null
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/dig.py
NS
python
def NS(domain, resolve=True, nameserver=None): ''' Return a list of IPs of the nameservers for ``domain`` If ``resolve`` is False, don't resolve names. CLI Example: .. code-block:: bash salt ns1 dig.NS google.com ''' dig = ['dig', '+short', six.text_type(domain), 'NS'] if na...
Return a list of IPs of the nameservers for ``domain`` If ``resolve`` is False, don't resolve names. CLI Example: .. code-block:: bash salt ns1 dig.NS google.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L135-L168
[ "def A(host, nameserver=None):\n '''\n Return the A record for ``host``.\n\n Always returns a list.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt ns1 dig.A www.google.com\n '''\n dig = ['dig', '+short', six.text_type(host), 'A']\n\n if nameserver is not None:\n dig.append(...
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/dig.py
SPF
python
def SPF(domain, record='SPF', nameserver=None): ''' Return the allowed IPv4 ranges in the SPF record for ``domain``. If record is ``SPF`` and the SPF record is empty, the TXT record will be searched automatically. If you know the domain uses TXT and not SPF, specifying that will save a lookup. ...
Return the allowed IPv4 ranges in the SPF record for ``domain``. If record is ``SPF`` and the SPF record is empty, the TXT record will be searched automatically. If you know the domain uses TXT and not SPF, specifying that will save a lookup. CLI Example: .. code-block:: bash salt ns1 di...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L171-L223
[ "def check_ip(addr):\n '''\n Check if address is a valid IP. returns True if valid, otherwise False.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt ns1 dig.check_ip 127.0.0.1\n salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888\n '''\n\n try:\n addr = addr.rspli...
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/dig.py
MX
python
def MX(domain, resolve=False, nameserver=None): ''' Return a list of lists for the MX of ``domain``. If the ``resolve`` argument is True, resolve IPs for the servers. It's limited to one IP, because although in practice it's very rarely a round robin, it is an acceptable configuration and pulling ...
Return a list of lists for the MX of ``domain``. If the ``resolve`` argument is True, resolve IPs for the servers. It's limited to one IP, because although in practice it's very rarely a round robin, it is an acceptable configuration and pulling just one IP lets the data be similar to the non-resolved...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L226-L264
null
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/dig.py
TXT
python
def TXT(host, nameserver=None): ''' Return the TXT record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.TXT google.com ''' dig = ['dig', '+short', six.text_type(host), 'TXT'] if nameserver is not None: dig.append('@{0}'.format(na...
Return the TXT record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.TXT google.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L267-L293
null
# -*- coding: utf-8 -*- ''' Compendium of generic DNS utilities. The 'dig' command line tool must be installed in order to use this module. ''' from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.utils.network import salt.utils.path from salt.ext import six # Import...
saltstack/salt
salt/modules/freebsd_sysctl.py
show
python
def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' roots = ( 'compat', 'debug', 'dev', 'hptmv', 'hw', 'kern', 'machdep', 'net', ...
Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L40-L95
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import logging import os # Import salt libs import salt.utils.files from salt.exceptions import CommandExecutionError from salt.ext import si...
saltstack/salt
salt/modules/freebsd_sysctl.py
assign
python
def assign(name, value): ''' Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.inet.icmp.icmplim 50 ''' ret = {} cmd = 'sysctl {0}="{1}"'.format(name, value) data = __salt__['cmd.run_all'](cmd, python_shell=False) ...
Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.inet.icmp.icmplim 50
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L113-L132
null
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import logging import os # Import salt libs import salt.utils.files from salt.exceptions import CommandExecutionError from salt.ext import si...
saltstack/salt
salt/modules/freebsd_sysctl.py
persist
python
def persist(name, value, config='/etc/sysctl.conf'): ''' Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 salt '*' sysctl.persist coretemp_load NO config=/boot/loader.conf ''' nlines...
Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 salt '*' sysctl.persist coretemp_load NO config=/boot/loader.conf
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L135-L177
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Module for viewing and modifying sysctl parameters ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import logging import os # Import salt libs import salt.utils.files from salt.exceptions import CommandExecutionError from salt.ext import si...
saltstack/salt
salt/states/augeas.py
_workout_filename
python
def _workout_filename(filename): ''' Recursively workout the file name from an augeas change ''' if os.path.isfile(filename) or filename == '/': if filename == '/': filename = None return filename else: return _workout_filename(os.path.dirname(filename))
Recursively workout the file name from an augeas change
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L53-L62
null
# -*- coding: utf-8 -*- ''' Configuration management using Augeas .. versionadded:: 0.17.0 This state requires the ``augeas`` Python module. .. _Augeas: http://augeas.net/ Augeas_ can be used to manage configuration files. .. warning:: Minimal installations of Debian and Ubuntu have been seen to have packagin...
saltstack/salt
salt/states/augeas.py
_check_filepath
python
def _check_filepath(changes): ''' Ensure all changes are fully qualified and affect only one file. This ensures that the diff output works and a state change is not incorrectly reported. ''' filename = None for change_ in changes: try: cmd, arg = change_.split(' ', 1) ...
Ensure all changes are fully qualified and affect only one file. This ensures that the diff output works and a state change is not incorrectly reported.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L65-L110
null
# -*- coding: utf-8 -*- ''' Configuration management using Augeas .. versionadded:: 0.17.0 This state requires the ``augeas`` Python module. .. _Augeas: http://augeas.net/ Augeas_ can be used to manage configuration files. .. warning:: Minimal installations of Debian and Ubuntu have been seen to have packagin...
saltstack/salt
salt/states/augeas.py
change
python
def change(name, context=None, changes=None, lens=None, load_path=None, **kwargs): ''' .. versionadded:: 2014.7.0 This state replaces :py:func:`~salt.states.augeas.setvalue`. Issue changes to Augeas, optionally for a specific context, with a specific lens. name State name ...
.. versionadded:: 2014.7.0 This state replaces :py:func:`~salt.states.augeas.setvalue`. Issue changes to Augeas, optionally for a specific context, with a specific lens. name State name context A file path, prefixed by ``/files``. Should resolve to an actual file (not an ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L113-L323
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Configuration management using Augeas .. versionadded:: 0.17.0 This state requires the ``augeas`` Python module. .. _Augeas: http://augeas.net/ Augeas_ can be used to manage configuration files. .. warning:: Minimal installations of Debian and Ubuntu have been seen to have packagin...
saltstack/salt
salt/modules/redismod.py
_connect
python
def _connect(host=None, port=None, db=None, password=None): ''' Returns an instance of the redis client ''' if not host: host = __salt__['config.option']('redis.host') if not port: port = __salt__['config.option']('redis.port') if not db: db = __salt__['config.option']('r...
Returns an instance of the redis client
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L45-L58
null
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
_sconnect
python
def _sconnect(host=None, port=None, password=None): ''' Returns an instance of the redis client ''' if host is None: host = __salt__['config.option']('redis_sentinel.host', 'localhost') if port is None: port = __salt__['config.option']('redis_sentinel.port', 26379) if password is...
Returns an instance of the redis client
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L61-L72
null
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
bgrewriteaof
python
def bgrewriteaof(host=None, port=None, db=None, password=None): ''' Asynchronously rewrite the append-only file CLI Example: .. code-block:: bash salt '*' redis.bgrewriteaof ''' server = _connect(host, port, db, password) return server.bgrewriteaof()
Asynchronously rewrite the append-only file CLI Example: .. code-block:: bash salt '*' redis.bgrewriteaof
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L75-L86
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
bgsave
python
def bgsave(host=None, port=None, db=None, password=None): ''' Asynchronously save the dataset to disk CLI Example: .. code-block:: bash salt '*' redis.bgsave ''' server = _connect(host, port, db, password) return server.bgsave()
Asynchronously save the dataset to disk CLI Example: .. code-block:: bash salt '*' redis.bgsave
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L89-L100
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
config_get
python
def config_get(pattern='*', host=None, port=None, db=None, password=None): ''' Get redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_get salt '*' redis.config_get port ''' server = _connect(host, port, db, password) return server.con...
Get redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_get salt '*' redis.config_get port
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L103-L115
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
config_set
python
def config_set(name, value, host=None, port=None, db=None, password=None): ''' Set redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_set masterauth luv_kittens ''' server = _connect(host, port, db, password) return server.config_set(name, va...
Set redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_set masterauth luv_kittens
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L118-L129
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
dbsize
python
def dbsize(host=None, port=None, db=None, password=None): ''' Return the number of keys in the selected database CLI Example: .. code-block:: bash salt '*' redis.dbsize ''' server = _connect(host, port, db, password) return server.dbsize()
Return the number of keys in the selected database CLI Example: .. code-block:: bash salt '*' redis.dbsize
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L132-L143
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
delete
python
def delete(*keys, **connection_args): ''' Deletes the keys from redis, returns number of keys deleted CLI Example: .. code-block:: bash salt '*' redis.delete foo ''' # Get connection args from keywords if set conn_args = {} for arg in ['host', 'port', 'db', 'password']: ...
Deletes the keys from redis, returns number of keys deleted CLI Example: .. code-block:: bash salt '*' redis.delete foo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L146-L163
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
exists
python
def exists(key, host=None, port=None, db=None, password=None): ''' Return true if the key exists in redis CLI Example: .. code-block:: bash salt '*' redis.exists foo ''' server = _connect(host, port, db, password) return server.exists(key)
Return true if the key exists in redis CLI Example: .. code-block:: bash salt '*' redis.exists foo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L166-L177
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
expire
python
def expire(key, seconds, host=None, port=None, db=None, password=None): ''' Set a keys time to live in seconds CLI Example: .. code-block:: bash salt '*' redis.expire foo 300 ''' server = _connect(host, port, db, password) return server.expire(key, seconds)
Set a keys time to live in seconds CLI Example: .. code-block:: bash salt '*' redis.expire foo 300
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L180-L191
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
expireat
python
def expireat(key, timestamp, host=None, port=None, db=None, password=None): ''' Set a keys expire at given UNIX time CLI Example: .. code-block:: bash salt '*' redis.expireat foo 1400000000 ''' server = _connect(host, port, db, password) return server.expireat(key, timestamp)
Set a keys expire at given UNIX time CLI Example: .. code-block:: bash salt '*' redis.expireat foo 1400000000
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L194-L205
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
flushall
python
def flushall(host=None, port=None, db=None, password=None): ''' Remove all keys from all databases CLI Example: .. code-block:: bash salt '*' redis.flushall ''' server = _connect(host, port, db, password) return server.flushall()
Remove all keys from all databases CLI Example: .. code-block:: bash salt '*' redis.flushall
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L208-L219
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
flushdb
python
def flushdb(host=None, port=None, db=None, password=None): ''' Remove all keys from the selected database CLI Example: .. code-block:: bash salt '*' redis.flushdb ''' server = _connect(host, port, db, password) return server.flushdb()
Remove all keys from the selected database CLI Example: .. code-block:: bash salt '*' redis.flushdb
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L222-L233
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
get_key
python
def get_key(key, host=None, port=None, db=None, password=None): ''' Get redis key value CLI Example: .. code-block:: bash salt '*' redis.get_key foo ''' server = _connect(host, port, db, password) return server.get(key)
Get redis key value CLI Example: .. code-block:: bash salt '*' redis.get_key foo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L236-L247
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hexists
python
def hexists(key, field, host=None, port=None, db=None, password=None): ''' Determine if a hash fields exists. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hexists foo_hash bar_field ''' server = _connect(host, port, db, password) return server.h...
Determine if a hash fields exists. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hexists foo_hash bar_field
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L270-L283
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hgetall
python
def hgetall(key, host=None, port=None, db=None, password=None): ''' Get all fields and values from a redis hash, returns dict CLI Example: .. code-block:: bash salt '*' redis.hgetall foo_hash ''' server = _connect(host, port, db, password) return server.hgetall(key)
Get all fields and values from a redis hash, returns dict CLI Example: .. code-block:: bash salt '*' redis.hgetall foo_hash
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L300-L311
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hincrby
python
def hincrby(key, field, increment=1, host=None, port=None, db=None, password=None): ''' Increment the integer value of a hash field by the given number. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hincrby foo_hash bar_field 5 ''' server = _connect(...
Increment the integer value of a hash field by the given number. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hincrby foo_hash bar_field 5
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L314-L327
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hlen
python
def hlen(key, host=None, port=None, db=None, password=None): ''' Returns number of fields of a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hlen foo_hash ''' server = _connect(host, port, db, password) return server.hlen(key)
Returns number of fields of a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hlen foo_hash
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L346-L359
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hmget
python
def hmget(key, *fields, **options): ''' Returns the values of all the given hash fields. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmget foo_hash bar_field1 bar_field2 ''' host = options.get('host', None) port = options.get('port', None) ...
Returns the values of all the given hash fields. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmget foo_hash bar_field1 bar_field2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L362-L379
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hmset
python
def hmset(key, **fieldsvals): ''' Sets multiple hash fields to multiple values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2 ''' host = fieldsvals.pop('host', None) port = fieldsvals.pop...
Sets multiple hash fields to multiple values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L382-L399
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hset
python
def hset(key, field, value, host=None, port=None, db=None, password=None): ''' Set the value of a hash field. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hset foo_hash bar_field bar_value ''' server = _connect(host, port, db, password) return s...
Set the value of a hash field. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hset foo_hash bar_field bar_value
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L402-L415
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hvals
python
def hvals(key, host=None, port=None, db=None, password=None): ''' Return all the values in a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hvals foo_hash bar_field1 bar_value1 ''' server = _connect(host, port, db, password) return server.hv...
Return all the values in a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hvals foo_hash bar_field1 bar_value1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L434-L447
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
hscan
python
def hscan(key, cursor=0, match=None, count=None, host=None, port=None, db=None, password=None): ''' Incrementally iterate hash fields and associated values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hscan foo_hash match='field_prefix_*' count=1 ''' ...
Incrementally iterate hash fields and associated values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hscan foo_hash match='field_prefix_*' count=1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L450-L463
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
info
python
def info(host=None, port=None, db=None, password=None): ''' Get information and statistics about the server CLI Example: .. code-block:: bash salt '*' redis.info ''' server = _connect(host, port, db, password) return server.info()
Get information and statistics about the server CLI Example: .. code-block:: bash salt '*' redis.info
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L466-L477
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
keys
python
def keys(pattern='*', host=None, port=None, db=None, password=None): ''' Get redis keys, supports glob style patterns CLI Example: .. code-block:: bash salt '*' redis.keys salt '*' redis.keys test* ''' server = _connect(host, port, db, password) return server.keys(pattern)
Get redis keys, supports glob style patterns CLI Example: .. code-block:: bash salt '*' redis.keys salt '*' redis.keys test*
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L480-L492
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
key_type
python
def key_type(key, host=None, port=None, db=None, password=None): ''' Get redis key type CLI Example: .. code-block:: bash salt '*' redis.type foo ''' server = _connect(host, port, db, password) return server.type(key)
Get redis key type CLI Example: .. code-block:: bash salt '*' redis.type foo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L495-L506
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
lastsave
python
def lastsave(host=None, port=None, db=None, password=None): ''' Get the UNIX time in seconds of the last successful save to disk CLI Example: .. code-block:: bash salt '*' redis.lastsave ''' # Use of %s to get the timestamp is not supported by Python. The reason it # works is beca...
Get the UNIX time in seconds of the last successful save to disk CLI Example: .. code-block:: bash salt '*' redis.lastsave
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L509-L526
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/modules/redismod.py
llen
python
def llen(key, host=None, port=None, db=None, password=None): ''' Get the length of a list in Redis CLI Example: .. code-block:: bash salt '*' redis.llen foo_list ''' server = _connect(host, port, db, password) return server.llen(key)
Get the length of a list in Redis CLI Example: .. code-block:: bash salt '*' redis.llen foo_list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L529-L540
[ "def _connect(host=None, port=None, db=None, password=None):\n '''\n Returns an instance of the redis client\n '''\n if not host:\n host = __salt__['config.option']('redis.host')\n if not port:\n port = __salt__['config.option']('redis.port')\n if not db:\n db = __salt__['conf...
# -*- coding: utf-8 -*- ''' Module to provide redis functionality to Salt .. versionadded:: 2014.7.0 :configuration: This module requires the redis python module and uses the following defaults which may be overridden in the minion configuration: .. code-block:: yaml redis.host: 'salt' redis.port: 6379 ...