repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/saltutil.py | refresh_pillar | 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... | 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... | [
"def",
"refresh_pillar",
"(",
"*",
"*",
"kwargs",
")",
":",
"asynchronous",
"=",
"bool",
"(",
"kwargs",
".",
"get",
"(",
"'async'",
",",
"True",
")",
")",
"try",
":",
"if",
"asynchronous",
":",
"# If we're going to block, first setup a listener",
"ret",
"=",
... | 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 | [
"Signal",
"the",
"minion",
"to",
"refresh",
"the",
"pillar",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1073-L1104 | train |
saltstack/salt | salt/modules/saltutil.py | is_running | 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... | 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... | [
"def",
"is_running",
"(",
"fun",
")",
":",
"run",
"=",
"running",
"(",
")",
"ret",
"=",
"[",
"]",
"for",
"data",
"in",
"run",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"data",
".",
"get",
"(",
"'fun'",
",",
"''",
")",
",",
"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 | [
"If",
"the",
"named",
"function",
"is",
"running",
"return",
"the",
"data",
"associated",
"with",
"it",
"/",
"them",
".",
"The",
"argument",
"can",
"be",
"a",
"glob"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1143-L1159 | train |
saltstack/salt | salt/modules/saltutil.py | clear_cache | 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... | 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... | [
"def",
"clear_cache",
"(",
"days",
"=",
"-",
"1",
")",
":",
"threshold",
"=",
"time",
".",
"time",
"(",
")",
"-",
"days",
"*",
"24",
"*",
"60",
"*",
"60",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"files",
".",
... | 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 | [
"Forcibly",
"removes",
"all",
"caches",
"on",
"a",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1175-L1204 | train |
saltstack/salt | salt/modules/saltutil.py | clear_job_cache | 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... | 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... | [
"def",
"clear_job_cache",
"(",
"hours",
"=",
"24",
")",
":",
"threshold",
"=",
"time",
".",
"time",
"(",
")",
"-",
"hours",
"*",
"60",
"*",
"60",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"files",
".",
"safe_walk",
... | 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... | [
"Forcibly",
"removes",
"job",
"cache",
"folders",
"and",
"files",
"on",
"a",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1207-L1234 | train |
saltstack/salt | salt/modules/saltutil.py | find_cached_job | 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__)
... | 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__)
... | [
"def",
"find_cached_job",
"(",
"jid",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"__opts__",
")",
"proc_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'minion_jobs'",
")",
"job_dir",
... | 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> | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1289-L1322 | train |
saltstack/salt | salt/modules/saltutil.py | signal_job | 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... | 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... | [
"def",
"signal_job",
"(",
"jid",
",",
"sig",
")",
":",
"if",
"HAS_PSUTIL",
"is",
"False",
":",
"log",
".",
"warning",
"(",
"'saltutil.signal job called, but psutil is not installed. '",
"'Install psutil to ensure more reliable and accurate PID '",
"'management.'",
")",
"for... | Sends a signal to the named salt job's process
CLI Example:
.. code-block:: bash
salt '*' saltutil.signal_job <job id> 15 | [
"Sends",
"a",
"signal",
"to",
"the",
"named",
"salt",
"job",
"s",
"process"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1325-L1360 | train |
saltstack/salt | salt/modules/saltutil.py | term_all_jobs | 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 | 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 | [
"def",
"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 | [
"Sends",
"a",
"termination",
"signal",
"(",
"SIGTERM",
"15",
")",
"to",
"all",
"currently",
"running",
"jobs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1376-L1389 | train |
saltstack/salt | salt/modules/saltutil.py | kill_all_jobs | 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 ... | 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 ... | [
"def",
"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 this is running on.",
"ret",
"=",
"[",
"]",
"for",
"data",
"in",
"running",
"(",
")",
":",
"ret",
".",
"appen... | Sends a kill signal (SIGKILL 9) to all currently running jobs
CLI Example:
.. code-block:: bash
salt '*' saltutil.kill_all_jobs | [
"Sends",
"a",
"kill",
"signal",
"(",
"SIGKILL",
"9",
")",
"to",
"all",
"currently",
"running",
"jobs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1407-L1422 | train |
saltstack/salt | salt/modules/saltutil.py | regen_keys | 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... | 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... | [
"def",
"regen_keys",
"(",
")",
":",
"for",
"fn_",
"in",
"os",
".",
"listdir",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
",",
"fn_",
")",
"try",
":",
"os"... | Used to regenerate the minion keys.
CLI Example:
.. code-block:: bash
salt '*' saltutil.regen_keys | [
"Used",
"to",
"regenerate",
"the",
"minion",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1425-L1444 | train |
saltstack/salt | salt/modules/saltutil.py | revoke_auth | 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, ... | 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, ... | [
"def",
"revoke_auth",
"(",
"preserve_minion_cache",
"=",
"False",
")",
":",
"masters",
"=",
"list",
"(",
")",
"ret",
"=",
"True",
"if",
"'master_uri_list'",
"in",
"__opts__",
":",
"for",
"master_uri",
"in",
"__opts__",
"[",
"'master_uri_list'",
"]",
":",
"ma... | 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.
... | [
"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",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1447-L1483 | train |
saltstack/salt | salt/modules/saltutil.py | cmd | 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``... | 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``... | [
"def",
"cmd",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"ssh",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"cfgf... | .. 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 | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1537-L1584 | train |
saltstack/salt | salt/modules/saltutil.py | cmd_iter | 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... | 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... | [
"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``, 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 | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1587-L1622 | train |
saltstack/salt | salt/modules/saltutil.py | runner | 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
... | 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
... | [
"def",
"runner",
"(",
"name",
",",
"arg",
"=",
"None",
",",
"kwarg",
"=",
"None",
",",
"full_return",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
",",
"jid",
"=",
"None",
",",
"asynchronous",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
... | 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
... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1625-L1697 | train |
saltstack/salt | salt/modules/saltutil.py | wheel | 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... | 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... | [
"def",
"wheel",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"jid",
"=",
"kwargs",
".",
"pop",
"(",
"'__orchestration_jid__'",
",",
"None",
")",
"saltenv",
"=",
"kwargs",
".",
"pop",
"(",
"'__env__'",
",",
"'base'",
")",
"if",
... | 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... | [
"Execute",
"a",
"wheel",
"module",
"and",
"function",
".",
"This",
"function",
"must",
"be",
"run",
"against",
"a",
"minion",
"that",
"is",
"local",
"to",
"the",
"master",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1700-L1794 | train |
saltstack/salt | salt/modules/saltutil.py | mmodule | 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... | 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... | [
"def",
"mmodule",
"(",
"saltenv",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mminion",
"=",
"_MMinion",
"(",
"saltenv",
")",
"return",
"mminion",
".",
"functions",
"[",
"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 | [
"Loads",
"minion",
"modules",
"from",
"an",
"environment",
"so",
"that",
"they",
"can",
"be",
"used",
"in",
"pillars",
"for",
"that",
"environment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1830-L1842 | train |
saltstack/salt | salt/modules/zenoss.py | _session | 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... | 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... | [
"def",
"_session",
"(",
")",
":",
"config",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'zenoss'",
")",
"session",
"=",
"requests",
".",
"session",
"(",
")",
"session",
".",
"auth",
"=",
"(",
"config",
".",
"get",
"(",
"'username'",
")",
",",
... | Create a session to be used when connecting to Zenoss. | [
"Create",
"a",
"session",
"to",
"be",
"used",
"when",
"connecting",
"to",
"Zenoss",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L68-L78 | train |
saltstack/salt | salt/modules/zenoss.py | _router_request | 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 = ... | 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 = ... | [
"def",
"_router_request",
"(",
"router",
",",
"method",
",",
"data",
"=",
"None",
")",
":",
"if",
"router",
"not",
"in",
"ROUTERS",
":",
"return",
"False",
"req_data",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"dumps",
"(",
"[",
"dict",
"(",
"acti... | Make a request to the Zenoss API router | [
"Make",
"a",
"request",
"to",
"the",
"Zenoss",
"API",
"router"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L81-L107 | train |
saltstack/salt | salt/modules/zenoss.py | find_device | 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... | 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... | [
"def",
"find_device",
"(",
"device",
"=",
"None",
")",
":",
"data",
"=",
"[",
"{",
"'uid'",
":",
"'/zport/dmd/Devices'",
",",
"'params'",
":",
"{",
"}",
",",
"'limit'",
":",
"None",
"}",
"]",
"all_devices",
"=",
"_router_request",
"(",
"'DeviceRouter'",
... | 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 | [
"Find",
"a",
"device",
"in",
"Zenoss",
".",
"If",
"device",
"not",
"found",
"returns",
"None",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L118-L139 | train |
saltstack/salt | salt/modules/zenoss.py | add_device | 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... | 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... | [
"def",
"add_device",
"(",
"device",
"=",
"None",
",",
"device_class",
"=",
"None",
",",
"collector",
"=",
"'localhost'",
",",
"prod_state",
"=",
"1000",
")",
":",
"if",
"not",
"device",
":",
"device",
"=",
"__salt__",
"[",
"'grains.get'",
"]",
"(",
"'fqd... | 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... | [
"A",
"function",
"to",
"connect",
"to",
"a",
"zenoss",
"server",
"and",
"add",
"a",
"new",
"device",
"entry",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L161-L183 | train |
saltstack/salt | salt/modules/zenoss.py | set_prod_state | 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
... | 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
... | [
"def",
"set_prod_state",
"(",
"prod_state",
",",
"device",
"=",
"None",
")",
":",
"if",
"not",
"device",
":",
"device",
"=",
"__salt__",
"[",
"'grains.get'",
"]",
"(",
"'fqdn'",
")",
"device_object",
"=",
"find_device",
"(",
"device",
")",
"if",
"not",
"... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zenoss.py#L186-L208 | train |
saltstack/salt | salt/modules/restartcheck.py | _valid_deleted_file | 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)'):
... | 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)'):
... | [
"def",
"_valid_deleted_file",
"(",
"path",
")",
":",
"ret",
"=",
"False",
"if",
"path",
".",
"endswith",
"(",
"' (deleted)'",
")",
":",
"ret",
"=",
"True",
"if",
"re",
".",
"compile",
"(",
"r\"\\(path inode=[0-9]+\\)$\"",
")",
".",
"search",
"(",
"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 | [
"Filters",
"file",
"path",
"against",
"unwanted",
"directories",
"and",
"decides",
"whether",
"file",
"is",
"marked",
"as",
"deleted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L93-L112 | train |
saltstack/salt | salt/modules/restartcheck.py | _deleted_files | 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
... | 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
... | [
"def",
"_deleted_files",
"(",
")",
":",
"deleted_files",
"=",
"[",
"]",
"for",
"proc",
"in",
"psutil",
".",
"process_iter",
"(",
")",
":",
"# pylint: disable=too-many-nested-blocks",
"try",
":",
"pinfo",
"=",
"proc",
".",
"as_dict",
"(",
"attrs",
"=",
"[",
... | 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. | [
"Iterates",
"over",
"/",
"proc",
"/",
"PID",
"/",
"maps",
"and",
"/",
"proc",
"/",
"PID",
"/",
"fd",
"links",
"and",
"returns",
"list",
"of",
"desired",
"deleted",
"files",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L115-L182 | train |
saltstack/salt | salt/modules/restartcheck.py | _format_output | 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... | 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... | [
"def",
"_format_output",
"(",
"kernel_restart",
",",
"packages",
",",
"verbose",
",",
"restartable",
",",
"nonrestartable",
",",
"restartservicecommands",
",",
"restartinitcommands",
")",
":",
"if",
"not",
"verbose",
":",
"packages",
"=",
"restartable",
"+",
"nonr... | 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... | [
"Formats",
"the",
"output",
"of",
"the",
"restartcheck",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L185-L240 | train |
saltstack/salt | salt/modules/restartcheck.py | _kernel_versions_debian | 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... | 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... | [
"def",
"_kernel_versions_debian",
"(",
")",
":",
"kernel_get_selections",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'dpkg --get-selections linux-image-*'",
")",
"kernels",
"=",
"[",
"]",
"kernel_versions",
"=",
"[",
"]",
"for",
"line",
"in",
"kernel_get_selectio... | 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. | [
"Last",
"installed",
"kernel",
"name",
"for",
"Debian",
"based",
"systems",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L243-L278 | train |
saltstack/salt | salt/modules/restartcheck.py | _kernel_versions_redhat | 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 = []
... | 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 = []
... | [
"def",
"_kernel_versions_redhat",
"(",
")",
":",
"kernel_get_last",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'rpm -q --last kernel'",
")",
"kernels",
"=",
"[",
"]",
"kernel_versions",
"=",
"[",
"]",
"for",
"line",
"in",
"kernel_get_last",
".",
"splitlines",... | 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. | [
"Name",
"of",
"the",
"last",
"installed",
"kernel",
"for",
"Red",
"Hat",
"based",
"systems",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L281-L299 | train |
saltstack/salt | salt/modules/restartcheck.py | _kernel_versions_nilrt | 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):
'''... | 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):
'''... | [
"def",
"_kernel_versions_nilrt",
"(",
")",
":",
"kver",
"=",
"None",
"def",
"_get_kver_from_bin",
"(",
"kbin",
")",
":",
"'''\n Get kernel version from a binary image or None if detection fails\n '''",
"kvregex",
"=",
"r'[0-9]+\\.[0-9]+\\.[0-9]+-rt\\S+'",
"kernel_st... | 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. | [
"Last",
"installed",
"kernel",
"name",
"for",
"Debian",
"based",
"systems",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L302-L345 | train |
saltstack/salt | salt/modules/restartcheck.py | _check_timeout | 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... | 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... | [
"def",
"_check_timeout",
"(",
"start_time",
",",
"timeout",
")",
":",
"timeout_milisec",
"=",
"timeout",
"*",
"60000",
"if",
"timeout_milisec",
"<",
"(",
"int",
"(",
"round",
"(",
"time",
".",
"time",
"(",
")",
"*",
"1000",
")",
")",
"-",
"start_time",
... | 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. | [
"Name",
"of",
"the",
"last",
"installed",
"kernel",
"for",
"Red",
"Hat",
"based",
"systems",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L348-L357 | train |
saltstack/salt | salt/modules/restartcheck.py | _file_changed_nilrt | 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... | 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... | [
"def",
"_file_changed_nilrt",
"(",
"full_filepath",
")",
":",
"rs_state_dir",
"=",
"\"/var/lib/salt/restartcheck_state\"",
"base_filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"full_filepath",
")",
"timestamp_file",
"=",
"os",
".",
"path",
".",
"join",
"... | 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 | [
"Detect",
"whether",
"a",
"file",
"changed",
"in",
"an",
"NILinuxRT",
"system",
"using",
"md5sum",
"and",
"timestamp",
"files",
"from",
"a",
"state",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L360-L384 | train |
saltstack/salt | salt/modules/restartcheck.py | _sysapi_changed_nilrt | 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... | 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... | [
"def",
"_sysapi_changed_nilrt",
"(",
")",
":",
"nisysapi_path",
"=",
"'/usr/local/natinst/share/nisysapi.ini'",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"nisysapi_path",
")",
"and",
"_file_changed_nilrt",
"(",
"nisysapi_path",
")",
":",
"return",
"True",
"restar... | 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... | [
"Besides",
"the",
"normal",
"Linux",
"kernel",
"driver",
"interfaces",
"NILinuxRT",
"-",
"supported",
"hardware",
"features",
"an",
"extensible",
"plugin",
"-",
"based",
"device",
"enumeration",
"and",
"configuration",
"interface",
"named",
"System",
"API",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L402-L438 | train |
saltstack/salt | salt/modules/restartcheck.py | restartcheck | 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
... | 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
... | [
"def",
"restartcheck",
"(",
"ignorelist",
"=",
"None",
",",
"blacklist",
"=",
"None",
",",
"excludepid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"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
excludepid: string or list of process IDs to be ignored
verbose: boolean, ... | [
"Analyzes",
"files",
"openeded",
"by",
"running",
"processes",
"and",
"seeks",
"for",
"packages",
"which",
"need",
"to",
"be",
"restarted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L442-L645 | train |
saltstack/salt | salt/states/pbm.py | default_vsan_policy_configured | 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... | 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... | [
"def",
"default_vsan_policy_configured",
"(",
"name",
",",
"policy",
")",
":",
"# TODO Refactor when recurse_differ supports list_differ",
"# It's going to make the whole thing much easier",
"policy_copy",
"=",
"copy",
".",
"deepcopy",
"(",
"policy",
")",
"proxy_type",
"=",
"... | 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 | [
"Configures",
"the",
"default",
"VSAN",
"policy",
"on",
"a",
"vCenter",
".",
"The",
"state",
"assumes",
"there",
"is",
"only",
"one",
"default",
"VSAN",
"policy",
"on",
"a",
"vCenter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L138-L275 | train |
saltstack/salt | salt/states/pbm.py | default_storage_policy_assigned | 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... | 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... | [
"def",
"default_storage_policy_assigned",
"(",
"name",
",",
"policy",
",",
"datastore",
")",
":",
"log",
".",
"info",
"(",
"'Running state %s for policy \\'%s\\', datastore \\'%s\\'.'",
",",
"name",
",",
"policy",
",",
"datastore",
")",
"changes",
"=",
"{",
"}",
"... | Assigns a default storage policy to a datastore
policy
Name of storage policy
datastore
Name of datastore | [
"Assigns",
"a",
"default",
"storage",
"policy",
"to",
"a",
"datastore"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L441-L500 | train |
saltstack/salt | salt/modules/cloud.py | _get_client | 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 | 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 | [
"def",
"_get_client",
"(",
")",
":",
"client",
"=",
"salt",
".",
"cloud",
".",
"CloudClient",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
",",
"'cloud'",
")",
",",
"pil... | Return a cloud client | [
"Return",
"a",
"cloud",
"client"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L41-L49 | train |
saltstack/salt | salt/modules/cloud.py | has_instance | 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 | 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 | [
"def",
"has_instance",
"(",
"name",
",",
"provider",
"=",
"None",
")",
":",
"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 | [
"Return",
"true",
"if",
"the",
"instance",
"is",
"found",
"on",
"a",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L140-L153 | train |
saltstack/salt | salt/modules/cloud.py | get_instance | 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
... | 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
... | [
"def",
"get_instance",
"(",
"name",
",",
"provider",
"=",
"None",
")",
":",
"data",
"=",
"action",
"(",
"fun",
"=",
"'show_instance'",
",",
"names",
"=",
"[",
"name",
"]",
",",
"provider",
"=",
"provider",
")",
"info",
"=",
"salt",
".",
"utils",
".",... | 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... | [
"Return",
"details",
"on",
"an",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L156-L183 | train |
saltstack/salt | salt/modules/cloud.py | profile_ | 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(... | 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(... | [
"def",
"profile_",
"(",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"if",
"isinstance",
"(",
"opts",
",",
"dict",
")",
":",
"client",
... | Spin up an instance using Salt Cloud
CLI Example:
.. code-block:: bash
salt minionname cloud.profile my-gce-config myinstance | [
"Spin",
"up",
"an",
"instance",
"using",
"Salt",
"Cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L186-L200 | train |
saltstack/salt | salt/modules/cloud.py | map_run | 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)
... | 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)
... | [
"def",
"map_run",
"(",
"path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"info",
"=",
"client",
".",
"map_run",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
"return",
"info"
] | 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... | [
"Execute",
"a",
"salt",
"cloud",
"map",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L203-L229 | train |
saltstack/salt | salt/modules/cloud.py | action | 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
... | 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
... | [
"def",
"action",
"(",
"fun",
"=",
"None",
",",
"cloudmap",
"=",
"None",
",",
"names",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"instance",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"try",
":",
... | 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 | [
"Execute",
"a",
"single",
"action",
"on",
"the",
"given",
"provider",
"/",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L247-L272 | train |
saltstack/salt | salt/modules/cloud.py | create | 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... | 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... | [
"def",
"create",
"(",
"provider",
",",
"names",
",",
"opts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"if",
"isinstance",
"(",
"opts",
",",
"dict",
")",
":",
"client",
".",
"opts",
".",
"update",
"(",
... | 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 | [
"Create",
"an",
"instance",
"using",
"Salt",
"Cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L275-L289 | train |
saltstack/salt | salt/modules/cloud.py | volume_list | 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'] | 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'] | [
"def",
"volume_list",
"(",
"provider",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"info",
"=",
"client",
".",
"extra_action",
"(",
"action",
"=",
"'volume_list'",
",",
"provider",
"=",
"provider",
",",
"names",
"=",
"'name'",
")",
"return",
"info",
... | List block storage volumes
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_list my-nova | [
"List",
"block",
"storage",
"volumes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L292-L305 | train |
saltstack/salt | salt/modules/cloud.py | volume_attach | 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... | 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... | [
"def",
"volume_attach",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"info",
"=",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",
"... | Attach volume to a server
CLI Example:
.. code-block:: bash
salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf' | [
"Attach",
"volume",
"to",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L340-L353 | train |
saltstack/salt | salt/modules/cloud.py | network_list | 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') | 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') | [
"def",
"network_list",
"(",
"provider",
")",
":",
"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 | [
"List",
"private",
"networks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L372-L384 | train |
saltstack/salt | salt/modules/cloud.py | network_create | 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... | 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... | [
"def",
"network_create",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",
"=",
... | Create private network
CLI Example:
.. code-block:: bash
salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24' | [
"Create",
"private",
"network"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L387-L399 | train |
saltstack/salt | salt/modules/cloud.py | virtual_interface_list | 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... | 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... | [
"def",
"virtual_interface_list",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"action",... | List virtual interfaces on a server
CLI Example:
.. code-block:: bash
salt minionname cloud.virtual_interface_list my-nova names=['salt-master'] | [
"List",
"virtual",
"interfaces",
"on",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L402-L414 | train |
saltstack/salt | salt/modules/cloud.py | virtual_interface_create | 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(... | 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(... | [
"def",
"virtual_interface_create",
"(",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"extra_action",
"(",
"provider",
"=",
"provider",
",",
"names",
"=",
"names",
",",
"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' | [
"Attach",
"private",
"interfaces",
"to",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cloud.py#L417-L429 | train |
saltstack/salt | salt/modules/netbsd_sysctl.py | show | 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',
... | 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',
... | [
"def",
"show",
"(",
"config_file",
"=",
"False",
")",
":",
"roots",
"=",
"(",
"'kern'",
",",
"'vm'",
",",
"'vfs'",
",",
"'net'",
",",
"'hw'",
",",
"'machdep'",
",",
"'user'",
",",
"'ddb'",
",",
"'proc'",
",",
"'emul'",
",",
"'security'",
",",
"'init'... | Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show | [
"Return",
"a",
"list",
"of",
"sysctl",
"parameters",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L30-L66 | train |
saltstack/salt | salt/modules/netbsd_sysctl.py | get | 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 | 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 | [
"def",
"get",
"(",
"name",
")",
":",
"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 | [
"Return",
"a",
"single",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L69-L81 | train |
saltstack/salt | salt/modules/netbsd_sysctl.py | persist | 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... | 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... | [
"def",
"persist",
"(",
"name",
",",
"value",
",",
"config",
"=",
"'/etc/sysctl.conf'",
")",
":",
"nlines",
"=",
"[",
"]",
"edited",
"=",
"False",
"value",
"=",
"six",
".",
"text_type",
"(",
"value",
")",
"# create /etc/sysctl.conf if not present",
"if",
"not... | Assign and persist a simple sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.persist net.inet.icmp.icmplim 50 | [
"Assign",
"and",
"persist",
"a",
"simple",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L106-L162 | train |
saltstack/salt | salt/states/pushover.py | post_message | 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... | 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... | [
"def",
"post_message",
"(",
"name",
",",
"user",
"=",
"None",
",",
"device",
"=",
"None",
",",
"message",
"=",
"None",
",",
"title",
"=",
"None",
",",
"priority",
"=",
"None",
",",
"expire",
"=",
"None",
",",
"retry",
"=",
"None",
",",
"sound",
"="... | 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
... | [
"Send",
"a",
"message",
"to",
"a",
"PushOver",
"channel",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pushover.py#L42-L137 | train |
saltstack/salt | salt/modules/dig.py | check_ip | 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... | 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... | [
"def",
"check_ip",
"(",
"addr",
")",
":",
"try",
":",
"addr",
"=",
"addr",
".",
"rsplit",
"(",
"'/'",
",",
"1",
")",
"except",
"AttributeError",
":",
"# Non-string passed",
"return",
"False",
"if",
"salt",
".",
"utils",
".",
"network",
".",
"is_ipv4",
... | 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 | [
"Check",
"if",
"address",
"is",
"a",
"valid",
"IP",
".",
"returns",
"True",
"if",
"valid",
"otherwise",
"False",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L32-L72 | train |
saltstack/salt | salt/modules/dig.py | AAAA | 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... | 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... | [
"def",
"AAAA",
"(",
"host",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"host",
")",
",",
"'AAAA'",
"]",
"if",
"nameserver",
"is",
"not",
"None",
":",
"dig",
".",
"append",... | Return the AAAA record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.AAAA www.google.com | [
"Return",
"the",
"AAAA",
"record",
"for",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L105-L132 | train |
saltstack/salt | salt/modules/dig.py | NS | 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... | 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... | [
"def",
"NS",
"(",
"domain",
",",
"resolve",
"=",
"True",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"domain",
")",
",",
"'NS'",
"]",
"if",
"nameserver",
"is",
"not",
"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 | [
"Return",
"a",
"list",
"of",
"IPs",
"of",
"the",
"nameservers",
"for",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L135-L168 | train |
saltstack/salt | salt/modules/dig.py | SPF | 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.
... | 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.
... | [
"def",
"SPF",
"(",
"domain",
",",
"record",
"=",
"'SPF'",
",",
"nameserver",
"=",
"None",
")",
":",
"spf_re",
"=",
"re",
".",
"compile",
"(",
"r'(?:\\+|~)?(ip[46]|include):(.+)'",
")",
"cmd",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_typ... | 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... | [
"Return",
"the",
"allowed",
"IPv4",
"ranges",
"in",
"the",
"SPF",
"record",
"for",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L171-L223 | train |
saltstack/salt | salt/modules/dig.py | MX | 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 ... | 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 ... | [
"def",
"MX",
"(",
"domain",
",",
"resolve",
"=",
"False",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"domain",
")",
",",
"'MX'",
"]",
"if",
"nameserver",
"is",
"not",
"Non... | 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... | [
"Return",
"a",
"list",
"of",
"lists",
"for",
"the",
"MX",
"of",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L226-L264 | train |
saltstack/salt | salt/modules/dig.py | TXT | 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... | 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... | [
"def",
"TXT",
"(",
"host",
",",
"nameserver",
"=",
"None",
")",
":",
"dig",
"=",
"[",
"'dig'",
",",
"'+short'",
",",
"six",
".",
"text_type",
"(",
"host",
")",
",",
"'TXT'",
"]",
"if",
"nameserver",
"is",
"not",
"None",
":",
"dig",
".",
"append",
... | Return the TXT record for ``host``.
Always returns a list.
CLI Example:
.. code-block:: bash
salt ns1 dig.TXT google.com | [
"Return",
"the",
"TXT",
"record",
"for",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dig.py#L267-L293 | train |
saltstack/salt | salt/modules/freebsd_sysctl.py | show | 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',
... | 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',
... | [
"def",
"show",
"(",
"config_file",
"=",
"False",
")",
":",
"roots",
"=",
"(",
"'compat'",
",",
"'debug'",
",",
"'dev'",
",",
"'hptmv'",
",",
"'hw'",
",",
"'kern'",
",",
"'machdep'",
",",
"'net'",
",",
"'p1003_1b'",
",",
"'security'",
",",
"'user'",
","... | Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show | [
"Return",
"a",
"list",
"of",
"sysctl",
"parameters",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L40-L95 | train |
saltstack/salt | salt/modules/freebsd_sysctl.py | assign | 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)
... | 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)
... | [
"def",
"assign",
"(",
"name",
",",
"value",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'sysctl {0}=\"{1}\"'",
".",
"format",
"(",
"name",
",",
"value",
")",
"data",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"... | Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.inet.icmp.icmplim 50 | [
"Assign",
"a",
"single",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L113-L132 | train |
saltstack/salt | salt/modules/freebsd_sysctl.py | persist | 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... | 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... | [
"def",
"persist",
"(",
"name",
",",
"value",
",",
"config",
"=",
"'/etc/sysctl.conf'",
")",
":",
"nlines",
"=",
"[",
"]",
"edited",
"=",
"False",
"value",
"=",
"six",
".",
"text_type",
"(",
"value",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".... | 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 | [
"Assign",
"and",
"persist",
"a",
"simple",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsd_sysctl.py#L135-L177 | train |
saltstack/salt | salt/states/augeas.py | _workout_filename | 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)) | 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)) | [
"def",
"_workout_filename",
"(",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
"or",
"filename",
"==",
"'/'",
":",
"if",
"filename",
"==",
"'/'",
":",
"filename",
"=",
"None",
"return",
"filename",
"else",
":",
"re... | Recursively workout the file name from an augeas change | [
"Recursively",
"workout",
"the",
"file",
"name",
"from",
"an",
"augeas",
"change"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L53-L62 | train |
saltstack/salt | salt/states/augeas.py | _check_filepath | 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)
... | 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)
... | [
"def",
"_check_filepath",
"(",
"changes",
")",
":",
"filename",
"=",
"None",
"for",
"change_",
"in",
"changes",
":",
"try",
":",
"cmd",
",",
"arg",
"=",
"change_",
".",
"split",
"(",
"' '",
",",
"1",
")",
"if",
"cmd",
"not",
"in",
"METHOD_MAP",
":",
... | 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. | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L65-L110 | train |
saltstack/salt | salt/states/augeas.py | change | 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
... | 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
... | [
"def",
"change",
"(",
"name",
",",
"context",
"=",
"None",
",",
"changes",
"=",
"None",
",",
"lens",
"=",
"None",
",",
"load_path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"Fal... | .. 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 ... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/augeas.py#L113-L323 | train |
saltstack/salt | salt/modules/redismod.py | _connect | 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... | 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... | [
"def",
"_connect",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"not",
"host",
":",
"host",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'redis.host'",
")",
"if",
"... | Returns an instance of the redis client | [
"Returns",
"an",
"instance",
"of",
"the",
"redis",
"client"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L45-L58 | train |
saltstack/salt | salt/modules/redismod.py | _sconnect | 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... | 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... | [
"def",
"_sconnect",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"host",
"is",
"None",
":",
"host",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'redis_sentinel.host'",
",",
"'localhost'",
")",
... | Returns an instance of the redis client | [
"Returns",
"an",
"instance",
"of",
"the",
"redis",
"client"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L61-L72 | train |
saltstack/salt | salt/modules/redismod.py | bgrewriteaof | 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() | 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() | [
"def",
"bgrewriteaof",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
"."... | Asynchronously rewrite the append-only file
CLI Example:
.. code-block:: bash
salt '*' redis.bgrewriteaof | [
"Asynchronously",
"rewrite",
"the",
"append",
"-",
"only",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L75-L86 | train |
saltstack/salt | salt/modules/redismod.py | bgsave | 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() | 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() | [
"def",
"bgsave",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"b... | Asynchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.bgsave | [
"Asynchronously",
"save",
"the",
"dataset",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L89-L100 | train |
saltstack/salt | salt/modules/redismod.py | config_get | 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... | 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... | [
"def",
"config_get",
"(",
"pattern",
"=",
"'*'",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
... | Get redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_get
salt '*' redis.config_get port | [
"Get",
"redis",
"server",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L103-L115 | train |
saltstack/salt | salt/modules/redismod.py | config_set | 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... | 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... | [
"def",
"config_set",
"(",
"name",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
"... | Set redis server configuration values
CLI Example:
.. code-block:: bash
salt '*' redis.config_set masterauth luv_kittens | [
"Set",
"redis",
"server",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L118-L129 | train |
saltstack/salt | salt/modules/redismod.py | dbsize | 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() | 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() | [
"def",
"dbsize",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"d... | Return the number of keys in the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.dbsize | [
"Return",
"the",
"number",
"of",
"keys",
"in",
"the",
"selected",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L132-L143 | train |
saltstack/salt | salt/modules/redismod.py | delete | 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']:
... | 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']:
... | [
"def",
"delete",
"(",
"*",
"keys",
",",
"*",
"*",
"connection_args",
")",
":",
"# Get connection args from keywords if set",
"conn_args",
"=",
"{",
"}",
"for",
"arg",
"in",
"[",
"'host'",
",",
"'port'",
",",
"'db'",
",",
"'password'",
"]",
":",
"if",
"arg"... | Deletes the keys from redis, returns number of keys deleted
CLI Example:
.. code-block:: bash
salt '*' redis.delete foo | [
"Deletes",
"the",
"keys",
"from",
"redis",
"returns",
"number",
"of",
"keys",
"deleted"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L146-L163 | train |
saltstack/salt | salt/modules/redismod.py | exists | 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) | 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) | [
"def",
"exists",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"serv... | Return true if the key exists in redis
CLI Example:
.. code-block:: bash
salt '*' redis.exists foo | [
"Return",
"true",
"if",
"the",
"key",
"exists",
"in",
"redis"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L166-L177 | train |
saltstack/salt | salt/modules/redismod.py | expire | 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) | 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) | [
"def",
"expire",
"(",
"key",
",",
"seconds",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",... | Set a keys time to live in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.expire foo 300 | [
"Set",
"a",
"keys",
"time",
"to",
"live",
"in",
"seconds"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L180-L191 | train |
saltstack/salt | salt/modules/redismod.py | expireat | 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) | 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) | [
"def",
"expireat",
"(",
"key",
",",
"timestamp",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
... | Set a keys expire at given UNIX time
CLI Example:
.. code-block:: bash
salt '*' redis.expireat foo 1400000000 | [
"Set",
"a",
"keys",
"expire",
"at",
"given",
"UNIX",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L194-L205 | train |
saltstack/salt | salt/modules/redismod.py | flushall | 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() | 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() | [
"def",
"flushall",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
... | Remove all keys from all databases
CLI Example:
.. code-block:: bash
salt '*' redis.flushall | [
"Remove",
"all",
"keys",
"from",
"all",
"databases"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L208-L219 | train |
saltstack/salt | salt/modules/redismod.py | flushdb | 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() | 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() | [
"def",
"flushdb",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"... | Remove all keys from the selected database
CLI Example:
.. code-block:: bash
salt '*' redis.flushdb | [
"Remove",
"all",
"keys",
"from",
"the",
"selected",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L222-L233 | train |
saltstack/salt | salt/modules/redismod.py | get_key | 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) | 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) | [
"def",
"get_key",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"ser... | Get redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.get_key foo | [
"Get",
"redis",
"key",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L236-L247 | train |
saltstack/salt | salt/modules/redismod.py | hexists | 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... | 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... | [
"def",
"hexists",
"(",
"key",
",",
"field",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Determine if a hash fields exists.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hexists foo_hash bar_field | [
"Determine",
"if",
"a",
"hash",
"fields",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L270-L283 | train |
saltstack/salt | salt/modules/redismod.py | hgetall | 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) | 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) | [
"def",
"hgetall",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"ser... | Get all fields and values from a redis hash, returns dict
CLI Example:
.. code-block:: bash
salt '*' redis.hgetall foo_hash | [
"Get",
"all",
"fields",
"and",
"values",
"from",
"a",
"redis",
"hash",
"returns",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L300-L311 | train |
saltstack/salt | salt/modules/redismod.py | hincrby | 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(... | 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(... | [
"def",
"hincrby",
"(",
"key",
",",
"field",
",",
"increment",
"=",
"1",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
... | 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 | [
"Increment",
"the",
"integer",
"value",
"of",
"a",
"hash",
"field",
"by",
"the",
"given",
"number",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L314-L327 | train |
saltstack/salt | salt/modules/redismod.py | hlen | 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) | 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) | [
"def",
"hlen",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server... | Returns number of fields of a hash.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' redis.hlen foo_hash | [
"Returns",
"number",
"of",
"fields",
"of",
"a",
"hash",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L346-L359 | train |
saltstack/salt | salt/modules/redismod.py | hmget | 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)
... | 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)
... | [
"def",
"hmget",
"(",
"key",
",",
"*",
"fields",
",",
"*",
"*",
"options",
")",
":",
"host",
"=",
"options",
".",
"get",
"(",
"'host'",
",",
"None",
")",
"port",
"=",
"options",
".",
"get",
"(",
"'port'",
",",
"None",
")",
"database",
"=",
"option... | 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 | [
"Returns",
"the",
"values",
"of",
"all",
"the",
"given",
"hash",
"fields",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L362-L379 | train |
saltstack/salt | salt/modules/redismod.py | hmset | 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... | 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... | [
"def",
"hmset",
"(",
"key",
",",
"*",
"*",
"fieldsvals",
")",
":",
"host",
"=",
"fieldsvals",
".",
"pop",
"(",
"'host'",
",",
"None",
")",
"port",
"=",
"fieldsvals",
".",
"pop",
"(",
"'port'",
",",
"None",
")",
"database",
"=",
"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 | [
"Sets",
"multiple",
"hash",
"fields",
"to",
"multiple",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L382-L399 | train |
saltstack/salt | salt/modules/redismod.py | hset | 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... | 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... | [
"def",
"hset",
"(",
"key",
",",
"field",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"pas... | 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 | [
"Set",
"the",
"value",
"of",
"a",
"hash",
"field",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L402-L415 | train |
saltstack/salt | salt/modules/redismod.py | hvals | 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... | 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... | [
"def",
"hvals",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"serve... | 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 | [
"Return",
"all",
"the",
"values",
"in",
"a",
"hash",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L434-L447 | train |
saltstack/salt | salt/modules/redismod.py | hscan | 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
'''
... | 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
'''
... | [
"def",
"hscan",
"(",
"key",
",",
"cursor",
"=",
"0",
",",
"match",
"=",
"None",
",",
"count",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_conn... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L450-L463 | train |
saltstack/salt | salt/modules/redismod.py | info | 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() | 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() | [
"def",
"info",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"inf... | Get information and statistics about the server
CLI Example:
.. code-block:: bash
salt '*' redis.info | [
"Get",
"information",
"and",
"statistics",
"about",
"the",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L466-L477 | train |
saltstack/salt | salt/modules/redismod.py | keys | 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) | 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) | [
"def",
"keys",
"(",
"pattern",
"=",
"'*'",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Get redis keys, supports glob style patterns
CLI Example:
.. code-block:: bash
salt '*' redis.keys
salt '*' redis.keys test* | [
"Get",
"redis",
"keys",
"supports",
"glob",
"style",
"patterns"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L480-L492 | train |
saltstack/salt | salt/modules/redismod.py | key_type | 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) | 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) | [
"def",
"key_type",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"se... | Get redis key type
CLI Example:
.. code-block:: bash
salt '*' redis.type foo | [
"Get",
"redis",
"key",
"type"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L495-L506 | train |
saltstack/salt | salt/modules/redismod.py | lastsave | 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... | 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... | [
"def",
"lastsave",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"# Use of %s to get the timestamp is not supported by Python. The reason it",
"# works is because it's passed to the system strftime which ... | Get the UNIX time in seconds of the last successful save to disk
CLI Example:
.. code-block:: bash
salt '*' redis.lastsave | [
"Get",
"the",
"UNIX",
"time",
"in",
"seconds",
"of",
"the",
"last",
"successful",
"save",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L509-L526 | train |
saltstack/salt | salt/modules/redismod.py | llen | 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) | 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) | [
"def",
"llen",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server... | Get the length of a list in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.llen foo_list | [
"Get",
"the",
"length",
"of",
"a",
"list",
"in",
"Redis"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L529-L540 | train |
saltstack/salt | salt/modules/redismod.py | ping | def ping(host=None, port=None, db=None, password=None):
'''
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
'''
server = _connect(host, port, db, password)
try:
return server.ping()
except redis.ConnectionError:... | python | def ping(host=None, port=None, db=None, password=None):
'''
Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping
'''
server = _connect(host, port, db, password)
try:
return server.ping()
except redis.ConnectionError:... | [
"def",
"ping",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"try",
":",
"return",
"server... | Ping the server, returns False on connection errors
CLI Example:
.. code-block:: bash
salt '*' redis.ping | [
"Ping",
"the",
"server",
"returns",
"False",
"on",
"connection",
"errors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L557-L571 | train |
saltstack/salt | salt/modules/redismod.py | save | def save(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
'''
server = _connect(host, port, db, password)
return server.save() | python | def save(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save
'''
server = _connect(host, port, db, password)
return server.save() | [
"def",
"save",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"sav... | Synchronously save the dataset to disk
CLI Example:
.. code-block:: bash
salt '*' redis.save | [
"Synchronously",
"save",
"the",
"dataset",
"to",
"disk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L574-L585 | train |
saltstack/salt | salt/modules/redismod.py | set_key | def set_key(key, value, host=None, port=None, db=None, password=None):
'''
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
'''
server = _connect(host, port, db, password)
return server.set(key, value) | python | def set_key(key, value, host=None, port=None, db=None, password=None):
'''
Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar
'''
server = _connect(host, port, db, password)
return server.set(key, value) | [
"def",
"set_key",
"(",
"key",
",",
"value",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
... | Set redis key value
CLI Example:
.. code-block:: bash
salt '*' redis.set_key foo bar | [
"Set",
"redis",
"key",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L588-L599 | train |
saltstack/salt | salt/modules/redismod.py | shutdown | def shutdown(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown
'''
server = _connect(host, port, db, password)
try:
# Return false if unable to p... | python | def shutdown(host=None, port=None, db=None, password=None):
'''
Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown
'''
server = _connect(host, port, db, password)
try:
# Return false if unable to p... | [
"def",
"shutdown",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"try",
":",
"# Return false... | Synchronously save the dataset to disk and then shut down the server
CLI Example:
.. code-block:: bash
salt '*' redis.shutdown | [
"Synchronously",
"save",
"the",
"dataset",
"to",
"disk",
"and",
"then",
"shut",
"down",
"the",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L602-L625 | train |
saltstack/salt | salt/modules/redismod.py | slaveof | def slaveof(master_host=None, master_port=None, host=None, port=None, db=None,
password=None):
'''
Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof red... | python | def slaveof(master_host=None, master_port=None, host=None, port=None, db=None,
password=None):
'''
Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof red... | [
"def",
"slaveof",
"(",
"master_host",
"=",
"None",
",",
"master_port",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"master_host",
"and",
"not",
"master_port",
... | Make the server a slave of another instance, or promote it as master
CLI Example:
.. code-block:: bash
# Become slave of redis-n01.example.com:6379
salt '*' redis.slaveof redis-n01.example.com 6379
salt '*' redis.slaveof redis-n01.example.com
# Become master
salt '*' r... | [
"Make",
"the",
"server",
"a",
"slave",
"of",
"another",
"instance",
"or",
"promote",
"it",
"as",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L628-L646 | train |
saltstack/salt | salt/modules/redismod.py | smembers | def smembers(key, host=None, port=None, db=None, password=None):
'''
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
'''
server = _connect(host, port, db, password)
return list(server.smembers(key)) | python | def smembers(key, host=None, port=None, db=None, password=None):
'''
Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set
'''
server = _connect(host, port, db, password)
return list(server.smembers(key)) | [
"def",
"smembers",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"li... | Get members in a Redis set
CLI Example:
.. code-block:: bash
salt '*' redis.smembers foo_set | [
"Get",
"members",
"in",
"a",
"Redis",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L649-L660 | train |
saltstack/salt | salt/modules/redismod.py | time | def time(host=None, port=None, db=None, password=None):
'''
Return the current server UNIX time in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.time
'''
server = _connect(host, port, db, password)
return server.time()[0] | python | def time(host=None, port=None, db=None, password=None):
'''
Return the current server UNIX time in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.time
'''
server = _connect(host, port, db, password)
return server.time()[0] | [
"def",
"time",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"server",
".",
"tim... | Return the current server UNIX time in seconds
CLI Example:
.. code-block:: bash
salt '*' redis.time | [
"Return",
"the",
"current",
"server",
"UNIX",
"time",
"in",
"seconds"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L663-L674 | train |
saltstack/salt | salt/modules/redismod.py | zcard | def zcard(key, host=None, port=None, db=None, password=None):
'''
Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_sorted
'''
server = _connect(host, port, db, password)
return server.zcard(key) | python | def zcard(key, host=None, port=None, db=None, password=None):
'''
Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_sorted
'''
server = _connect(host, port, db, password)
return server.zcard(key) | [
"def",
"zcard",
"(",
"key",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"password",
")",
"return",
"serve... | Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_sorted | [
"Get",
"the",
"length",
"of",
"a",
"sorted",
"set",
"in",
"Redis"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L677-L688 | train |
saltstack/salt | salt/modules/redismod.py | zrange | def zrange(key, start, stop, host=None, port=None, db=None, password=None):
'''
Get a range of values from a sorted set in Redis by index
CLI Example:
.. code-block:: bash
salt '*' redis.zrange foo_sorted 0 10
'''
server = _connect(host, port, db, password)
return server.zrange(ke... | python | def zrange(key, start, stop, host=None, port=None, db=None, password=None):
'''
Get a range of values from a sorted set in Redis by index
CLI Example:
.. code-block:: bash
salt '*' redis.zrange foo_sorted 0 10
'''
server = _connect(host, port, db, password)
return server.zrange(ke... | [
"def",
"zrange",
"(",
"key",
",",
"start",
",",
"stop",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"db",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"db",
",",
"pa... | Get a range of values from a sorted set in Redis by index
CLI Example:
.. code-block:: bash
salt '*' redis.zrange foo_sorted 0 10 | [
"Get",
"a",
"range",
"of",
"values",
"from",
"a",
"sorted",
"set",
"in",
"Redis",
"by",
"index"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L691-L702 | train |
saltstack/salt | salt/modules/redismod.py | sentinel_get_master_ip | def sentinel_get_master_ip(master, host=None, port=None, password=None):
'''
Get ip for sentinel master
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.sentinel_get_master_ip 'mymaster'
'''
server = _sconnect(host, port, password)
ret = server.senti... | python | def sentinel_get_master_ip(master, host=None, port=None, password=None):
'''
Get ip for sentinel master
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.sentinel_get_master_ip 'mymaster'
'''
server = _sconnect(host, port, password)
ret = server.senti... | [
"def",
"sentinel_get_master_ip",
"(",
"master",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_sconnect",
"(",
"host",
",",
"port",
",",
"password",
")",
"ret",
"=",
"server",
".",
"sentinel... | Get ip for sentinel master
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.sentinel_get_master_ip 'mymaster' | [
"Get",
"ip",
"for",
"sentinel",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L705-L719 | train |
saltstack/salt | salt/modules/redismod.py | get_master_ip | def get_master_ip(host=None, port=None, password=None):
'''
Get host information about slave
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.get_master_ip
'''
server = _connect(host, port, password)
srv_info = server.info()
ret = (srv_info.get('... | python | def get_master_ip(host=None, port=None, password=None):
'''
Get host information about slave
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.get_master_ip
'''
server = _connect(host, port, password)
srv_info = server.info()
ret = (srv_info.get('... | [
"def",
"get_master_ip",
"(",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"server",
"=",
"_connect",
"(",
"host",
",",
"port",
",",
"password",
")",
"srv_info",
"=",
"server",
".",
"info",
"(",
")",
"ret",
... | Get host information about slave
.. versionadded: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' redis.get_master_ip | [
"Get",
"host",
"information",
"about",
"slave"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/redismod.py#L722-L737 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.