partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | replication_details | Get the full replication details.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : str (None)
The name of the solr core if using cores. Leave this blank if you are
not using cores or if you want to check all cores.
Return : dict<str,obj>::
... | salt/modules/solr.py | def replication_details(host=None, core_name=None):
'''
Get the full replication details.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : str (None)
The name of the solr core if using cores. Leave this blank if you are
not using cores or if you... | def replication_details(host=None, core_name=None):
'''
Get the full replication details.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : str (None)
The name of the solr core if using cores. Leave this blank if you are
not using cores or if you... | [
"Get",
"the",
"full",
"replication",
"details",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L803-L838 | [
"def",
"replication_details",
"(",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
")",
":",
"ret",
"=",
"_get_return_dict",
"(",
")",
"if",
"_get_none_or_value",
"(",
"core_name",
")",
"is",
"None",
":",
"success",
"=",
"True",
"for",
"name",
"in",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | backup | Tell solr make a backup. This method can be mis-leading since it uses the
backup API. If an error happens during the backup you are not notified.
The status: 'OK' in the response simply means that solr received the
request successfully.
host : str (None)
The solr host to query. __opts__['host... | salt/modules/solr.py | def backup(host=None, core_name=None, append_core_to_path=False):
'''
Tell solr make a backup. This method can be mis-leading since it uses the
backup API. If an error happens during the backup you are not notified.
The status: 'OK' in the response simply means that solr received the
request succe... | def backup(host=None, core_name=None, append_core_to_path=False):
'''
Tell solr make a backup. This method can be mis-leading since it uses the
backup API. If an error happens during the backup you are not notified.
The status: 'OK' in the response simply means that solr received the
request succe... | [
"Tell",
"solr",
"make",
"a",
"backup",
".",
"This",
"method",
"can",
"be",
"mis",
"-",
"leading",
"since",
"it",
"uses",
"the",
"backup",
"API",
".",
"If",
"an",
"error",
"happens",
"during",
"the",
"backup",
"you",
"are",
"not",
"notified",
".",
"The"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L841-L899 | [
"def",
"backup",
"(",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
",",
"append_core_to_path",
"=",
"False",
")",
":",
"path",
"=",
"__opts__",
"[",
"'solr.backup_path'",
"]",
"num_backups",
"=",
"__opts__",
"[",
"'solr.num_backups'",
"]",
"if",
"path... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_is_polling | SLAVE CALL
Prevent the slaves from polling the master for updates.
polling : boolean
True will enable polling. False will disable it.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : str (None)
The name of the solr core if using cores. Leave thi... | salt/modules/solr.py | def set_is_polling(polling, host=None, core_name=None):
'''
SLAVE CALL
Prevent the slaves from polling the master for updates.
polling : boolean
True will enable polling. False will disable it.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : st... | def set_is_polling(polling, host=None, core_name=None):
'''
SLAVE CALL
Prevent the slaves from polling the master for updates.
polling : boolean
True will enable polling. False will disable it.
host : str (None)
The solr host to query. __opts__['host'] is default.
core_name : st... | [
"SLAVE",
"CALL",
"Prevent",
"the",
"slaves",
"from",
"polling",
"the",
"master",
"for",
"updates",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L902-L945 | [
"def",
"set_is_polling",
"(",
"polling",
",",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
")",
":",
"ret",
"=",
"_get_return_dict",
"(",
")",
"# since only slaves can call this let's check the config:",
"if",
"_is_master",
"(",
")",
"and",
"_get_none_or_valu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_replication_enabled | MASTER ONLY
Sets the master to ignore poll requests from the slaves. Useful when you
don't want the slaves replicating during indexing or when clearing the
index.
status : boolean
Sets the replication status to the specified state.
host : str (None)
The solr host to query. __opts__[... | salt/modules/solr.py | def set_replication_enabled(status, host=None, core_name=None):
'''
MASTER ONLY
Sets the master to ignore poll requests from the slaves. Useful when you
don't want the slaves replicating during indexing or when clearing the
index.
status : boolean
Sets the replication status to the spec... | def set_replication_enabled(status, host=None, core_name=None):
'''
MASTER ONLY
Sets the master to ignore poll requests from the slaves. Useful when you
don't want the slaves replicating during indexing or when clearing the
index.
status : boolean
Sets the replication status to the spec... | [
"MASTER",
"ONLY",
"Sets",
"the",
"master",
"to",
"ignore",
"poll",
"requests",
"from",
"the",
"slaves",
".",
"Useful",
"when",
"you",
"don",
"t",
"want",
"the",
"slaves",
"replicating",
"during",
"indexing",
"or",
"when",
"clearing",
"the",
"index",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L948-L993 | [
"def",
"set_replication_enabled",
"(",
"status",
",",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
")",
":",
"if",
"not",
"_is_master",
"(",
")",
"and",
"_get_none_or_value",
"(",
"host",
")",
"is",
"None",
":",
"return",
"_get_return_dict",
"(",
"F... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | signal | Signals Apache Solr to start, stop, or restart. Obviously this is only
going to work if the minion resides on the solr host. Additionally Solr
doesn't ship with an init script so one must be created.
signal : str (None)
The command to pass to the apache solr init valid values are 'start',
'... | salt/modules/solr.py | def signal(signal=None):
'''
Signals Apache Solr to start, stop, or restart. Obviously this is only
going to work if the minion resides on the solr host. Additionally Solr
doesn't ship with an init script so one must be created.
signal : str (None)
The command to pass to the apache solr ini... | def signal(signal=None):
'''
Signals Apache Solr to start, stop, or restart. Obviously this is only
going to work if the minion resides on the solr host. Additionally Solr
doesn't ship with an init script so one must be created.
signal : str (None)
The command to pass to the apache solr ini... | [
"Signals",
"Apache",
"Solr",
"to",
"start",
"stop",
"or",
"restart",
".",
"Obviously",
"this",
"is",
"only",
"going",
"to",
"work",
"if",
"the",
"minion",
"resides",
"on",
"the",
"solr",
"host",
".",
"Additionally",
"Solr",
"doesn",
"t",
"ship",
"with",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L996-L1022 | [
"def",
"signal",
"(",
"signal",
"=",
"None",
")",
":",
"valid_signals",
"=",
"(",
"'start'",
",",
"'stop'",
",",
"'restart'",
")",
"# Give a friendly error message for invalid signals",
"# TODO: Fix this logic to be reusable and used by apache.signal",
"if",
"signal",
"not"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reload_core | MULTI-CORE HOSTS ONLY
Load a new core from the same configuration as an existing registered core.
While the "new" core is initializing, the "old" one will continue to accept
requests. Once it has finished, all new request will go to the "new" core,
and the "old" core will be unloaded.
host : str (N... | salt/modules/solr.py | def reload_core(host=None, core_name=None):
'''
MULTI-CORE HOSTS ONLY
Load a new core from the same configuration as an existing registered core.
While the "new" core is initializing, the "old" one will continue to accept
requests. Once it has finished, all new request will go to the "new" core,
... | def reload_core(host=None, core_name=None):
'''
MULTI-CORE HOSTS ONLY
Load a new core from the same configuration as an existing registered core.
While the "new" core is initializing, the "old" one will continue to accept
requests. Once it has finished, all new request will go to the "new" core,
... | [
"MULTI",
"-",
"CORE",
"HOSTS",
"ONLY",
"Load",
"a",
"new",
"core",
"from",
"the",
"same",
"configuration",
"as",
"an",
"existing",
"registered",
"core",
".",
"While",
"the",
"new",
"core",
"is",
"initializing",
"the",
"old",
"one",
"will",
"continue",
"to"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1025-L1069 | [
"def",
"reload_core",
"(",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
")",
":",
"ret",
"=",
"_get_return_dict",
"(",
")",
"if",
"not",
"_check_for_cores",
"(",
")",
":",
"err",
"=",
"[",
"'solr.reload_core can only be called by \"multi-core\" minions'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reload_import_config | MASTER ONLY
re-loads the handler config XML file.
This command can only be run if the minion is a 'master' type
handler : str
The name of the data import handler.
host : str (None)
The solr host to query. __opts__['host'] is default.
core : str (None)
The core the handler be... | salt/modules/solr.py | def reload_import_config(handler, host=None, core_name=None, verbose=False):
'''
MASTER ONLY
re-loads the handler config XML file.
This command can only be run if the minion is a 'master' type
handler : str
The name of the data import handler.
host : str (None)
The solr host to ... | def reload_import_config(handler, host=None, core_name=None, verbose=False):
'''
MASTER ONLY
re-loads the handler config XML file.
This command can only be run if the minion is a 'master' type
handler : str
The name of the data import handler.
host : str (None)
The solr host to ... | [
"MASTER",
"ONLY",
"re",
"-",
"loads",
"the",
"handler",
"config",
"XML",
"file",
".",
"This",
"command",
"can",
"only",
"be",
"run",
"if",
"the",
"minion",
"is",
"a",
"master",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1114-L1154 | [
"def",
"reload_import_config",
"(",
"handler",
",",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"# make sure that it's a master minion",
"if",
"not",
"_is_master",
"(",
")",
"and",
"_get_none_or_value",
"(",
"host"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | full_import | MASTER ONLY
Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type=master
handler : str
The name of the data import handler.
host : str (None)
The solr host to query. __opts__['host'] is def... | salt/modules/solr.py | def full_import(handler, host=None, core_name=None, options=None, extra=None):
'''
MASTER ONLY
Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type=master
handler : str
The name of the data im... | def full_import(handler, host=None, core_name=None, options=None, extra=None):
'''
MASTER ONLY
Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type=master
handler : str
The name of the data im... | [
"MASTER",
"ONLY",
"Submits",
"an",
"import",
"command",
"to",
"the",
"specified",
"handler",
"using",
"specified",
"options",
".",
"This",
"command",
"can",
"only",
"be",
"run",
"if",
"the",
"minion",
"is",
"configured",
"with",
"solr",
".",
"type",
"=",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1198-L1252 | [
"def",
"full_import",
"(",
"handler",
",",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
",",
"options",
"=",
"None",
",",
"extra",
"=",
"None",
")",
":",
"options",
"=",
"{",
"}",
"if",
"options",
"is",
"None",
"else",
"options",
"extra",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | import_status | Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type: 'master'
handler : str
The name of the data import handler.
host : str (None)
The solr host to query. __opts__['host'] is default.
cor... | salt/modules/solr.py | def import_status(handler, host=None, core_name=None, verbose=False):
'''
Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type: 'master'
handler : str
The name of the data import handler.
host... | def import_status(handler, host=None, core_name=None, verbose=False):
'''
Submits an import command to the specified handler using specified options.
This command can only be run if the minion is configured with
solr.type: 'master'
handler : str
The name of the data import handler.
host... | [
"Submits",
"an",
"import",
"command",
"to",
"the",
"specified",
"handler",
"using",
"specified",
"options",
".",
"This",
"command",
"can",
"only",
"be",
"run",
"if",
"the",
"minion",
"is",
"configured",
"with",
"solr",
".",
"type",
":",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1309-L1342 | [
"def",
"import_status",
"(",
"handler",
",",
"host",
"=",
"None",
",",
"core_name",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"_is_master",
"(",
")",
"and",
"_get_none_or_value",
"(",
"host",
")",
"is",
"None",
":",
"errors",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | timing | Decorator wrapper to log execution time, for profiling purposes | salt/utils/decorators/__init__.py | def timing(function):
'''
Decorator wrapper to log execution time, for profiling purposes
'''
@wraps(function)
def wrapped(*args, **kwargs):
start_time = time.time()
ret = function(*args, **salt.utils.args.clean_kwargs(**kwargs))
end_time = time.time()
if function.__m... | def timing(function):
'''
Decorator wrapper to log execution time, for profiling purposes
'''
@wraps(function)
def wrapped(*args, **kwargs):
start_time = time.time()
ret = function(*args, **salt.utils.args.clean_kwargs(**kwargs))
end_time = time.time()
if function.__m... | [
"Decorator",
"wrapper",
"to",
"log",
"execution",
"time",
"for",
"profiling",
"purposes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L220-L238 | [
"def",
"timing",
"(",
"function",
")",
":",
"@",
"wraps",
"(",
"function",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"ret",
"=",
"function",
"(",
"*",
"args",
","... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | memoize | Memoize aka cache the return output of a function
given a specific set of arguments
.. versionedited:: 2016.3.4
Added **kwargs support. | salt/utils/decorators/__init__.py | def memoize(func):
'''
Memoize aka cache the return output of a function
given a specific set of arguments
.. versionedited:: 2016.3.4
Added **kwargs support.
'''
cache = {}
@wraps(func)
def _memoize(*args, **kwargs):
str_args = []
for arg in args:
if n... | def memoize(func):
'''
Memoize aka cache the return output of a function
given a specific set of arguments
.. versionedited:: 2016.3.4
Added **kwargs support.
'''
cache = {}
@wraps(func)
def _memoize(*args, **kwargs):
str_args = []
for arg in args:
if n... | [
"Memoize",
"aka",
"cache",
"the",
"return",
"output",
"of",
"a",
"function",
"given",
"a",
"specific",
"set",
"of",
"arguments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L241-L266 | [
"def",
"memoize",
"(",
"func",
")",
":",
"cache",
"=",
"{",
"}",
"@",
"wraps",
"(",
"func",
")",
"def",
"_memoize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"str_args",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ignores_kwargs | Decorator to filter out unexpected keyword arguments from the call
kwarg_names:
List of argument names to ignore | salt/utils/decorators/__init__.py | def ignores_kwargs(*kwarg_names):
'''
Decorator to filter out unexpected keyword arguments from the call
kwarg_names:
List of argument names to ignore
'''
def _ignores_kwargs(fn):
def __ignores_kwargs(*args, **kwargs):
kwargs_filtered = kwargs.copy()
for name... | def ignores_kwargs(*kwarg_names):
'''
Decorator to filter out unexpected keyword arguments from the call
kwarg_names:
List of argument names to ignore
'''
def _ignores_kwargs(fn):
def __ignores_kwargs(*args, **kwargs):
kwargs_filtered = kwargs.copy()
for name... | [
"Decorator",
"to",
"filter",
"out",
"unexpected",
"keyword",
"arguments",
"from",
"the",
"call"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L636-L651 | [
"def",
"ignores_kwargs",
"(",
"*",
"kwarg_names",
")",
":",
"def",
"_ignores_kwargs",
"(",
"fn",
")",
":",
"def",
"__ignores_kwargs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs_filtered",
"=",
"kwargs",
".",
"copy",
"(",
")",
"for",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ensure_unicode_args | Decodes all arguments passed to the wrapped function | salt/utils/decorators/__init__.py | def ensure_unicode_args(function):
'''
Decodes all arguments passed to the wrapped function
'''
@wraps(function)
def wrapped(*args, **kwargs):
if six.PY2:
return function(
*salt.utils.data.decode_list(args),
**salt.utils.data.decode_dict(kwargs)
... | def ensure_unicode_args(function):
'''
Decodes all arguments passed to the wrapped function
'''
@wraps(function)
def wrapped(*args, **kwargs):
if six.PY2:
return function(
*salt.utils.data.decode_list(args),
**salt.utils.data.decode_dict(kwargs)
... | [
"Decodes",
"all",
"arguments",
"passed",
"to",
"the",
"wrapped",
"function"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L654-L667 | [
"def",
"ensure_unicode_args",
"(",
"function",
")",
":",
"@",
"wraps",
"(",
"function",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"function",
"(",
"*",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | external | Mark function as external.
:param func:
:return: | salt/utils/decorators/__init__.py | def external(func):
'''
Mark function as external.
:param func:
:return:
'''
def f(*args, **kwargs):
'''
Stub.
:param args:
:param kwargs:
:return:
'''
return func(*args, **kwargs)
f.external = True
f.__doc__ = func.__doc__
... | def external(func):
'''
Mark function as external.
:param func:
:return:
'''
def f(*args, **kwargs):
'''
Stub.
:param args:
:param kwargs:
:return:
'''
return func(*args, **kwargs)
f.external = True
f.__doc__ = func.__doc__
... | [
"Mark",
"function",
"as",
"external",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L670-L691 | [
"def",
"external",
"(",
"func",
")",
":",
"def",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n Stub.\n\n :param args:\n :param kwargs:\n :return:\n '''",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwar... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Depends.enforce_dependencies | This is a class global method to enforce the dependencies that you
currently know about.
It will modify the "functions" dict and remove/replace modules that
are missing dependencies. | salt/utils/decorators/__init__.py | def enforce_dependencies(cls, functions, kind):
'''
This is a class global method to enforce the dependencies that you
currently know about.
It will modify the "functions" dict and remove/replace modules that
are missing dependencies.
'''
for dependency, dependent... | def enforce_dependencies(cls, functions, kind):
'''
This is a class global method to enforce the dependencies that you
currently know about.
It will modify the "functions" dict and remove/replace modules that
are missing dependencies.
'''
for dependency, dependent... | [
"This",
"is",
"a",
"class",
"global",
"method",
"to",
"enforce",
"the",
"dependencies",
"that",
"you",
"currently",
"know",
"about",
".",
"It",
"will",
"modify",
"the",
"functions",
"dict",
"and",
"remove",
"/",
"replace",
"modules",
"that",
"are",
"missing"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L135-L214 | [
"def",
"enforce_dependencies",
"(",
"cls",
",",
"functions",
",",
"kind",
")",
":",
"for",
"dependency",
",",
"dependent_dict",
"in",
"six",
".",
"iteritems",
"(",
"cls",
".",
"dependency_dict",
"[",
"kind",
"]",
")",
":",
"for",
"(",
"mod_name",
",",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _DeprecationDecorator._get_args | Discard all keywords which aren't function-specific from the kwargs.
:param kwargs:
:return: | salt/utils/decorators/__init__.py | def _get_args(self, kwargs):
'''
Discard all keywords which aren't function-specific from the kwargs.
:param kwargs:
:return:
'''
_args = list()
_kwargs = salt.utils.args.clean_kwargs(**kwargs)
return _args, _kwargs | def _get_args(self, kwargs):
'''
Discard all keywords which aren't function-specific from the kwargs.
:param kwargs:
:return:
'''
_args = list()
_kwargs = salt.utils.args.clean_kwargs(**kwargs)
return _args, _kwargs | [
"Discard",
"all",
"keywords",
"which",
"aren",
"t",
"function",
"-",
"specific",
"from",
"the",
"kwargs",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L295-L305 | [
"def",
"_get_args",
"(",
"self",
",",
"kwargs",
")",
":",
"_args",
"=",
"list",
"(",
")",
"_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"_args",
",",
"_kwargs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _DeprecationDecorator._call_function | Call target function that has been decorated.
:return: | salt/utils/decorators/__init__.py | def _call_function(self, kwargs):
'''
Call target function that has been decorated.
:return:
'''
if self._raise_later:
raise self._raise_later # pylint: disable=E0702
if self._function:
args, kwargs = self._get_args(kwargs)
try:
... | def _call_function(self, kwargs):
'''
Call target function that has been decorated.
:return:
'''
if self._raise_later:
raise self._raise_later # pylint: disable=E0702
if self._function:
args, kwargs = self._get_args(kwargs)
try:
... | [
"Call",
"target",
"function",
"that",
"has",
"been",
"decorated",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L307-L334 | [
"def",
"_call_function",
"(",
"self",
",",
"kwargs",
")",
":",
"if",
"self",
".",
"_raise_later",
":",
"raise",
"self",
".",
"_raise_later",
"# pylint: disable=E0702",
"if",
"self",
".",
"_function",
":",
"args",
",",
"kwargs",
"=",
"self",
".",
"_get_args",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _WithDeprecated._set_function | Based on the configuration, set to execute an old or a new function.
:return: | salt/utils/decorators/__init__.py | def _set_function(self, function):
'''
Based on the configuration, set to execute an old or a new function.
:return:
'''
full_name = "{m_name}.{f_name}".format(
m_name=self._globals.get(self.MODULE_NAME, '') or self._globals['__name__'].split('.')[-1],
f_n... | def _set_function(self, function):
'''
Based on the configuration, set to execute an old or a new function.
:return:
'''
full_name = "{m_name}.{f_name}".format(
m_name=self._globals.get(self.MODULE_NAME, '') or self._globals['__name__'].split('.')[-1],
f_n... | [
"Based",
"on",
"the",
"configuration",
"set",
"to",
"execute",
"an",
"old",
"or",
"a",
"new",
"function",
".",
":",
"return",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L531-L559 | [
"def",
"_set_function",
"(",
"self",
",",
"function",
")",
":",
"full_name",
"=",
"\"{m_name}.{f_name}\"",
".",
"format",
"(",
"m_name",
"=",
"self",
".",
"_globals",
".",
"get",
"(",
"self",
".",
"MODULE_NAME",
",",
"''",
")",
"or",
"self",
".",
"_globa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _WithDeprecated._is_used_deprecated | Returns True, if a component configuration explicitly is
asking to use an old version of the deprecated function.
:return: | salt/utils/decorators/__init__.py | def _is_used_deprecated(self):
'''
Returns True, if a component configuration explicitly is
asking to use an old version of the deprecated function.
:return:
'''
func_path = "{m_name}.{f_name}".format(
m_name=self._globals.get(self.MODULE_NAME, '') or self._g... | def _is_used_deprecated(self):
'''
Returns True, if a component configuration explicitly is
asking to use an old version of the deprecated function.
:return:
'''
func_path = "{m_name}.{f_name}".format(
m_name=self._globals.get(self.MODULE_NAME, '') or self._g... | [
"Returns",
"True",
"if",
"a",
"component",
"configuration",
"explicitly",
"is",
"asking",
"to",
"use",
"an",
"old",
"version",
"of",
"the",
"deprecated",
"function",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L561-L578 | [
"def",
"_is_used_deprecated",
"(",
"self",
")",
":",
"func_path",
"=",
"\"{m_name}.{f_name}\"",
".",
"format",
"(",
"m_name",
"=",
"self",
".",
"_globals",
".",
"get",
"(",
"self",
".",
"MODULE_NAME",
",",
"''",
")",
"or",
"self",
".",
"_globals",
"[",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | top | Connect to a mongo database and read per-node tops data.
Parameters:
* `collection`: The mongodb collection to read data from. Defaults to
``'tops'``.
* `id_field`: The field in the collection that represents an individual
minion id. Defaults to ``'_id'``.
* `re_pattern`... | salt/tops/mongo.py | def top(**kwargs):
'''
Connect to a mongo database and read per-node tops data.
Parameters:
* `collection`: The mongodb collection to read data from. Defaults to
``'tops'``.
* `id_field`: The field in the collection that represents an individual
minion id. Defaults to ``... | def top(**kwargs):
'''
Connect to a mongo database and read per-node tops data.
Parameters:
* `collection`: The mongodb collection to read data from. Defaults to
``'tops'``.
* `id_field`: The field in the collection that represents an individual
minion id. Defaults to ``... | [
"Connect",
"to",
"a",
"mongo",
"database",
"and",
"read",
"per",
"-",
"node",
"tops",
"data",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/mongo.py#L75-L141 | [
"def",
"top",
"(",
"*",
"*",
"kwargs",
")",
":",
"host",
"=",
"__opts__",
"[",
"'mongo.host'",
"]",
"port",
"=",
"__opts__",
"[",
"'mongo.port'",
"]",
"collection",
"=",
"__opts__",
"[",
"'master_tops'",
"]",
"[",
"'mongo'",
"]",
".",
"get",
"(",
"'col... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | revdep_rebuild | Fix up broken reverse dependencies
lib
Search for reverse dependencies for a particular library rather
than every library on the system. It can be a full path to a
library or basic regular expression.
CLI Example:
.. code-block:: bash
salt '*' gentoolkit.revdep_rebuild | salt/modules/gentoolkitmod.py | def revdep_rebuild(lib=None):
'''
Fix up broken reverse dependencies
lib
Search for reverse dependencies for a particular library rather
than every library on the system. It can be a full path to a
library or basic regular expression.
CLI Example:
.. code-block:: bash
... | def revdep_rebuild(lib=None):
'''
Fix up broken reverse dependencies
lib
Search for reverse dependencies for a particular library rather
than every library on the system. It can be a full path to a
library or basic regular expression.
CLI Example:
.. code-block:: bash
... | [
"Fix",
"up",
"broken",
"reverse",
"dependencies"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L33-L51 | [
"def",
"revdep_rebuild",
"(",
"lib",
"=",
"None",
")",
":",
"cmd",
"=",
"'revdep-rebuild -i --quiet --no-progress'",
"if",
"lib",
"is",
"not",
"None",
":",
"cmd",
"+=",
"' --library={0}'",
".",
"format",
"(",
"lib",
")",
"return",
"__salt__",
"[",
"'cmd.retcod... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _pretty_size | Print sizes in a similar fashion as eclean | salt/modules/gentoolkitmod.py | def _pretty_size(size):
'''
Print sizes in a similar fashion as eclean
'''
units = [' G', ' M', ' K', ' B']
while units and size >= 1000:
size = size / 1024.0
units.pop()
return '{0}{1}'.format(round(size, 1), units[-1]) | def _pretty_size(size):
'''
Print sizes in a similar fashion as eclean
'''
units = [' G', ' M', ' K', ' B']
while units and size >= 1000:
size = size / 1024.0
units.pop()
return '{0}{1}'.format(round(size, 1), units[-1]) | [
"Print",
"sizes",
"in",
"a",
"similar",
"fashion",
"as",
"eclean"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L54-L62 | [
"def",
"_pretty_size",
"(",
"size",
")",
":",
"units",
"=",
"[",
"' G'",
",",
"' M'",
",",
"' K'",
",",
"' B'",
"]",
"while",
"units",
"and",
"size",
">=",
"1000",
":",
"size",
"=",
"size",
"/",
"1024.0",
"units",
".",
"pop",
"(",
")",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_exclude | Parse an exclude file.
Returns a dict as defined in gentoolkit.eclean.exclude.parseExcludeFile | salt/modules/gentoolkitmod.py | def _parse_exclude(exclude_file):
'''
Parse an exclude file.
Returns a dict as defined in gentoolkit.eclean.exclude.parseExcludeFile
'''
if os.path.isfile(exclude_file):
exclude = excludemod.parseExcludeFile(exclude_file, lambda x: None)
else:
exclude = dict()
return exclude | def _parse_exclude(exclude_file):
'''
Parse an exclude file.
Returns a dict as defined in gentoolkit.eclean.exclude.parseExcludeFile
'''
if os.path.isfile(exclude_file):
exclude = excludemod.parseExcludeFile(exclude_file, lambda x: None)
else:
exclude = dict()
return exclude | [
"Parse",
"an",
"exclude",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L65-L75 | [
"def",
"_parse_exclude",
"(",
"exclude_file",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"exclude_file",
")",
":",
"exclude",
"=",
"excludemod",
".",
"parseExcludeFile",
"(",
"exclude_file",
",",
"lambda",
"x",
":",
"None",
")",
"else",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | eclean_dist | Clean obsolete portage sources
destructive
Only keep minimum for reinstallation
package_names
Protect all versions of installed packages. Only meaningful if used
with destructive=True
size_limit <size>
Don't delete distfiles bigger than <size>.
<size> is a size spe... | salt/modules/gentoolkitmod.py | def eclean_dist(destructive=False, package_names=False, size_limit=0,
time_limit=0, fetch_restricted=False,
exclude_file='/etc/eclean/distfiles.exclude'):
'''
Clean obsolete portage sources
destructive
Only keep minimum for reinstallation
package_names
P... | def eclean_dist(destructive=False, package_names=False, size_limit=0,
time_limit=0, fetch_restricted=False,
exclude_file='/etc/eclean/distfiles.exclude'):
'''
Clean obsolete portage sources
destructive
Only keep minimum for reinstallation
package_names
P... | [
"Clean",
"obsolete",
"portage",
"sources"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L78-L159 | [
"def",
"eclean_dist",
"(",
"destructive",
"=",
"False",
",",
"package_names",
"=",
"False",
",",
"size_limit",
"=",
"0",
",",
"time_limit",
"=",
"0",
",",
"fetch_restricted",
"=",
"False",
",",
"exclude_file",
"=",
"'/etc/eclean/distfiles.exclude'",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | eclean_pkg | Clean obsolete binary packages
destructive
Only keep minimum for reinstallation
package_names
Protect all versions of installed packages. Only meaningful if used
with destructive=True
time_limit <time>
Don't delete distfiles files modified since <time>
<time> is an... | salt/modules/gentoolkitmod.py | def eclean_pkg(destructive=False, package_names=False, time_limit=0,
exclude_file='/etc/eclean/packages.exclude'):
'''
Clean obsolete binary packages
destructive
Only keep minimum for reinstallation
package_names
Protect all versions of installed packages. Only meaningfu... | def eclean_pkg(destructive=False, package_names=False, time_limit=0,
exclude_file='/etc/eclean/packages.exclude'):
'''
Clean obsolete binary packages
destructive
Only keep minimum for reinstallation
package_names
Protect all versions of installed packages. Only meaningfu... | [
"Clean",
"obsolete",
"binary",
"packages"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L162-L230 | [
"def",
"eclean_pkg",
"(",
"destructive",
"=",
"False",
",",
"package_names",
"=",
"False",
",",
"time_limit",
"=",
"0",
",",
"exclude_file",
"=",
"'/etc/eclean/packages.exclude'",
")",
":",
"if",
"exclude_file",
"is",
"None",
":",
"exclude",
"=",
"None",
"else... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _glsa_list_process_output | Process output from glsa_check_list into a dict
Returns a dict containing the glsa id, description, status, and CVEs | salt/modules/gentoolkitmod.py | def _glsa_list_process_output(output):
'''
Process output from glsa_check_list into a dict
Returns a dict containing the glsa id, description, status, and CVEs
'''
ret = dict()
for line in output:
try:
glsa_id, status, desc = line.split(None, 2)
if 'U' in status:... | def _glsa_list_process_output(output):
'''
Process output from glsa_check_list into a dict
Returns a dict containing the glsa id, description, status, and CVEs
'''
ret = dict()
for line in output:
try:
glsa_id, status, desc = line.split(None, 2)
if 'U' in status:... | [
"Process",
"output",
"from",
"glsa_check_list",
"into",
"a",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L233-L258 | [
"def",
"_glsa_list_process_output",
"(",
"output",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"for",
"line",
"in",
"output",
":",
"try",
":",
"glsa_id",
",",
"status",
",",
"desc",
"=",
"line",
".",
"split",
"(",
"None",
",",
"2",
")",
"if",
"'U'",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | glsa_check_list | List the status of Gentoo Linux Security Advisories
glsa_list
can contain an arbitrary number of GLSA ids, filenames
containing GLSAs or the special identifiers 'all' and 'affected'
Returns a dict containing glsa ids with a description, status, and CVEs:
.. code-block:: python
... | salt/modules/gentoolkitmod.py | def glsa_check_list(glsa_list):
'''
List the status of Gentoo Linux Security Advisories
glsa_list
can contain an arbitrary number of GLSA ids, filenames
containing GLSAs or the special identifiers 'all' and 'affected'
Returns a dict containing glsa ids with a description, status, and... | def glsa_check_list(glsa_list):
'''
List the status of Gentoo Linux Security Advisories
glsa_list
can contain an arbitrary number of GLSA ids, filenames
containing GLSAs or the special identifiers 'all' and 'affected'
Returns a dict containing glsa ids with a description, status, and... | [
"List",
"the",
"status",
"of",
"Gentoo",
"Linux",
"Security",
"Advisories"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L261-L293 | [
"def",
"glsa_check_list",
"(",
"glsa_list",
")",
":",
"cmd",
"=",
"'glsa-check --quiet --nocolor --cve --list '",
"if",
"isinstance",
"(",
"glsa_list",
",",
"list",
")",
":",
"for",
"glsa",
"in",
"glsa_list",
":",
"cmd",
"+=",
"glsa",
"+",
"' '",
"elif",
"glsa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | summary | Display a summary from monit
CLI Example:
.. code-block:: bash
salt '*' monit.summary
salt '*' monit.summary <service name> | salt/modules/monit.py | def summary(svc_name=''):
'''
Display a summary from monit
CLI Example:
.. code-block:: bash
salt '*' monit.summary
salt '*' monit.summary <service name>
'''
ret = {}
cmd = 'monit summary'
res = __salt__['cmd.run'](cmd).splitlines()
for line in res:
if 'dae... | def summary(svc_name=''):
'''
Display a summary from monit
CLI Example:
.. code-block:: bash
salt '*' monit.summary
salt '*' monit.summary <service name>
'''
ret = {}
cmd = 'monit summary'
res = __salt__['cmd.run'](cmd).splitlines()
for line in res:
if 'dae... | [
"Display",
"a",
"summary",
"from",
"monit"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L102-L132 | [
"def",
"summary",
"(",
"svc_name",
"=",
"''",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'monit summary'",
"res",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"res",
":",
"if",
"'daemo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Display a process status from monit
CLI Example:
.. code-block:: bash
salt '*' monit.status
salt '*' monit.status <service name> | salt/modules/monit.py | def status(svc_name=''):
'''
Display a process status from monit
CLI Example:
.. code-block:: bash
salt '*' monit.status
salt '*' monit.status <service name>
'''
cmd = 'monit status'
res = __salt__['cmd.run'](cmd)
prostr = 'Process'+' '*28
s = res.replace('Process'... | def status(svc_name=''):
'''
Display a process status from monit
CLI Example:
.. code-block:: bash
salt '*' monit.status
salt '*' monit.status <service name>
'''
cmd = 'monit status'
res = __salt__['cmd.run'](cmd)
prostr = 'Process'+' '*28
s = res.replace('Process'... | [
"Display",
"a",
"process",
"status",
"from",
"monit"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L135-L162 | [
"def",
"status",
"(",
"svc_name",
"=",
"''",
")",
":",
"cmd",
"=",
"'monit status'",
"res",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
"prostr",
"=",
"'Process'",
"+",
"' '",
"*",
"28",
"s",
"=",
"res",
".",
"replace",
"(",
"'Process'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | id_ | .. versionadded:: 2016.3.0
Return monit unique id.
reset : False
Reset current id and generate a new id when it's True.
CLI Example:
.. code-block:: bash
salt '*' monit.id [reset=True] | salt/modules/monit.py | def id_(reset=False):
'''
.. versionadded:: 2016.3.0
Return monit unique id.
reset : False
Reset current id and generate a new id when it's True.
CLI Example:
.. code-block:: bash
salt '*' monit.id [reset=True]
'''
if reset:
id_pattern = re.compile(r'Monit id... | def id_(reset=False):
'''
.. versionadded:: 2016.3.0
Return monit unique id.
reset : False
Reset current id and generate a new id when it's True.
CLI Example:
.. code-block:: bash
salt '*' monit.id [reset=True]
'''
if reset:
id_pattern = re.compile(r'Monit id... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L227-L252 | [
"def",
"id_",
"(",
"reset",
"=",
"False",
")",
":",
"if",
"reset",
":",
"id_pattern",
"=",
"re",
".",
"compile",
"(",
"r'Monit id (?P<id>[^ ]+)'",
")",
"cmd",
"=",
"'echo y|monit -r'",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | search_onfail_requisites | For a particular low chunk, search relevant onfail related states | salt/utils/state.py | def search_onfail_requisites(sid, highstate):
'''
For a particular low chunk, search relevant onfail related states
'''
onfails = []
if '_|-' in sid:
st = salt.state.split_low_tag(sid)
else:
st = {'__id__': sid}
for fstate, fchunks in six.iteritems(highstate):
if fsta... | def search_onfail_requisites(sid, highstate):
'''
For a particular low chunk, search relevant onfail related states
'''
onfails = []
if '_|-' in sid:
st = salt.state.split_low_tag(sid)
else:
st = {'__id__': sid}
for fstate, fchunks in six.iteritems(highstate):
if fsta... | [
"For",
"a",
"particular",
"low",
"chunk",
"search",
"relevant",
"onfail",
"related",
"states"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L27-L77 | [
"def",
"search_onfail_requisites",
"(",
"sid",
",",
"highstate",
")",
":",
"onfails",
"=",
"[",
"]",
"if",
"'_|-'",
"in",
"sid",
":",
"st",
"=",
"salt",
".",
"state",
".",
"split_low_tag",
"(",
"sid",
")",
"else",
":",
"st",
"=",
"{",
"'__id__'",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_onfail_requisites | When a state fail and is part of a highstate, check
if there is onfail requisites.
When we find onfail requisites, we will consider the state failed
only if at least one of those onfail requisites also failed
Returns:
True: if onfail handlers suceeded
False: if one on those handler fai... | salt/utils/state.py | def check_onfail_requisites(state_id, state_result, running, highstate):
'''
When a state fail and is part of a highstate, check
if there is onfail requisites.
When we find onfail requisites, we will consider the state failed
only if at least one of those onfail requisites also failed
Returns:
... | def check_onfail_requisites(state_id, state_result, running, highstate):
'''
When a state fail and is part of a highstate, check
if there is onfail requisites.
When we find onfail requisites, we will consider the state failed
only if at least one of those onfail requisites also failed
Returns:
... | [
"When",
"a",
"state",
"fail",
"and",
"is",
"part",
"of",
"a",
"highstate",
"check",
"if",
"there",
"is",
"onfail",
"requisites",
".",
"When",
"we",
"find",
"onfail",
"requisites",
"we",
"will",
"consider",
"the",
"state",
"failed",
"only",
"if",
"at",
"l... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L80-L123 | [
"def",
"check_onfail_requisites",
"(",
"state_id",
",",
"state_result",
",",
"running",
",",
"highstate",
")",
":",
"nret",
"=",
"None",
"if",
"(",
"state_id",
"and",
"state_result",
"and",
"highstate",
"and",
"isinstance",
"(",
"highstate",
",",
"dict",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_result | Check the total return value of the run and determine if the running
dict has any issues | salt/utils/state.py | def check_result(running, recurse=False, highstate=None):
'''
Check the total return value of the run and determine if the running
dict has any issues
'''
if not isinstance(running, dict):
return False
if not running:
return False
ret = True
for state_id, state_result i... | def check_result(running, recurse=False, highstate=None):
'''
Check the total return value of the run and determine if the running
dict has any issues
'''
if not isinstance(running, dict):
return False
if not running:
return False
ret = True
for state_id, state_result i... | [
"Check",
"the",
"total",
"return",
"value",
"of",
"the",
"run",
"and",
"determine",
"if",
"the",
"running",
"dict",
"has",
"any",
"issues"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L126-L161 | [
"def",
"check_result",
"(",
"running",
",",
"recurse",
"=",
"False",
",",
"highstate",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"running",
",",
"dict",
")",
":",
"return",
"False",
"if",
"not",
"running",
":",
"return",
"False",
"ret",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | merge_subreturn | Update an existing state return (`original_return`) in place
with another state return (`sub_return`), i.e. for a subresource.
Returns:
dict: The updated state return.
The existing state return does not need to have all the required fields,
as this is meant to be called from the internals of a... | salt/utils/state.py | def merge_subreturn(original_return, sub_return, subkey=None):
'''
Update an existing state return (`original_return`) in place
with another state return (`sub_return`), i.e. for a subresource.
Returns:
dict: The updated state return.
The existing state return does not need to have all the... | def merge_subreturn(original_return, sub_return, subkey=None):
'''
Update an existing state return (`original_return`) in place
with another state return (`sub_return`), i.e. for a subresource.
Returns:
dict: The updated state return.
The existing state return does not need to have all the... | [
"Update",
"an",
"existing",
"state",
"return",
"(",
"original_return",
")",
"in",
"place",
"with",
"another",
"state",
"return",
"(",
"sub_return",
")",
"i",
".",
"e",
".",
"for",
"a",
"subresource",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L164-L215 | [
"def",
"merge_subreturn",
"(",
"original_return",
",",
"sub_return",
",",
"subkey",
"=",
"None",
")",
":",
"if",
"not",
"subkey",
":",
"subkey",
"=",
"sub_return",
"[",
"'name'",
"]",
"if",
"sub_return",
"[",
"'result'",
"]",
"is",
"False",
":",
"# True or... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_sls_opts | Return a copy of the opts for use, optionally load a local config on top | salt/utils/state.py | def get_sls_opts(opts, **kwargs):
'''
Return a copy of the opts for use, optionally load a local config on top
'''
opts = copy.deepcopy(opts)
if 'localconfig' in kwargs:
return salt.config.minion_config(kwargs['localconfig'], defaults=opts)
if 'saltenv' in kwargs:
saltenv = kwa... | def get_sls_opts(opts, **kwargs):
'''
Return a copy of the opts for use, optionally load a local config on top
'''
opts = copy.deepcopy(opts)
if 'localconfig' in kwargs:
return salt.config.minion_config(kwargs['localconfig'], defaults=opts)
if 'saltenv' in kwargs:
saltenv = kwa... | [
"Return",
"a",
"copy",
"of",
"the",
"opts",
"for",
"use",
"optionally",
"load",
"a",
"local",
"config",
"on",
"top"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L218-L248 | [
"def",
"get_sls_opts",
"(",
"opts",
",",
"*",
"*",
"kwargs",
")",
":",
"opts",
"=",
"copy",
".",
"deepcopy",
"(",
"opts",
")",
"if",
"'localconfig'",
"in",
"kwargs",
":",
"return",
"salt",
".",
"config",
".",
"minion_config",
"(",
"kwargs",
"[",
"'loca... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_site_enabled | Checks to see if the specific site symlink is in /etc/apache2/sites-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_site_enabled example.com
salt '*' apache.check_site_enabled exampl... | salt/modules/deb_apache.py | def check_site_enabled(site):
'''
Checks to see if the specific site symlink is in /etc/apache2/sites-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_site_enabled example.com
... | def check_site_enabled(site):
'''
Checks to see if the specific site symlink is in /etc/apache2/sites-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_site_enabled example.com
... | [
"Checks",
"to",
"see",
"if",
"the",
"specific",
"site",
"symlink",
"is",
"in",
"/",
"etc",
"/",
"apache2",
"/",
"sites",
"-",
"enabled",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L49-L73 | [
"def",
"check_site_enabled",
"(",
"site",
")",
":",
"if",
"site",
".",
"endswith",
"(",
"'.conf'",
")",
":",
"site_file",
"=",
"site",
"else",
":",
"site_file",
"=",
"'{0}.conf'",
".",
"format",
"(",
"site",
")",
"if",
"os",
".",
"path",
".",
"islink",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | a2dissite | Runs a2dissite for the given site.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2dissite example.com | salt/modules/deb_apache.py | def a2dissite(site):
'''
Runs a2dissite for the given site.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2dissite example.com
'''
ret = {}
command = ['a2dissite', site]
try:
... | def a2dissite(site):
'''
Runs a2dissite for the given site.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2dissite example.com
'''
ret = {}
command = ['a2dissite', site]
try:
... | [
"Runs",
"a2dissite",
"for",
"the",
"given",
"site",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L110-L141 | [
"def",
"a2dissite",
"(",
"site",
")",
":",
"ret",
"=",
"{",
"}",
"command",
"=",
"[",
"'a2dissite'",
",",
"site",
"]",
"try",
":",
"status",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"command",
",",
"python_shell",
"=",
"False",
")",
"except",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_mod_enabled | Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
salt '*' apache.check_mod_enabled status.load
... | salt/modules/deb_apache.py | def check_mod_enabled(mod):
'''
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
salt '*' ... | def check_mod_enabled(mod):
'''
Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
salt '*' ... | [
"Checks",
"to",
"see",
"if",
"the",
"specific",
"mod",
"symlink",
"is",
"in",
"/",
"etc",
"/",
"apache2",
"/",
"mods",
"-",
"enabled",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L144-L163 | [
"def",
"check_mod_enabled",
"(",
"mod",
")",
":",
"if",
"mod",
".",
"endswith",
"(",
"'.load'",
")",
"or",
"mod",
".",
"endswith",
"(",
"'.conf'",
")",
":",
"mod_file",
"=",
"mod",
"else",
":",
"mod_file",
"=",
"'{0}.load'",
".",
"format",
"(",
"mod",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | a2enmod | Runs a2enmod for the given mod.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enmod vhost_alias | salt/modules/deb_apache.py | def a2enmod(mod):
'''
Runs a2enmod for the given mod.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enmod vhost_alias
'''
ret = {}
command = ['a2enmod', mod]
try:
statu... | def a2enmod(mod):
'''
Runs a2enmod for the given mod.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enmod vhost_alias
'''
ret = {}
command = ['a2enmod', mod]
try:
statu... | [
"Runs",
"a2enmod",
"for",
"the",
"given",
"mod",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L166-L197 | [
"def",
"a2enmod",
"(",
"mod",
")",
":",
"ret",
"=",
"{",
"}",
"command",
"=",
"[",
"'a2enmod'",
",",
"mod",
"]",
"try",
":",
"status",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"command",
",",
"python_shell",
"=",
"False",
")",
"except",
"Exce... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_conf_enabled | .. versionadded:: 2016.3.0
Checks to see if the specific conf symlink is in /etc/apache2/conf-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_conf_enabled security
salt '*' apac... | salt/modules/deb_apache.py | def check_conf_enabled(conf):
'''
.. versionadded:: 2016.3.0
Checks to see if the specific conf symlink is in /etc/apache2/conf-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_c... | def check_conf_enabled(conf):
'''
.. versionadded:: 2016.3.0
Checks to see if the specific conf symlink is in /etc/apache2/conf-enabled.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.check_c... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L234-L254 | [
"def",
"check_conf_enabled",
"(",
"conf",
")",
":",
"if",
"conf",
".",
"endswith",
"(",
"'.conf'",
")",
":",
"conf_file",
"=",
"conf",
"else",
":",
"conf_file",
"=",
"'{0}.conf'",
".",
"format",
"(",
"conf",
")",
"return",
"os",
".",
"path",
".",
"isli... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | a2enconf | .. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security | salt/modules/deb_apache.py | def a2enconf(conf):
'''
.. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security
'''
ret = {}
command = ['a2en... | def a2enconf(conf):
'''
.. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security
'''
ret = {}
command = ['a2en... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L258-L291 | [
"def",
"a2enconf",
"(",
"conf",
")",
":",
"ret",
"=",
"{",
"}",
"command",
"=",
"[",
"'a2enconf'",
",",
"conf",
"]",
"try",
":",
"status",
"=",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"command",
",",
"python_shell",
"=",
"False",
")",
"except",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stats | Return the data from `uwsgi --connect-and-read` as a dictionary.
socket
The socket the uWSGI stats server is listening on
CLI Example:
.. code-block:: bash
salt '*' uwsgi.stats /var/run/mystatsserver.sock
salt '*' uwsgi.stats 127.0.0.1:5050 | salt/modules/uwsgi.py | def stats(socket):
'''
Return the data from `uwsgi --connect-and-read` as a dictionary.
socket
The socket the uWSGI stats server is listening on
CLI Example:
.. code-block:: bash
salt '*' uwsgi.stats /var/run/mystatsserver.sock
salt '*' uwsgi.stats 127.0.0.1:5050
'''... | def stats(socket):
'''
Return the data from `uwsgi --connect-and-read` as a dictionary.
socket
The socket the uWSGI stats server is listening on
CLI Example:
.. code-block:: bash
salt '*' uwsgi.stats /var/run/mystatsserver.sock
salt '*' uwsgi.stats 127.0.0.1:5050
'''... | [
"Return",
"the",
"data",
"from",
"uwsgi",
"--",
"connect",
"-",
"and",
"-",
"read",
"as",
"a",
"dictionary",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uwsgi.py#L27-L45 | [
"def",
"stats",
"(",
"socket",
")",
":",
"cmd",
"=",
"[",
"'uwsgi'",
",",
"'--connect-and-read'",
",",
"'{0}'",
".",
"format",
"(",
"socket",
")",
"]",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_credentials | Cycle through all the possible credentials and return the first one that
works | salt/grains/fx2.py | def _find_credentials():
'''
Cycle through all the possible credentials and return the first one that
works
'''
usernames = []
usernames.append(__pillar__['proxy'].get('admin_username', 'root'))
if 'fallback_admin_username' in __pillar__.get('proxy'):
usernames.append(__pillar__['pro... | def _find_credentials():
'''
Cycle through all the possible credentials and return the first one that
works
'''
usernames = []
usernames.append(__pillar__['proxy'].get('admin_username', 'root'))
if 'fallback_admin_username' in __pillar__.get('proxy'):
usernames.append(__pillar__['pro... | [
"Cycle",
"through",
"all",
"the",
"possible",
"credentials",
"and",
"return",
"the",
"first",
"one",
"that",
"works"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L32-L62 | [
"def",
"_find_credentials",
"(",
")",
":",
"usernames",
"=",
"[",
"]",
"usernames",
".",
"append",
"(",
"__pillar__",
"[",
"'proxy'",
"]",
".",
"get",
"(",
"'admin_username'",
",",
"'root'",
")",
")",
"if",
"'fallback_admin_username'",
"in",
"__pillar__",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _grains | Get the grains from the proxied device | salt/grains/fx2.py | def _grains():
'''
Get the grains from the proxied device
'''
(username, password) = _find_credentials()
r = salt.modules.dracr.system_info(host=__pillar__['proxy']['host'],
admin_username=username,
admin_password=password... | def _grains():
'''
Get the grains from the proxied device
'''
(username, password) = _find_credentials()
r = salt.modules.dracr.system_info(host=__pillar__['proxy']['host'],
admin_username=username,
admin_password=password... | [
"Get",
"the",
"grains",
"from",
"the",
"proxied",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L65-L83 | [
"def",
"_grains",
"(",
")",
":",
"(",
"username",
",",
"password",
")",
"=",
"_find_credentials",
"(",
")",
"r",
"=",
"salt",
".",
"modules",
".",
"dracr",
".",
"system_info",
"(",
"host",
"=",
"__pillar__",
"[",
"'proxy'",
"]",
"[",
"'host'",
"]",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_containers | Return a list of containers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_containers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_storage.list_containers prof... | salt/modules/libcloud_storage.py | def list_containers(profile, **libcloud_kwargs):
'''
Return a list of containers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_containers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash... | def list_containers(profile, **libcloud_kwargs):
'''
Return a list of containers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_containers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash... | [
"Return",
"a",
"list",
"of",
"containers",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L88-L113 | [
"def",
"list_containers",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_container_objects | List container objects (e.g. files) for the given container_id on the given profile
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_container_objects method
... | salt/modules/libcloud_storage.py | def list_container_objects(container_name, profile, **libcloud_kwargs):
'''
List container objects (e.g. files) for the given container_id on the given profile
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:par... | def list_container_objects(container_name, profile, **libcloud_kwargs):
'''
List container objects (e.g. files) for the given container_id on the given profile
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:par... | [
"List",
"container",
"objects",
"(",
"e",
".",
"g",
".",
"files",
")",
"for",
"the",
"given",
"container_id",
"on",
"the",
"given",
"profile"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L116-L149 | [
"def",
"list_container_objects",
"(",
"container_name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"container",
"=",
"conn",
".",
"get_container",
"(",
"container_name",
")",
"li... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_container | Create a container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's create_container method
:type libcloud_kwargs: ``dict``
CLI Example:
... | salt/modules/libcloud_storage.py | def create_container(container_name, profile, **libcloud_kwargs):
'''
Create a container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's creat... | def create_container(container_name, profile, **libcloud_kwargs):
'''
Create a container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's creat... | [
"Create",
"a",
"container",
"in",
"the",
"cloud"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L152-L177 | [
"def",
"create_container",
"(",
"container_name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_container_object | Get the details for a container object (file or object in the cloud)
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra argu... | salt/modules/libcloud_storage.py | def get_container_object(container_name, object_name, profile, **libcloud_kwargs):
'''
Get the details for a container object (file or object in the cloud)
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:par... | def get_container_object(container_name, object_name, profile, **libcloud_kwargs):
'''
Get the details for a container object (file or object in the cloud)
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:par... | [
"Get",
"the",
"details",
"for",
"a",
"container",
"object",
"(",
"file",
"or",
"object",
"in",
"the",
"cloud",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L208-L239 | [
"def",
"get_container_object",
"(",
"container_name",
",",
"object_name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | download_object | Download an object to the specified destination path.
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:param destination_path: Full path to a file or a directory where the
incoming fil... | salt/modules/libcloud_storage.py | def download_object(container_name, object_name, destination_path, profile,
overwrite_existing=False, delete_on_failure=True, **libcloud_kwargs):
'''
Download an object to the specified destination path.
:param container_name: Container name
:type container_name: ``str``
:para... | def download_object(container_name, object_name, destination_path, profile,
overwrite_existing=False, delete_on_failure=True, **libcloud_kwargs):
'''
Download an object to the specified destination path.
:param container_name: Container name
:type container_name: ``str``
:para... | [
"Download",
"an",
"object",
"to",
"the",
"specified",
"destination",
"path",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L242-L286 | [
"def",
"download_object",
"(",
"container_name",
",",
"object_name",
",",
"destination_path",
",",
"profile",
",",
"overwrite_existing",
"=",
"False",
",",
"delete_on_failure",
"=",
"True",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upload_object | Upload an object currently located on a disk.
:param file_path: Path to the object on disk.
:type file_path: ``str``
:param container_name: Destination container.
:type container_name: ``str``
:param object_name: Object name.
:type object_name: ``str``
:param profile: The profile key
... | salt/modules/libcloud_storage.py | def upload_object(file_path, container_name, object_name, profile, extra=None,
verify_hash=True, headers=None, **libcloud_kwargs):
'''
Upload an object currently located on a disk.
:param file_path: Path to the object on disk.
:type file_path: ``str``
:param container_name: Desti... | def upload_object(file_path, container_name, object_name, profile, extra=None,
verify_hash=True, headers=None, **libcloud_kwargs):
'''
Upload an object currently located on a disk.
:param file_path: Path to the object on disk.
:type file_path: ``str``
:param container_name: Desti... | [
"Upload",
"an",
"object",
"currently",
"located",
"on",
"a",
"disk",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L289-L334 | [
"def",
"upload_object",
"(",
"file_path",
",",
"container_name",
",",
"object_name",
",",
"profile",
",",
"extra",
"=",
"None",
",",
"verify_hash",
"=",
"True",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_dri... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_object | Delete an object in the cloud
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_object me... | salt/modules/libcloud_storage.py | def delete_object(container_name, object_name, profile, **libcloud_kwargs):
'''
Delete an object in the cloud
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:param profile: The profile key
:type profile... | def delete_object(container_name, object_name, profile, **libcloud_kwargs):
'''
Delete an object in the cloud
:param container_name: Container name
:type container_name: ``str``
:param object_name: Object name
:type object_name: ``str``
:param profile: The profile key
:type profile... | [
"Delete",
"an",
"object",
"in",
"the",
"cloud"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L337-L366 | [
"def",
"delete_object",
"(",
"container_name",
",",
"object_name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_container | Delete an object container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_container method
:type libcloud_kwargs: ``dict``
:return: ... | salt/modules/libcloud_storage.py | def delete_container(container_name, profile, **libcloud_kwargs):
'''
Delete an object container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver... | def delete_container(container_name, profile, **libcloud_kwargs):
'''
Delete an object container in the cloud
:param container_name: Container name
:type container_name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver... | [
"Delete",
"an",
"object",
"container",
"in",
"the",
"cloud"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L369-L395 | [
"def",
"delete_container",
"(",
"container_name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_token_and_url_from_master | Get a token with correct policies for the minion, and the url to the Vault
service | salt/utils/vault.py | def _get_token_and_url_from_master():
'''
Get a token with correct policies for the minion, and the url to the Vault
service
'''
minion_id = __grains__['id']
pki_dir = __opts__['pki_dir']
# When rendering pillars, the module executes on the master, but the token
# should be issued for t... | def _get_token_and_url_from_master():
'''
Get a token with correct policies for the minion, and the url to the Vault
service
'''
minion_id = __grains__['id']
pki_dir = __opts__['pki_dir']
# When rendering pillars, the module executes on the master, but the token
# should be issued for t... | [
"Get",
"a",
"token",
"with",
"correct",
"policies",
"for",
"the",
"minion",
"and",
"the",
"url",
"to",
"the",
"Vault",
"service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L39-L92 | [
"def",
"_get_token_and_url_from_master",
"(",
")",
":",
"minion_id",
"=",
"__grains__",
"[",
"'id'",
"]",
"pki_dir",
"=",
"__opts__",
"[",
"'pki_dir'",
"]",
"# When rendering pillars, the module executes on the master, but the token",
"# should be issued for the minion, so that t... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_vault_connection | Get the connection details for calling Vault, from local configuration if
it exists, or from the master otherwise | salt/utils/vault.py | def get_vault_connection():
'''
Get the connection details for calling Vault, from local configuration if
it exists, or from the master otherwise
'''
def _use_local_config():
log.debug('Using Vault connection details from local config')
try:
if __opts__['vault']['auth']['... | def get_vault_connection():
'''
Get the connection details for calling Vault, from local configuration if
it exists, or from the master otherwise
'''
def _use_local_config():
log.debug('Using Vault connection details from local config')
try:
if __opts__['vault']['auth']['... | [
"Get",
"the",
"connection",
"details",
"for",
"calling",
"Vault",
"from",
"local",
"configuration",
"if",
"it",
"exists",
"or",
"from",
"the",
"master",
"otherwise"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L95-L146 | [
"def",
"get_vault_connection",
"(",
")",
":",
"def",
"_use_local_config",
"(",
")",
":",
"log",
".",
"debug",
"(",
"'Using Vault connection details from local config'",
")",
"try",
":",
"if",
"__opts__",
"[",
"'vault'",
"]",
"[",
"'auth'",
"]",
"[",
"'method'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | make_request | Make a request to Vault | salt/utils/vault.py | def make_request(method, resource, token=None, vault_url=None, get_token_url=False, **args):
'''
Make a request to Vault
'''
if not token or not vault_url:
connection = get_vault_connection()
token, vault_url = connection['token'], connection['url']
if 'verify' not in args:
... | def make_request(method, resource, token=None, vault_url=None, get_token_url=False, **args):
'''
Make a request to Vault
'''
if not token or not vault_url:
connection = get_vault_connection()
token, vault_url = connection['token'], connection['url']
if 'verify' not in args:
... | [
"Make",
"a",
"request",
"to",
"Vault"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L149-L166 | [
"def",
"make_request",
"(",
"method",
",",
"resource",
",",
"token",
"=",
"None",
",",
"vault_url",
"=",
"None",
",",
"get_token_url",
"=",
"False",
",",
"*",
"*",
"args",
")",
":",
"if",
"not",
"token",
"or",
"not",
"vault_url",
":",
"connection",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | loadavg | Return the current load average for the specified minion. Available values
for name are `1-min`, `5-min` and `15-min`. `minimum` and `maximum` values
should be passed in as strings. | salt/states/status.py | def loadavg(name, maximum=None, minimum=None):
'''
Return the current load average for the specified minion. Available values
for name are `1-min`, `5-min` and `15-min`. `minimum` and `maximum` values
should be passed in as strings.
'''
# Monitoring state, no changes will be made so no test inte... | def loadavg(name, maximum=None, minimum=None):
'''
Return the current load average for the specified minion. Available values
for name are `1-min`, `5-min` and `15-min`. `minimum` and `maximum` values
should be passed in as strings.
'''
# Monitoring state, no changes will be made so no test inte... | [
"Return",
"the",
"current",
"load",
"average",
"for",
"the",
"specified",
"minion",
".",
"Available",
"values",
"for",
"name",
"are",
"1",
"-",
"min",
"5",
"-",
"min",
"and",
"15",
"-",
"min",
".",
"minimum",
"and",
"maximum",
"values",
"should",
"be",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L15-L53 | [
"def",
"loadavg",
"(",
"name",
",",
"maximum",
"=",
"None",
",",
"minimum",
"=",
"None",
")",
":",
"# Monitoring state, no changes will be made so no test interface needed",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | process | Return whether the specified signature is found in the process tree. This
differs slightly from the services states, in that it may refer to a
process that is not managed via the init system. | salt/states/status.py | def process(name):
'''
Return whether the specified signature is found in the process tree. This
differs slightly from the services states, in that it may refer to a
process that is not managed via the init system.
'''
# Monitoring state, no changes will be made so no test interface needed
r... | def process(name):
'''
Return whether the specified signature is found in the process tree. This
differs slightly from the services states, in that it may refer to a
process that is not managed via the init system.
'''
# Monitoring state, no changes will be made so no test interface needed
r... | [
"Return",
"whether",
"the",
"specified",
"signature",
"is",
"found",
"in",
"the",
"process",
"tree",
".",
"This",
"differs",
"slightly",
"from",
"the",
"services",
"states",
"in",
"that",
"it",
"may",
"refer",
"to",
"a",
"process",
"that",
"is",
"not",
"ma... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L56-L81 | [
"def",
"process",
"(",
"name",
")",
":",
"# Monitoring state, no changes will be made so no test interface needed",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
",",
"'data'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tuned | Manage options of block device
name
The name of the block device
opts:
- read-ahead
Read-ahead buffer size
- filesystem-read-ahead
Filesystem Read-ahead buffer size
- read-only
Set Read-Only
- read-write
Set Read-Write | salt/states/blockdev.py | def tuned(name, **kwargs):
'''
Manage options of block device
name
The name of the block device
opts:
- read-ahead
Read-ahead buffer size
- filesystem-read-ahead
Filesystem Read-ahead buffer size
- read-only
Set Read-Only
- read-write
... | def tuned(name, **kwargs):
'''
Manage options of block device
name
The name of the block device
opts:
- read-ahead
Read-ahead buffer size
- filesystem-read-ahead
Filesystem Read-ahead buffer size
- read-only
Set Read-Only
- read-write
... | [
"Manage",
"options",
"of",
"block",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L51-L117 | [
"def",
"tuned",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
"}",
"kwarg_map",
"=",
"{",
"'read-ahead'",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | formatted | Manage filesystems of partitions.
name
The name of the block device
fs_type
The filesystem it should be formatted as
force
Force mke2fs to create a filesystem, even if the specified device is
not a partition on a block special device. This option is only enabled
fo... | salt/states/blockdev.py | def formatted(name, fs_type='ext4', force=False, **kwargs):
'''
Manage filesystems of partitions.
name
The name of the block device
fs_type
The filesystem it should be formatted as
force
Force mke2fs to create a filesystem, even if the specified device is
not a par... | def formatted(name, fs_type='ext4', force=False, **kwargs):
'''
Manage filesystems of partitions.
name
The name of the block device
fs_type
The filesystem it should be formatted as
force
Force mke2fs to create a filesystem, even if the specified device is
not a par... | [
"Manage",
"filesystems",
"of",
"partitions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L120-L188 | [
"def",
"formatted",
"(",
"name",
",",
"fs_type",
"=",
"'ext4'",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"'{0} already formatted with {1}'",
".",
"format",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _checkblk | Check if the blk exists and return its fstype if ok | salt/states/blockdev.py | def _checkblk(name):
'''
Check if the blk exists and return its fstype if ok
'''
blk = __salt__['cmd.run']('blkid -o value -s TYPE {0}'.format(name),
ignore_retcode=True)
return '' if not blk else blk | def _checkblk(name):
'''
Check if the blk exists and return its fstype if ok
'''
blk = __salt__['cmd.run']('blkid -o value -s TYPE {0}'.format(name),
ignore_retcode=True)
return '' if not blk else blk | [
"Check",
"if",
"the",
"blk",
"exists",
"and",
"return",
"its",
"fstype",
"if",
"ok"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L191-L198 | [
"def",
"_checkblk",
"(",
"name",
")",
":",
"blk",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'blkid -o value -s TYPE {0}'",
".",
"format",
"(",
"name",
")",
",",
"ignore_retcode",
"=",
"True",
")",
"return",
"''",
"if",
"not",
"blk",
"else",
"blk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_config | Removes a configuration element from the SNMP configuration.
:param chassis_id: (optional) Chassis ID
:param community: (optional) A dictionary having the following optional keys:
- acl (if any policy / ACL need to be set)
- mode: rw or ro. Default: ro
:param contact: Contact details
:param... | salt/modules/napalm_snmp.py | def remove_config(chassis_id=None,
community=None,
contact=None,
location=None,
test=False,
commit=True,
**kwargs): # pylint: disable=unused-argument
'''
Removes a configuration element from the SNMP co... | def remove_config(chassis_id=None,
community=None,
contact=None,
location=None,
test=False,
commit=True,
**kwargs): # pylint: disable=unused-argument
'''
Removes a configuration element from the SNMP co... | [
"Removes",
"a",
"configuration",
"element",
"from",
"the",
"SNMP",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_snmp.py#L84-L149 | [
"def",
"remove_config",
"(",
"chassis_id",
"=",
"None",
",",
"community",
"=",
"None",
",",
"contact",
"=",
"None",
",",
"location",
"=",
"None",
",",
"test",
"=",
"False",
",",
"commit",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disab... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | keygen | Use libnacl to generate a keypair.
If no `sk_file` is defined return a keypair.
If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`.
When the `sk_file` is already existing, but `pk_file` is not. The `pk_file` will be generated
using the `sk_file`.
CLI Examples... | salt/modules/nacl.py | def keygen(sk_file=None, pk_file=None, **kwargs):
'''
Use libnacl to generate a keypair.
If no `sk_file` is defined return a keypair.
If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`.
When the `sk_file` is already existing, but `pk_file` is not. The `pk_file... | def keygen(sk_file=None, pk_file=None, **kwargs):
'''
Use libnacl to generate a keypair.
If no `sk_file` is defined return a keypair.
If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`.
When the `sk_file` is already existing, but `pk_file` is not. The `pk_file... | [
"Use",
"libnacl",
"to",
"generate",
"a",
"keypair",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L166-L187 | [
"def",
"keygen",
"(",
"sk_file",
"=",
"None",
",",
"pk_file",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"keygen",
"(",
"sk_file",
",",
"pk_file",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enc | Alias to `{box_type}_encrypt`
box_type: secretbox, sealedbox(default) | salt/modules/nacl.py | def enc(data, **kwargs):
'''
Alias to `{box_type}_encrypt`
box_type: secretbox, sealedbox(default)
'''
kwargs['opts'] = __opts__
return salt.utils.nacl.enc(data, **kwargs) | def enc(data, **kwargs):
'''
Alias to `{box_type}_encrypt`
box_type: secretbox, sealedbox(default)
'''
kwargs['opts'] = __opts__
return salt.utils.nacl.enc(data, **kwargs) | [
"Alias",
"to",
"{",
"box_type",
"}",
"_encrypt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L190-L197 | [
"def",
"enc",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"enc",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enc_file | This is a helper function to encrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-block:: bash
salt-run nacl.enc_file name=/tmp/i... | salt/modules/nacl.py | def enc_file(name, out=None, **kwargs):
'''
This is a helper function to encrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-bloc... | def enc_file(name, out=None, **kwargs):
'''
This is a helper function to encrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-bloc... | [
"This",
"is",
"a",
"helper",
"function",
"to",
"encrypt",
"a",
"file",
"and",
"return",
"its",
"contents",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L200-L218 | [
"def",
"enc_file",
"(",
"name",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"enc_file",
"(",
"name",
",",
"out",
",",
"*",
"*",
"kwar... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | dec | Alias to `{box_type}_decrypt`
box_type: secretbox, sealedbox(default) | salt/modules/nacl.py | def dec(data, **kwargs):
'''
Alias to `{box_type}_decrypt`
box_type: secretbox, sealedbox(default)
'''
kwargs['opts'] = __opts__
return salt.utils.nacl.dec(data, **kwargs) | def dec(data, **kwargs):
'''
Alias to `{box_type}_decrypt`
box_type: secretbox, sealedbox(default)
'''
kwargs['opts'] = __opts__
return salt.utils.nacl.dec(data, **kwargs) | [
"Alias",
"to",
"{",
"box_type",
"}",
"_decrypt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L221-L228 | [
"def",
"dec",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"dec",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | dec_file | This is a helper function to decrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-block:: bash
salt-run nacl.dec_file name=/tmp/i... | salt/modules/nacl.py | def dec_file(name, out=None, **kwargs):
'''
This is a helper function to decrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-bloc... | def dec_file(name, out=None, **kwargs):
'''
This is a helper function to decrypt a file and return its contents.
You can provide an optional output file using `out`
`name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.
CLI Examples:
.. code-bloc... | [
"This",
"is",
"a",
"helper",
"function",
"to",
"decrypt",
"a",
"file",
"and",
"return",
"its",
"contents",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L231-L249 | [
"def",
"dec_file",
"(",
"name",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"dec_file",
"(",
"name",
",",
"out",
",",
"*",
"*",
"kwar... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sealedbox_encrypt | Encrypt data using a public key generated from `nacl.keygen`.
The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key.
CLI Examples:
.. code-block:: bash
salt-run nacl.sealedbox_encrypt datatoenc
salt-call --local nacl.sealedbox_encrypt datatoenc pk_file... | salt/modules/nacl.py | def sealedbox_encrypt(data, **kwargs):
'''
Encrypt data using a public key generated from `nacl.keygen`.
The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key.
CLI Examples:
.. code-block:: bash
salt-run nacl.sealedbox_encrypt datatoenc
salt-ca... | def sealedbox_encrypt(data, **kwargs):
'''
Encrypt data using a public key generated from `nacl.keygen`.
The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key.
CLI Examples:
.. code-block:: bash
salt-run nacl.sealedbox_encrypt datatoenc
salt-ca... | [
"Encrypt",
"data",
"using",
"a",
"public",
"key",
"generated",
"from",
"nacl",
".",
"keygen",
".",
"The",
"encryptd",
"data",
"can",
"be",
"decrypted",
"using",
"nacl",
".",
"sealedbox_decrypt",
"only",
"with",
"the",
"secret",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L252-L266 | [
"def",
"sealedbox_encrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"sealedbox_encrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sealedbox_decrypt | Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`.
CLI Examples:
.. code-block:: bash
salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF7A=' sk_file=/etc/salt/pki/master/nacl
salt... | salt/modules/nacl.py | def sealedbox_decrypt(data, **kwargs):
'''
Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`.
CLI Examples:
.. code-block:: bash
salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF... | def sealedbox_decrypt(data, **kwargs):
'''
Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`.
CLI Examples:
.. code-block:: bash
salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF... | [
"Decrypt",
"data",
"using",
"a",
"secret",
"key",
"that",
"was",
"encrypted",
"using",
"a",
"public",
"key",
"with",
"nacl",
".",
"sealedbox_encrypt",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L269-L282 | [
"def",
"sealedbox_decrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"sealedbox_decrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | secretbox_encrypt | Encrypt data using a secret key generated from `nacl.keygen`.
The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`.
CLI Examples:
.. code-block:: bash
salt-run nacl.secretbox_encrypt datatoenc
salt-call --local nacl.secretbox_encrypt datatoenc sk_file=/etc/sa... | salt/modules/nacl.py | def secretbox_encrypt(data, **kwargs):
'''
Encrypt data using a secret key generated from `nacl.keygen`.
The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`.
CLI Examples:
.. code-block:: bash
salt-run nacl.secretbox_encrypt datatoenc
salt-call --loc... | def secretbox_encrypt(data, **kwargs):
'''
Encrypt data using a secret key generated from `nacl.keygen`.
The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`.
CLI Examples:
.. code-block:: bash
salt-run nacl.secretbox_encrypt datatoenc
salt-call --loc... | [
"Encrypt",
"data",
"using",
"a",
"secret",
"key",
"generated",
"from",
"nacl",
".",
"keygen",
".",
"The",
"same",
"secret",
"key",
"can",
"be",
"used",
"to",
"decrypt",
"the",
"data",
"using",
"nacl",
".",
"secretbox_decrypt",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L285-L299 | [
"def",
"secretbox_encrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"secretbox_encrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | secretbox_decrypt | Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key
that was generated from `nacl.keygen`.
CLI Examples:
.. code-block:: bash
salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.secretbox_decrypt data='pEXHQM6cuaF7A=' sk_file=/etc/salt/pk... | salt/modules/nacl.py | def secretbox_decrypt(data, **kwargs):
'''
Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key
that was generated from `nacl.keygen`.
CLI Examples:
.. code-block:: bash
salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.secretbox... | def secretbox_decrypt(data, **kwargs):
'''
Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key
that was generated from `nacl.keygen`.
CLI Examples:
.. code-block:: bash
salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A=
salt-call --local nacl.secretbox... | [
"Decrypt",
"data",
"that",
"was",
"encrypted",
"using",
"nacl",
".",
"secretbox_encrypt",
"using",
"the",
"secret",
"key",
"that",
"was",
"generated",
"from",
"nacl",
".",
"keygen",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L302-L316 | [
"def",
"secretbox_decrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"return",
"salt",
".",
"utils",
".",
"nacl",
".",
"secretbox_decrypt",
"(",
"data",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_job_results | Executes a query that requires a job for completion. This function will wait for the job to complete
and return the results. | salt/modules/panos.py | def _get_job_results(query=None):
'''
Executes a query that requires a job for completion. This function will wait for the job to complete
and return the results.
'''
if not query:
raise CommandExecutionError("Query parameters cannot be empty.")
response = __proxy__['panos.call'](query)... | def _get_job_results(query=None):
'''
Executes a query that requires a job for completion. This function will wait for the job to complete
and return the results.
'''
if not query:
raise CommandExecutionError("Query parameters cannot be empty.")
response = __proxy__['panos.call'](query)... | [
"Executes",
"a",
"query",
"that",
"requires",
"a",
"job",
"for",
"completion",
".",
"This",
"function",
"will",
"wait",
"for",
"the",
"job",
"to",
"complete",
"and",
"return",
"the",
"results",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L60-L79 | [
"def",
"_get_job_results",
"(",
"query",
"=",
"None",
")",
":",
"if",
"not",
"query",
":",
"raise",
"CommandExecutionError",
"(",
"\"Query parameters cannot be empty.\"",
")",
"response",
"=",
"__proxy__",
"[",
"'panos.call'",
"]",
"(",
"query",
")",
"# If the res... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | deactivate_license | Deactivates an installed license.
Required version 7.0.0 or greater.
key_name(str): The file name of the license key installed.
CLI Example:
.. code-block:: bash
salt '*' panos.deactivate_license key_name=License_File_Name.key | salt/modules/panos.py | def deactivate_license(key_name=None):
'''
Deactivates an installed license.
Required version 7.0.0 or greater.
key_name(str): The file name of the license key installed.
CLI Example:
.. code-block:: bash
salt '*' panos.deactivate_license key_name=License_File_Name.key
'''
... | def deactivate_license(key_name=None):
'''
Deactivates an installed license.
Required version 7.0.0 or greater.
key_name(str): The file name of the license key installed.
CLI Example:
.. code-block:: bash
salt '*' panos.deactivate_license key_name=License_File_Name.key
'''
... | [
"Deactivates",
"an",
"installed",
"license",
".",
"Required",
"version",
"7",
".",
"0",
".",
"0",
"or",
"greater",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L162-L187 | [
"def",
"deactivate_license",
"(",
"key_name",
"=",
"None",
")",
":",
"_required_version",
"=",
"'7.0.0'",
"if",
"not",
"__proxy__",
"[",
"'panos.is_required_version'",
"]",
"(",
"_required_version",
")",
":",
"return",
"False",
",",
"'The panos device requires version... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | download_software_file | Download software packages by filename.
Args:
filename(str): The filename of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
salt '*' panos.download_software_file PanOS_5000-8.0.0
salt '*' pan... | salt/modules/panos.py | def download_software_file(filename=None, synch=False):
'''
Download software packages by filename.
Args:
filename(str): The filename of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
salt '*... | def download_software_file(filename=None, synch=False):
'''
Download software packages by filename.
Args:
filename(str): The filename of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
salt '*... | [
"Download",
"software",
"packages",
"by",
"filename",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L230-L262 | [
"def",
"download_software_file",
"(",
"filename",
"=",
"None",
",",
"synch",
"=",
"False",
")",
":",
"if",
"not",
"filename",
":",
"raise",
"CommandExecutionError",
"(",
"\"Filename option must not be none.\"",
")",
"if",
"not",
"isinstance",
"(",
"synch",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | download_software_version | Download software packages by version number.
Args:
version(str): The version of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
salt '*' panos.download_software_version 8.0.0
salt '*' panos.d... | salt/modules/panos.py | def download_software_version(version=None, synch=False):
'''
Download software packages by version number.
Args:
version(str): The version of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
s... | def download_software_version(version=None, synch=False):
'''
Download software packages by version number.
Args:
version(str): The version of the PANOS file to download.
synch (bool): If true then the file will synch to the peer unit.
CLI Example:
.. code-block:: bash
s... | [
"Download",
"software",
"packages",
"by",
"version",
"number",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L265-L297 | [
"def",
"download_software_version",
"(",
"version",
"=",
"None",
",",
"synch",
"=",
"False",
")",
":",
"if",
"not",
"version",
":",
"raise",
"CommandExecutionError",
"(",
"\"Version option must not be none.\"",
")",
"if",
"not",
"isinstance",
"(",
"synch",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_jobs | List all jobs on the device.
state
The state of the jobs to display. Valid options are all, pending, or processed. Pending jobs are jobs
that are currently in a running or waiting state. Processed jobs are jobs that have completed
execution.
CLI Example:
.. code-block:: bash
... | salt/modules/panos.py | def get_jobs(state='all'):
'''
List all jobs on the device.
state
The state of the jobs to display. Valid options are all, pending, or processed. Pending jobs are jobs
that are currently in a running or waiting state. Processed jobs are jobs that have completed
execution.
CLI E... | def get_jobs(state='all'):
'''
List all jobs on the device.
state
The state of the jobs to display. Valid options are all, pending, or processed. Pending jobs are jobs
that are currently in a running or waiting state. Processed jobs are jobs that have completed
execution.
CLI E... | [
"List",
"all",
"jobs",
"on",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L724-L750 | [
"def",
"get_jobs",
"(",
"state",
"=",
"'all'",
")",
":",
"if",
"state",
".",
"lower",
"(",
")",
"==",
"'all'",
":",
"query",
"=",
"{",
"'type'",
":",
"'op'",
",",
"'cmd'",
":",
"'<show><jobs><all></all></jobs></show>'",
"}",
"elif",
"state",
".",
"lower"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_local_admins | Show all local administrator accounts.
CLI Example:
.. code-block:: bash
salt '*' panos.get_local_admins | salt/modules/panos.py | def get_local_admins():
'''
Show all local administrator accounts.
CLI Example:
.. code-block:: bash
salt '*' panos.get_local_admins
'''
admin_list = get_users_config()
response = []
if 'users' not in admin_list['result']:
return response
if isinstance(admin_lis... | def get_local_admins():
'''
Show all local administrator accounts.
CLI Example:
.. code-block:: bash
salt '*' panos.get_local_admins
'''
admin_list = get_users_config()
response = []
if 'users' not in admin_list['result']:
return response
if isinstance(admin_lis... | [
"Show",
"all",
"local",
"administrator",
"accounts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L865-L888 | [
"def",
"get_local_admins",
"(",
")",
":",
"admin_list",
"=",
"get_users_config",
"(",
")",
"response",
"=",
"[",
"]",
"if",
"'users'",
"not",
"in",
"admin_list",
"[",
"'result'",
"]",
":",
"return",
"response",
"if",
"isinstance",
"(",
"admin_list",
"[",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_uncommitted_changes | Retrieve a list of all uncommitted changes on the device.
Requires PANOS version 8.0.0 or greater.
CLI Example:
.. code-block:: bash
salt '*' panos.get_uncommitted_changes | salt/modules/panos.py | def get_uncommitted_changes():
'''
Retrieve a list of all uncommitted changes on the device.
Requires PANOS version 8.0.0 or greater.
CLI Example:
.. code-block:: bash
salt '*' panos.get_uncommitted_changes
'''
_required_version = '8.0.0'
if not __proxy__['panos.is_required_v... | def get_uncommitted_changes():
'''
Retrieve a list of all uncommitted changes on the device.
Requires PANOS version 8.0.0 or greater.
CLI Example:
.. code-block:: bash
salt '*' panos.get_uncommitted_changes
'''
_required_version = '8.0.0'
if not __proxy__['panos.is_required_v... | [
"Retrieve",
"a",
"list",
"of",
"all",
"uncommitted",
"changes",
"on",
"the",
"device",
".",
"Requires",
"PANOS",
"version",
"8",
".",
"0",
".",
"0",
"or",
"greater",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1260-L1279 | [
"def",
"get_uncommitted_changes",
"(",
")",
":",
"_required_version",
"=",
"'8.0.0'",
"if",
"not",
"__proxy__",
"[",
"'panos.is_required_version'",
"]",
"(",
"_required_version",
")",
":",
"return",
"False",
",",
"'The panos device requires version {0} or greater for this c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install_antivirus | Install anti-virus packages.
Args:
version(str): The version of the PANOS file to install.
latest(bool): If true, the latest anti-virus file will be installed.
The specified version option will be ignored.
synch(bool): If true, the anti-virus will synch to the peer u... | salt/modules/panos.py | def install_antivirus(version=None, latest=False, synch=False, skip_commit=False,):
'''
Install anti-virus packages.
Args:
version(str): The version of the PANOS file to install.
latest(bool): If true, the latest anti-virus file will be installed.
The specified versio... | def install_antivirus(version=None, latest=False, synch=False, skip_commit=False,):
'''
Install anti-virus packages.
Args:
version(str): The version of the PANOS file to install.
latest(bool): If true, the latest anti-virus file will be installed.
The specified versio... | [
"Install",
"anti",
"-",
"virus",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1382-L1427 | [
"def",
"install_antivirus",
"(",
"version",
"=",
"None",
",",
"latest",
"=",
"False",
",",
"synch",
"=",
"False",
",",
"skip_commit",
"=",
"False",
",",
")",
":",
"if",
"not",
"version",
"and",
"latest",
"is",
"False",
":",
"raise",
"CommandExecutionError"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | refresh_fqdn_cache | Force refreshes all FQDNs used in rules.
force
Forces all fqdn refresh
CLI Example:
.. code-block:: bash
salt '*' panos.refresh_fqdn_cache
salt '*' panos.refresh_fqdn_cache force=True | salt/modules/panos.py | def refresh_fqdn_cache(force=False):
'''
Force refreshes all FQDNs used in rules.
force
Forces all fqdn refresh
CLI Example:
.. code-block:: bash
salt '*' panos.refresh_fqdn_cache
salt '*' panos.refresh_fqdn_cache force=True
'''
if not isinstance(force, bool):
... | def refresh_fqdn_cache(force=False):
'''
Force refreshes all FQDNs used in rules.
force
Forces all fqdn refresh
CLI Example:
.. code-block:: bash
salt '*' panos.refresh_fqdn_cache
salt '*' panos.refresh_fqdn_cache force=True
'''
if not isinstance(force, bool):
... | [
"Force",
"refreshes",
"all",
"FQDNs",
"used",
"in",
"rules",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1486-L1510 | [
"def",
"refresh_fqdn_cache",
"(",
"force",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"force",
",",
"bool",
")",
":",
"raise",
"CommandExecutionError",
"(",
"\"Force option must be boolean.\"",
")",
"if",
"force",
":",
"query",
"=",
"{",
"'type'",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resolve_address | Resolve address to ip address.
Required version 7.0.0 or greater.
address
Address name you want to resolve.
vsys
The vsys name.
CLI Example:
.. code-block:: bash
salt '*' panos.resolve_address foo.bar.com
salt '*' panos.resolve_address foo.bar.com vsys=2 | salt/modules/panos.py | def resolve_address(address=None, vsys=None):
'''
Resolve address to ip address.
Required version 7.0.0 or greater.
address
Address name you want to resolve.
vsys
The vsys name.
CLI Example:
.. code-block:: bash
salt '*' panos.resolve_address foo.bar.com
... | def resolve_address(address=None, vsys=None):
'''
Resolve address to ip address.
Required version 7.0.0 or greater.
address
Address name you want to resolve.
vsys
The vsys name.
CLI Example:
.. code-block:: bash
salt '*' panos.resolve_address foo.bar.com
... | [
"Resolve",
"address",
"to",
"ip",
"address",
".",
"Required",
"version",
"7",
".",
"0",
".",
"0",
"or",
"greater",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1529-L1563 | [
"def",
"resolve_address",
"(",
"address",
"=",
"None",
",",
"vsys",
"=",
"None",
")",
":",
"_required_version",
"=",
"'7.0.0'",
"if",
"not",
"__proxy__",
"[",
"'panos.is_required_version'",
"]",
"(",
"_required_version",
")",
":",
"return",
"False",
",",
"'The... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_authentication_profile | Set the authentication profile of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
profile (str): The name of the authentication profile to set.
deploy (bool): If true then commit the full candidate configuration, if false only set pending cha... | salt/modules/panos.py | def set_authentication_profile(profile=None, deploy=False):
'''
Set the authentication profile of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
profile (str): The name of the authentication profile to set.
deploy (bool): If true the... | def set_authentication_profile(profile=None, deploy=False):
'''
Set the authentication profile of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
profile (str): The name of the authentication profile to set.
deploy (bool): If true the... | [
"Set",
"the",
"authentication",
"profile",
"of",
"the",
"Palo",
"Alto",
"proxy",
"minion",
".",
"A",
"commit",
"will",
"be",
"required",
"before",
"this",
"is",
"processed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1604-L1638 | [
"def",
"set_authentication_profile",
"(",
"profile",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"if",
"not",
"profile",
":",
"raise",
"CommandExecutionError",
"(",
"\"Profile name option must not be none.\"",
")",
"ret",
"=",
"{",
"}",
"query",
"=",
"{"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_hostname | Set the hostname of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
hostname (str): The hostname to set
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: bash
... | salt/modules/panos.py | def set_hostname(hostname=None, deploy=False):
'''
Set the hostname of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
hostname (str): The hostname to set
deploy (bool): If true then commit the full candidate configuration, if false o... | def set_hostname(hostname=None, deploy=False):
'''
Set the hostname of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
hostname (str): The hostname to set
deploy (bool): If true then commit the full candidate configuration, if false o... | [
"Set",
"the",
"hostname",
"of",
"the",
"Palo",
"Alto",
"proxy",
"minion",
".",
"A",
"commit",
"will",
"be",
"required",
"before",
"this",
"is",
"processed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1641-L1674 | [
"def",
"set_hostname",
"(",
"hostname",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"if",
"not",
"hostname",
":",
"raise",
"CommandExecutionError",
"(",
"\"Hostname option must not be none.\"",
")",
"ret",
"=",
"{",
"}",
"query",
"=",
"{",
"'type'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_management_icmp | Enables or disables the ICMP management service on the device.
CLI Example:
Args:
enabled (bool): If true the service will be enabled. If false the service will be disabled.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-blo... | salt/modules/panos.py | def set_management_icmp(enabled=True, deploy=False):
'''
Enables or disables the ICMP management service on the device.
CLI Example:
Args:
enabled (bool): If true the service will be enabled. If false the service will be disabled.
deploy (bool): If true then commit the full candidate ... | def set_management_icmp(enabled=True, deploy=False):
'''
Enables or disables the ICMP management service on the device.
CLI Example:
Args:
enabled (bool): If true the service will be enabled. If false the service will be disabled.
deploy (bool): If true then commit the full candidate ... | [
"Enables",
"or",
"disables",
"the",
"ICMP",
"management",
"service",
"on",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1677-L1714 | [
"def",
"set_management_icmp",
"(",
"enabled",
"=",
"True",
",",
"deploy",
"=",
"False",
")",
":",
"if",
"enabled",
"is",
"True",
":",
"value",
"=",
"\"no\"",
"elif",
"enabled",
"is",
"False",
":",
"value",
"=",
"\"yes\"",
"else",
":",
"raise",
"CommandEx... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ntp_authentication | Set the NTP authentication of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
target(str): Determines the target of the authentication. Valid options are primary, secondary, or both.
authentication_type(str): The authentication type to be use... | salt/modules/panos.py | def set_ntp_authentication(target=None,
authentication_type=None,
key_id=None,
authentication_key=None,
algorithm=None,
deploy=False):
'''
Set the NTP authentication of the Palo... | def set_ntp_authentication(target=None,
authentication_type=None,
key_id=None,
authentication_key=None,
algorithm=None,
deploy=False):
'''
Set the NTP authentication of the Palo... | [
"Set",
"the",
"NTP",
"authentication",
"of",
"the",
"Palo",
"Alto",
"proxy",
"minion",
".",
"A",
"commit",
"will",
"be",
"required",
"before",
"this",
"is",
"processed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L1957-L2066 | [
"def",
"set_ntp_authentication",
"(",
"target",
"=",
"None",
",",
"authentication_type",
"=",
"None",
",",
"key_id",
"=",
"None",
",",
"authentication_key",
"=",
"None",
",",
"algorithm",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"ret",
"=",
"{",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ntp_servers | Set the NTP servers of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
primary_server(str): The primary NTP server IP address or FQDN.
secondary_server(str): The secondary NTP server IP address or FQDN.
deploy (bool): If true then co... | salt/modules/panos.py | def set_ntp_servers(primary_server=None, secondary_server=None, deploy=False):
'''
Set the NTP servers of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
primary_server(str): The primary NTP server IP address or FQDN.
secondary_server... | def set_ntp_servers(primary_server=None, secondary_server=None, deploy=False):
'''
Set the NTP servers of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
primary_server(str): The primary NTP server IP address or FQDN.
secondary_server... | [
"Set",
"the",
"NTP",
"servers",
"of",
"the",
"Palo",
"Alto",
"proxy",
"minion",
".",
"A",
"commit",
"will",
"be",
"required",
"before",
"this",
"is",
"processed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L2069-L2110 | [
"def",
"set_ntp_servers",
"(",
"primary_server",
"=",
"None",
",",
"secondary_server",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"primary_server",
":",
"query",
"=",
"{",
"'type'",
":",
"'config'",
",",
"'action'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_permitted_ip | Add an IPv4 address or network to the permitted IP list.
CLI Example:
Args:
address (str): The IPv4 address or network to allow access to add to the Palo Alto device.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: ba... | salt/modules/panos.py | def set_permitted_ip(address=None, deploy=False):
'''
Add an IPv4 address or network to the permitted IP list.
CLI Example:
Args:
address (str): The IPv4 address or network to allow access to add to the Palo Alto device.
deploy (bool): If true then commit the full candidate configurat... | def set_permitted_ip(address=None, deploy=False):
'''
Add an IPv4 address or network to the permitted IP list.
CLI Example:
Args:
address (str): The IPv4 address or network to allow access to add to the Palo Alto device.
deploy (bool): If true then commit the full candidate configurat... | [
"Add",
"an",
"IPv4",
"address",
"or",
"network",
"to",
"the",
"permitted",
"IP",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L2113-L2147 | [
"def",
"set_permitted_ip",
"(",
"address",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"if",
"not",
"address",
":",
"raise",
"CommandExecutionError",
"(",
"\"Address option must not be empty.\"",
")",
"ret",
"=",
"{",
"}",
"query",
"=",
"{",
"'type'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_timezone | Set the timezone of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
tz (str): The name of the timezone to set.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: bash
... | salt/modules/panos.py | def set_timezone(tz=None, deploy=False):
'''
Set the timezone of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
tz (str): The name of the timezone to set.
deploy (bool): If true then commit the full candidate configuration, if false ... | def set_timezone(tz=None, deploy=False):
'''
Set the timezone of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
tz (str): The name of the timezone to set.
deploy (bool): If true then commit the full candidate configuration, if false ... | [
"Set",
"the",
"timezone",
"of",
"the",
"Palo",
"Alto",
"proxy",
"minion",
".",
"A",
"commit",
"will",
"be",
"required",
"before",
"this",
"is",
"processed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L2150-L2183 | [
"def",
"set_timezone",
"(",
"tz",
"=",
"None",
",",
"deploy",
"=",
"False",
")",
":",
"if",
"not",
"tz",
":",
"raise",
"CommandExecutionError",
"(",
"\"Timezone name option must not be none.\"",
")",
"ret",
"=",
"{",
"}",
"query",
"=",
"{",
"'type'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | policy_present | Ensure a Vault policy with the given name and rules is present.
name
The name of the policy
rules
Rules formatted as in-line HCL
.. code-block:: yaml
demo-policy:
vault.policy_present:
- name: foo/bar
- rules: |
path "secret/top-... | salt/states/vault.py | def policy_present(name, rules):
'''
Ensure a Vault policy with the given name and rules is present.
name
The name of the policy
rules
Rules formatted as in-line HCL
.. code-block:: yaml
demo-policy:
vault.policy_present:
- name: foo/bar
... | def policy_present(name, rules):
'''
Ensure a Vault policy with the given name and rules is present.
name
The name of the policy
rules
Rules formatted as in-line HCL
.. code-block:: yaml
demo-policy:
vault.policy_present:
- name: foo/bar
... | [
"Ensure",
"a",
"Vault",
"policy",
"with",
"the",
"given",
"name",
"and",
"rules",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vault.py#L21-L61 | [
"def",
"policy_present",
"(",
"name",
",",
"rules",
")",
":",
"url",
"=",
"\"v1/sys/policy/{0}\"",
".",
"format",
"(",
"name",
")",
"response",
"=",
"__utils__",
"[",
"'vault.make_request'",
"]",
"(",
"'GET'",
",",
"url",
")",
"try",
":",
"if",
"response",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner | Write the return data to a file on the minion. | salt/returners/rawfile_json.py | def returner(ret):
'''
Write the return data to a file on the minion.
'''
opts = _get_options(ret)
try:
with salt.utils.files.flopen(opts['filename'], 'a') as logfile:
salt.utils.json.dump(ret, logfile)
logfile.write(str('\n')) # future lint: disable=blacklisted-func... | def returner(ret):
'''
Write the return data to a file on the minion.
'''
opts = _get_options(ret)
try:
with salt.utils.files.flopen(opts['filename'], 'a') as logfile:
salt.utils.json.dump(ret, logfile)
logfile.write(str('\n')) # future lint: disable=blacklisted-func... | [
"Write",
"the",
"return",
"data",
"to",
"a",
"file",
"on",
"the",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/rawfile_json.py#L54-L65 | [
"def",
"returner",
"(",
"ret",
")",
":",
"opts",
"=",
"_get_options",
"(",
"ret",
")",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"flopen",
"(",
"opts",
"[",
"'filename'",
"]",
",",
"'a'",
")",
"as",
"logfile",
":",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | event_return | Write event data (return data and non-return data) to file on the master. | salt/returners/rawfile_json.py | def event_return(events):
'''
Write event data (return data and non-return data) to file on the master.
'''
if not events:
# events is an empty list.
# Don't open the logfile in vain.
return
opts = _get_options({}) # Pass in empty ret, since this is a list of events
try:... | def event_return(events):
'''
Write event data (return data and non-return data) to file on the master.
'''
if not events:
# events is an empty list.
# Don't open the logfile in vain.
return
opts = _get_options({}) # Pass in empty ret, since this is a list of events
try:... | [
"Write",
"event",
"data",
"(",
"return",
"data",
"and",
"non",
"-",
"return",
"data",
")",
"to",
"file",
"on",
"the",
"master",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/rawfile_json.py#L68-L84 | [
"def",
"event_return",
"(",
"events",
")",
":",
"if",
"not",
"events",
":",
"# events is an empty list.",
"# Don't open the logfile in vain.",
"return",
"opts",
"=",
"_get_options",
"(",
"{",
"}",
")",
"# Pass in empty ret, since this is a list of events",
"try",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _layout_to_vdev | Turn the layout data into usable vdevs spedcification
We need to support 2 ways of passing the layout:
.. code::
layout_new:
- mirror:
- disk0
- disk1
- mirror:
- disk2
- disk3
.. code:
layout_legacy:
mirror-0:
... | salt/states/zpool.py | def _layout_to_vdev(layout, device_dir=None):
'''
Turn the layout data into usable vdevs spedcification
We need to support 2 ways of passing the layout:
.. code::
layout_new:
- mirror:
- disk0
- disk1
- mirror:
- disk2
- disk3... | def _layout_to_vdev(layout, device_dir=None):
'''
Turn the layout data into usable vdevs spedcification
We need to support 2 ways of passing the layout:
.. code::
layout_new:
- mirror:
- disk0
- disk1
- mirror:
- disk2
- disk3... | [
"Turn",
"the",
"layout",
"data",
"into",
"usable",
"vdevs",
"spedcification"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zpool.py#L97-L167 | [
"def",
"_layout_to_vdev",
"(",
"layout",
",",
"device_dir",
"=",
"None",
")",
":",
"vdevs",
"=",
"[",
"]",
"# NOTE: check device_dir exists",
"if",
"device_dir",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"device_dir",
")",
":",
"device_dir",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | ensure storage pool is present on the system
name : string
name of storage pool
properties : dict
optional set of properties to set for the storage pool
filesystem_properties : dict
optional set of filesystem properties to set for the storage pool (creation only)
layout: dict
... | salt/states/zpool.py | def present(name, properties=None, filesystem_properties=None, layout=None, config=None):
'''
ensure storage pool is present on the system
name : string
name of storage pool
properties : dict
optional set of properties to set for the storage pool
filesystem_properties : dict
... | def present(name, properties=None, filesystem_properties=None, layout=None, config=None):
'''
ensure storage pool is present on the system
name : string
name of storage pool
properties : dict
optional set of properties to set for the storage pool
filesystem_properties : dict
... | [
"ensure",
"storage",
"pool",
"is",
"present",
"on",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zpool.py#L170-L381 | [
"def",
"present",
"(",
"name",
",",
"properties",
"=",
"None",
",",
"filesystem_properties",
"=",
"None",
",",
"layout",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | ensure storage pool is absent on the system
name : string
name of storage pool
export : boolean
export instread of destroy the zpool if present
force : boolean
force destroy or export | salt/states/zpool.py | def absent(name, export=False, force=False):
'''
ensure storage pool is absent on the system
name : string
name of storage pool
export : boolean
export instread of destroy the zpool if present
force : boolean
force destroy or export
'''
ret = {'name': name,
... | def absent(name, export=False, force=False):
'''
ensure storage pool is absent on the system
name : string
name of storage pool
export : boolean
export instread of destroy the zpool if present
force : boolean
force destroy or export
'''
ret = {'name': name,
... | [
"ensure",
"storage",
"pool",
"is",
"absent",
"on",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zpool.py#L384-L434 | [
"def",
"absent",
"(",
"name",
",",
"export",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"# log configu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | booted | Return True if the system was booted with systemd, False otherwise. If the
loader context dict ``__context__`` is passed, this function will set the
``salt.utils.systemd.booted`` key to represent if systemd is running and
keep the logic below from needing to be run again during the same salt run. | salt/utils/systemd.py | def booted(context=None):
'''
Return True if the system was booted with systemd, False otherwise. If the
loader context dict ``__context__`` is passed, this function will set the
``salt.utils.systemd.booted`` key to represent if systemd is running and
keep the logic below from needing to be run aga... | def booted(context=None):
'''
Return True if the system was booted with systemd, False otherwise. If the
loader context dict ``__context__`` is passed, this function will set the
``salt.utils.systemd.booted`` key to represent if systemd is running and
keep the logic below from needing to be run aga... | [
"Return",
"True",
"if",
"the",
"system",
"was",
"booted",
"with",
"systemd",
"False",
"otherwise",
".",
"If",
"the",
"loader",
"context",
"dict",
"__context__",
"is",
"passed",
"this",
"function",
"will",
"set",
"the",
"salt",
".",
"utils",
".",
"systemd",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/systemd.py#L19-L47 | [
"def",
"booted",
"(",
"context",
"=",
"None",
")",
":",
"contextkey",
"=",
"'salt.utils.systemd.booted'",
"if",
"isinstance",
"(",
"context",
",",
"dict",
")",
":",
"# Can't put this if block on the same line as the above if block,",
"# because it willl break the elif below."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | version | Attempts to run systemctl --version. Returns None if unable to determine
version. | salt/utils/systemd.py | def version(context=None):
'''
Attempts to run systemctl --version. Returns None if unable to determine
version.
'''
contextkey = 'salt.utils.systemd.version'
if isinstance(context, dict):
# Can't put this if block on the same line as the above if block,
# because it will break t... | def version(context=None):
'''
Attempts to run systemctl --version. Returns None if unable to determine
version.
'''
contextkey = 'salt.utils.systemd.version'
if isinstance(context, dict):
# Can't put this if block on the same line as the above if block,
# because it will break t... | [
"Attempts",
"to",
"run",
"systemctl",
"--",
"version",
".",
"Returns",
"None",
"if",
"unable",
"to",
"determine",
"version",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/systemd.py#L50-L81 | [
"def",
"version",
"(",
"context",
"=",
"None",
")",
":",
"contextkey",
"=",
"'salt.utils.systemd.version'",
"if",
"isinstance",
"(",
"context",
",",
"dict",
")",
":",
"# Can't put this if block on the same line as the above if block,",
"# because it will break the elif below.... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | has_scope | Scopes were introduced in systemd 205, this function returns a boolean
which is true when the minion is systemd-booted and running systemd>=205. | salt/utils/systemd.py | def has_scope(context=None):
'''
Scopes were introduced in systemd 205, this function returns a boolean
which is true when the minion is systemd-booted and running systemd>=205.
'''
if not booted(context):
return False
_sd_version = version(context)
if _sd_version is None:
re... | def has_scope(context=None):
'''
Scopes were introduced in systemd 205, this function returns a boolean
which is true when the minion is systemd-booted and running systemd>=205.
'''
if not booted(context):
return False
_sd_version = version(context)
if _sd_version is None:
re... | [
"Scopes",
"were",
"introduced",
"in",
"systemd",
"205",
"this",
"function",
"returns",
"a",
"boolean",
"which",
"is",
"true",
"when",
"the",
"minion",
"is",
"systemd",
"-",
"booted",
"and",
"running",
"systemd",
">",
"=",
"205",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/systemd.py#L84-L94 | [
"def",
"has_scope",
"(",
"context",
"=",
"None",
")",
":",
"if",
"not",
"booted",
"(",
"context",
")",
":",
"return",
"False",
"_sd_version",
"=",
"version",
"(",
"context",
")",
"if",
"_sd_version",
"is",
"None",
":",
"return",
"False",
"return",
"_sd_v... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_conn | Return a postgres connection. | salt/returners/postgres_local_cache.py | def _get_conn():
'''
Return a postgres connection.
'''
try:
conn = psycopg2.connect(
host=__opts__['master_job_cache.postgres.host'],
user=__opts__['master_job_cache.postgres.user'],
password=__opts__['master_job_cache.postgres.passwd'],
... | def _get_conn():
'''
Return a postgres connection.
'''
try:
conn = psycopg2.connect(
host=__opts__['master_job_cache.postgres.host'],
user=__opts__['master_job_cache.postgres.user'],
password=__opts__['master_job_cache.postgres.passwd'],
... | [
"Return",
"a",
"postgres",
"connection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres_local_cache.py#L139-L153 | [
"def",
"_get_conn",
"(",
")",
":",
"try",
":",
"conn",
"=",
"psycopg2",
".",
"connect",
"(",
"host",
"=",
"__opts__",
"[",
"'master_job_cache.postgres.host'",
"]",
",",
"user",
"=",
"__opts__",
"[",
"'master_job_cache.postgres.user'",
"]",
",",
"password",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _format_job_instance | Format the job instance correctly | salt/returners/postgres_local_cache.py | def _format_job_instance(job):
'''
Format the job instance correctly
'''
ret = {'Function': job.get('fun', 'unknown-function'),
'Arguments': salt.utils.json.loads(job.get('arg', '[]')),
# unlikely but safeguard from invalid returns
'Target': job.get('tgt', 'unknown-targe... | def _format_job_instance(job):
'''
Format the job instance correctly
'''
ret = {'Function': job.get('fun', 'unknown-function'),
'Arguments': salt.utils.json.loads(job.get('arg', '[]')),
# unlikely but safeguard from invalid returns
'Target': job.get('tgt', 'unknown-targe... | [
"Format",
"the",
"job",
"instance",
"correctly"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres_local_cache.py#L164-L175 | [
"def",
"_format_job_instance",
"(",
"job",
")",
":",
"ret",
"=",
"{",
"'Function'",
":",
"job",
".",
"get",
"(",
"'fun'",
",",
"'unknown-function'",
")",
",",
"'Arguments'",
":",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"job",
".",
"get",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _gen_jid | Generate an unique job id | salt/returners/postgres_local_cache.py | def _gen_jid(cur):
'''
Generate an unique job id
'''
jid = salt.utils.jid.gen_jid(__opts__)
sql = '''SELECT jid FROM jids WHERE jid = %s'''
cur.execute(sql, (jid,))
data = cur.fetchall()
if not data:
return jid
return None | def _gen_jid(cur):
'''
Generate an unique job id
'''
jid = salt.utils.jid.gen_jid(__opts__)
sql = '''SELECT jid FROM jids WHERE jid = %s'''
cur.execute(sql, (jid,))
data = cur.fetchall()
if not data:
return jid
return None | [
"Generate",
"an",
"unique",
"job",
"id"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres_local_cache.py#L187-L197 | [
"def",
"_gen_jid",
"(",
"cur",
")",
":",
"jid",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"gen_jid",
"(",
"__opts__",
")",
"sql",
"=",
"'''SELECT jid FROM jids WHERE jid = %s'''",
"cur",
".",
"execute",
"(",
"sql",
",",
"(",
"jid",
",",
")",
")",
"da... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | prep_jid | Return a job id and prepare the job id directory
This is the function responsible for making sure jids don't collide
(unless its passed a jid). So do what you have to do to make sure that
stays the case | salt/returners/postgres_local_cache.py | def prep_jid(nocache=False, passed_jid=None):
'''
Return a job id and prepare the job id directory
This is the function responsible for making sure jids don't collide
(unless its passed a jid). So do what you have to do to make sure that
stays the case
'''
conn = _get_conn()
if conn is N... | def prep_jid(nocache=False, passed_jid=None):
'''
Return a job id and prepare the job id directory
This is the function responsible for making sure jids don't collide
(unless its passed a jid). So do what you have to do to make sure that
stays the case
'''
conn = _get_conn()
if conn is N... | [
"Return",
"a",
"job",
"id",
"and",
"prepare",
"the",
"job",
"id",
"directory",
"This",
"is",
"the",
"function",
"responsible",
"for",
"making",
"sure",
"jids",
"don",
"t",
"collide",
"(",
"unless",
"its",
"passed",
"a",
"jid",
")",
".",
"So",
"do",
"wh... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/postgres_local_cache.py#L200-L221 | [
"def",
"prep_jid",
"(",
"nocache",
"=",
"False",
",",
"passed_jid",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
")",
"if",
"conn",
"is",
"None",
":",
"return",
"None",
"cur",
"=",
"conn",
".",
"cursor",
"(",
")",
"if",
"passed_jid",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.