repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
saltstack/salt
salt/states/cron.py
env_absent
def env_absent(name, user='root'): ''' Verifies that the specified environment variable is absent from the crontab for the specified user name The name of the environment variable to remove from the user crontab user The name of the user whose crontab needs to be mod...
python
def env_absent(name, user='root'): ''' Verifies that the specified environment variable is absent from the crontab for the specified user name The name of the environment variable to remove from the user crontab user The name of the user whose crontab needs to be mod...
[ "def", "env_absent", "(", "name", ",", "user", "=", "'root'", ")", ":", "name", "=", "name", ".", "strip", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''...
Verifies that the specified environment variable is absent from the crontab for the specified user name The name of the environment variable to remove from the user crontab user The name of the user whose crontab needs to be modified, defaults to the root user
[ "Verifies", "that", "the", "specified", "environment", "variable", "is", "absent", "from", "the", "crontab", "for", "the", "specified", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L725-L767
train
saltstack/salt
salt/output/highstate.py
output
def output(data, **kwargs): # pylint: disable=unused-argument ''' The HighState Outputter is only meant to be used with the state.highstate function, or a function that returns highstate return data. ''' if len(data.keys()) == 1: # account for nested orchs via saltutil.runner if 're...
python
def output(data, **kwargs): # pylint: disable=unused-argument ''' The HighState Outputter is only meant to be used with the state.highstate function, or a function that returns highstate return data. ''' if len(data.keys()) == 1: # account for nested orchs via saltutil.runner if 're...
[ "def", "output", "(", "data", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "if", "len", "(", "data", ".", "keys", "(", ")", ")", "==", "1", ":", "# account for nested orchs via saltutil.runner", "if", "'return'", "in", "data", ":", ...
The HighState Outputter is only meant to be used with the state.highstate function, or a function that returns highstate return data.
[ "The", "HighState", "Outputter", "is", "only", "meant", "to", "be", "used", "with", "the", "state", ".", "highstate", "function", "or", "a", "function", "that", "returns", "highstate", "return", "data", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L136-L183
train
saltstack/salt
salt/output/highstate.py
_format_host
def _format_host(host, data, indent_level=1): ''' Main highstate formatter. can be called recursively if a nested highstate contains other highstates (ie in an orchestration) ''' host = salt.utils.data.decode(host) colors = salt.utils.color.get_colors( __opts__.get('color'), ...
python
def _format_host(host, data, indent_level=1): ''' Main highstate formatter. can be called recursively if a nested highstate contains other highstates (ie in an orchestration) ''' host = salt.utils.data.decode(host) colors = salt.utils.color.get_colors( __opts__.get('color'), ...
[ "def", "_format_host", "(", "host", ",", "data", ",", "indent_level", "=", "1", ")", ":", "host", "=", "salt", ".", "utils", ".", "data", ".", "decode", "(", "host", ")", "colors", "=", "salt", ".", "utils", ".", "color", ".", "get_colors", "(", "_...
Main highstate formatter. can be called recursively if a nested highstate contains other highstates (ie in an orchestration)
[ "Main", "highstate", "formatter", ".", "can", "be", "called", "recursively", "if", "a", "nested", "highstate", "contains", "other", "highstates", "(", "ie", "in", "an", "orchestration", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L186-L511
train
saltstack/salt
salt/output/highstate.py
_nested_changes
def _nested_changes(changes): ''' Print the changes data using the nested outputter ''' ret = '\n' ret += salt.output.out_format( changes, 'nested', __opts__, nested_indent=14) return ret
python
def _nested_changes(changes): ''' Print the changes data using the nested outputter ''' ret = '\n' ret += salt.output.out_format( changes, 'nested', __opts__, nested_indent=14) return ret
[ "def", "_nested_changes", "(", "changes", ")", ":", "ret", "=", "'\\n'", "ret", "+=", "salt", ".", "output", ".", "out_format", "(", "changes", ",", "'nested'", ",", "__opts__", ",", "nested_indent", "=", "14", ")", "return", "ret" ]
Print the changes data using the nested outputter
[ "Print", "the", "changes", "data", "using", "the", "nested", "outputter" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L514-L524
train
saltstack/salt
salt/output/highstate.py
_format_changes
def _format_changes(changes, orchestration=False): ''' Format the changes dict based on what the data is ''' if not changes: return False, '' if orchestration: return True, _nested_changes(changes) if not isinstance(changes, dict): return True, 'Invalid Changes data: {0...
python
def _format_changes(changes, orchestration=False): ''' Format the changes dict based on what the data is ''' if not changes: return False, '' if orchestration: return True, _nested_changes(changes) if not isinstance(changes, dict): return True, 'Invalid Changes data: {0...
[ "def", "_format_changes", "(", "changes", ",", "orchestration", "=", "False", ")", ":", "if", "not", "changes", ":", "return", "False", ",", "''", "if", "orchestration", ":", "return", "True", ",", "_nested_changes", "(", "changes", ")", "if", "not", "isin...
Format the changes dict based on what the data is
[ "Format", "the", "changes", "dict", "based", "on", "what", "the", "data", "is" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L527-L551
train
saltstack/salt
salt/output/highstate.py
_format_terse
def _format_terse(tcolor, comps, ret, colors, tabular): ''' Terse formatting of a message. ''' result = 'Clean' if ret['changes']: result = 'Changed' if ret['result'] is False: result = 'Failed' elif ret['result'] is None: result = 'Differs' if tabular is True: ...
python
def _format_terse(tcolor, comps, ret, colors, tabular): ''' Terse formatting of a message. ''' result = 'Clean' if ret['changes']: result = 'Changed' if ret['result'] is False: result = 'Failed' elif ret['result'] is None: result = 'Differs' if tabular is True: ...
[ "def", "_format_terse", "(", "tcolor", ",", "comps", ",", "ret", ",", "colors", ",", "tabular", ")", ":", "result", "=", "'Clean'", "if", "ret", "[", "'changes'", "]", ":", "result", "=", "'Changed'", "if", "ret", "[", "'result'", "]", "is", "False", ...
Terse formatting of a message.
[ "Terse", "formatting", "of", "a", "message", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L554-L595
train
saltstack/salt
salt/states/kernelpkg.py
mod_watch
def mod_watch(name, sfun, **kwargs): ''' The kernerpkg watcher, called to invoke the watch command. When called, execute a kernelpkg state based on a watch or listen call. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should n...
python
def mod_watch(name, sfun, **kwargs): ''' The kernerpkg watcher, called to invoke the watch command. When called, execute a kernelpkg state based on a watch or listen call. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should n...
[ "def", "mod_watch", "(", "name", ",", "sfun", ",", "*", "*", "kwargs", ")", ":", "if", "sfun", "in", "(", "'latest_active'", ",", "'latest_wait'", ")", ":", "return", "latest_active", "(", "name", ",", "*", "*", "kwargs", ")", "else", ":", "return", ...
The kernerpkg watcher, called to invoke the watch command. When called, execute a kernelpkg state based on a watch or listen call. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for th...
[ "The", "kernerpkg", "watcher", "called", "to", "invoke", "the", "watch", "command", ".", "When", "called", "execute", "a", "kernelpkg", "state", "based", "on", "a", "watch", "or", "listen", "call", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kernelpkg.py#L204-L221
train
saltstack/salt
salt/modules/solr.py
_get_none_or_value
def _get_none_or_value(value): ''' PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The...
python
def _get_none_or_value(value): ''' PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The...
[ "def", "_get_none_or_value", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "elif", "not", "value", ":", "return", "value", "# if it's a string, and it's not empty check for none", "elif", "isinstance", "(", "value", ",", "six", ".", ...
PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The primitive or built-in container to evaluat...
[ "PRIVATE", "METHOD", "Checks", "to", "see", "if", "the", "value", "of", "a", "primitive", "or", "built", "-", "in", "container", "such", "as", "a", "list", "dict", "set", "tuple", "etc", "is", "empty", "or", "none", ".", "None", "type", "is", "returned...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L99-L122
train
saltstack/salt
salt/modules/solr.py
_get_return_dict
def _get_return_dict(success=True, data=None, errors=None, warnings=None): ''' PRIVATE METHOD Creates a new return dict with default values. Defaults may be overwritten. success : boolean (True) True indicates a successful result. data : dict<str,obj> ({}) Data to be returned to the...
python
def _get_return_dict(success=True, data=None, errors=None, warnings=None): ''' PRIVATE METHOD Creates a new return dict with default values. Defaults may be overwritten. success : boolean (True) True indicates a successful result. data : dict<str,obj> ({}) Data to be returned to the...
[ "def", "_get_return_dict", "(", "success", "=", "True", ",", "data", "=", "None", ",", "errors", "=", "None", ",", "warnings", "=", "None", ")", ":", "data", "=", "{", "}", "if", "data", "is", "None", "else", "data", "errors", "=", "[", "]", "if", ...
PRIVATE METHOD Creates a new return dict with default values. Defaults may be overwritten. success : boolean (True) True indicates a successful result. data : dict<str,obj> ({}) Data to be returned to the caller. errors : list<str> ([()]) A list of error messages to be returned ...
[ "PRIVATE", "METHOD", "Creates", "a", "new", "return", "dict", "with", "default", "values", ".", "Defaults", "may", "be", "overwritten", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L138-L164
train
saltstack/salt
salt/modules/solr.py
_update_return_dict
def _update_return_dict(ret, success, data, errors=None, warnings=None): ''' PRIVATE METHOD Updates the return dictionary and returns it. ret : dict<str,obj> The original return dict to update. The ret param should have been created from _get_return_dict() success : boolean (True) ...
python
def _update_return_dict(ret, success, data, errors=None, warnings=None): ''' PRIVATE METHOD Updates the return dictionary and returns it. ret : dict<str,obj> The original return dict to update. The ret param should have been created from _get_return_dict() success : boolean (True) ...
[ "def", "_update_return_dict", "(", "ret", ",", "success", ",", "data", ",", "errors", "=", "None", ",", "warnings", "=", "None", ")", ":", "errors", "=", "[", "]", "if", "errors", "is", "None", "else", "errors", "warnings", "=", "[", "]", "if", "warn...
PRIVATE METHOD Updates the return dictionary and returns it. ret : dict<str,obj> The original return dict to update. The ret param should have been created from _get_return_dict() success : boolean (True) True indicates a successful result. data : dict<str,obj> ({}) Data...
[ "PRIVATE", "METHOD", "Updates", "the", "return", "dictionary", "and", "returns", "it", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L167-L194
train
saltstack/salt
salt/modules/solr.py
_format_url
def _format_url(handler, host=None, core_name=None, extra=None): ''' PRIVATE METHOD Formats the URL based on parameters, and if cores are used or not handler : str The request handler to hit. host : str (None) The solr host to query. __opts__['host'] is default core_name : str (...
python
def _format_url(handler, host=None, core_name=None, extra=None): ''' PRIVATE METHOD Formats the URL based on parameters, and if cores are used or not handler : str The request handler to hit. host : str (None) The solr host to query. __opts__['host'] is default core_name : str (...
[ "def", "_format_url", "(", "handler", ",", "host", "=", "None", ",", "core_name", "=", "None", ",", "extra", "=", "None", ")", ":", "extra", "=", "[", "]", "if", "extra", "is", "None", "else", "extra", "if", "_get_none_or_value", "(", "host", ")", "i...
PRIVATE METHOD Formats the URL based on parameters, and if cores are used or not handler : str The request handler to hit. 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 y...
[ "PRIVATE", "METHOD", "Formats", "the", "URL", "based", "on", "parameters", "and", "if", "cores", "are", "used", "or", "not" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L197-L233
train
saltstack/salt
salt/modules/solr.py
_auth
def _auth(url): ''' Install an auth handler for urllib2 ''' user = __salt__['config.get']('solr.user', False) password = __salt__['config.get']('solr.passwd', False) realm = __salt__['config.get']('solr.auth_realm', 'Solr') if user and password: basic = _HTTPBasicAuthHandler() ...
python
def _auth(url): ''' Install an auth handler for urllib2 ''' user = __salt__['config.get']('solr.user', False) password = __salt__['config.get']('solr.passwd', False) realm = __salt__['config.get']('solr.auth_realm', 'Solr') if user and password: basic = _HTTPBasicAuthHandler() ...
[ "def", "_auth", "(", "url", ")", ":", "user", "=", "__salt__", "[", "'config.get'", "]", "(", "'solr.user'", ",", "False", ")", "password", "=", "__salt__", "[", "'config.get'", "]", "(", "'solr.passwd'", ",", "False", ")", "realm", "=", "__salt__", "[",...
Install an auth handler for urllib2
[ "Install", "an", "auth", "handler", "for", "urllib2" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L236-L255
train
saltstack/salt
salt/modules/solr.py
_http_request
def _http_request(url, request_timeout=None): ''' PRIVATE METHOD Uses salt.utils.json.load to fetch the JSON results from the solr API. url : str a complete URL that can be passed to urllib.open request_timeout : int (None) The number of seconds before the timeout should fail. Leave...
python
def _http_request(url, request_timeout=None): ''' PRIVATE METHOD Uses salt.utils.json.load to fetch the JSON results from the solr API. url : str a complete URL that can be passed to urllib.open request_timeout : int (None) The number of seconds before the timeout should fail. Leave...
[ "def", "_http_request", "(", "url", ",", "request_timeout", "=", "None", ")", ":", "_auth", "(", "url", ")", "try", ":", "request_timeout", "=", "__salt__", "[", "'config.option'", "]", "(", "'solr.request_timeout'", ")", "kwargs", "=", "{", "}", "if", "re...
PRIVATE METHOD Uses salt.utils.json.load to fetch the JSON results from the solr API. url : str a complete URL that can be passed to urllib.open request_timeout : int (None) The number of seconds before the timeout should fail. Leave blank/None to use the default. __opts__['solr.req...
[ "PRIVATE", "METHOD", "Uses", "salt", ".", "utils", ".", "json", ".", "load", "to", "fetch", "the", "JSON", "results", "from", "the", "solr", "API", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L258-L281
train
saltstack/salt
salt/modules/solr.py
_replication_request
def _replication_request(command, host=None, core_name=None, params=None): ''' PRIVATE METHOD Performs the requested replication command and returns a dictionary with success, errors and data as keys. The data object will contain the JSON response. command : str The replication command ...
python
def _replication_request(command, host=None, core_name=None, params=None): ''' PRIVATE METHOD Performs the requested replication command and returns a dictionary with success, errors and data as keys. The data object will contain the JSON response. command : str The replication command ...
[ "def", "_replication_request", "(", "command", ",", "host", "=", "None", ",", "core_name", "=", "None", ",", "params", "=", "None", ")", ":", "params", "=", "[", "]", "if", "params", "is", "None", "else", "params", "extra", "=", "[", "\"command={0}\"", ...
PRIVATE METHOD Performs the requested replication command and returns a dictionary with success, errors and data as keys. The data object will contain the JSON response. command : str The replication command to execute. host : str (None) The solr host to query. __opts__['host'] is d...
[ "PRIVATE", "METHOD", "Performs", "the", "requested", "replication", "command", "and", "returns", "a", "dictionary", "with", "success", "errors", "and", "data", "as", "keys", ".", "The", "data", "object", "will", "contain", "the", "JSON", "response", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L284-L310
train
saltstack/salt
salt/modules/solr.py
_get_admin_info
def _get_admin_info(command, host=None, core_name=None): ''' PRIVATE METHOD Calls the _http_request method and passes the admin command to execute and stores the data. This data is fairly static but should be refreshed periodically to make sure everything this OK. The data object will contain th...
python
def _get_admin_info(command, host=None, core_name=None): ''' PRIVATE METHOD Calls the _http_request method and passes the admin command to execute and stores the data. This data is fairly static but should be refreshed periodically to make sure everything this OK. The data object will contain th...
[ "def", "_get_admin_info", "(", "command", ",", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "url", "=", "_format_url", "(", "\"admin/{0}\"", ".", "format", "(", "command", ")", ",", "host", ",", "core_name", "=", "core_name", ")", "resp"...
PRIVATE METHOD Calls the _http_request method and passes the admin command to execute and stores the data. This data is fairly static but should be refreshed periodically to make sure everything this OK. The data object will contain the JSON response. command : str The admin command to exec...
[ "PRIVATE", "METHOD", "Calls", "the", "_http_request", "method", "and", "passes", "the", "admin", "command", "to", "execute", "and", "stores", "the", "data", ".", "This", "data", "is", "fairly", "static", "but", "should", "be", "refreshed", "periodically", "to"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L313-L335
train
saltstack/salt
salt/modules/solr.py
_merge_options
def _merge_options(options): ''' PRIVATE METHOD updates the default import options from __opts__['solr.dih.import_options'] with the dictionary passed in. Also converts booleans to strings to pass to solr. options : dict<str,boolean> Dictionary the over rides the default options define...
python
def _merge_options(options): ''' PRIVATE METHOD updates the default import options from __opts__['solr.dih.import_options'] with the dictionary passed in. Also converts booleans to strings to pass to solr. options : dict<str,boolean> Dictionary the over rides the default options define...
[ "def", "_merge_options", "(", "options", ")", ":", "defaults", "=", "__salt__", "[", "'config.option'", "]", "(", "'solr.dih.import_options'", ")", "if", "isinstance", "(", "options", ",", "dict", ")", ":", "defaults", ".", "update", "(", "options", ")", "fo...
PRIVATE METHOD updates the default import options from __opts__['solr.dih.import_options'] with the dictionary passed in. Also converts booleans to strings to pass to solr. options : dict<str,boolean> Dictionary the over rides the default options defined in __opts__['solr.dih.import_op...
[ "PRIVATE", "METHOD", "updates", "the", "default", "import", "options", "from", "__opts__", "[", "solr", ".", "dih", ".", "import_options", "]", "with", "the", "dictionary", "passed", "in", ".", "Also", "converts", "booleans", "to", "strings", "to", "pass", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L350-L371
train
saltstack/salt
salt/modules/solr.py
_pre_index_check
def _pre_index_check(handler, host=None, core_name=None): ''' PRIVATE METHOD - MASTER CALL Does a pre-check to make sure that all the options are set and that we can talk to solr before trying to send a command to solr. This Command should only be issued to masters. handler : str The im...
python
def _pre_index_check(handler, host=None, core_name=None): ''' PRIVATE METHOD - MASTER CALL Does a pre-check to make sure that all the options are set and that we can talk to solr before trying to send a command to solr. This Command should only be issued to masters. handler : str The im...
[ "def", "_pre_index_check", "(", "handler", ",", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "# make sure that it's a master minion", "if", "_get_none_or_value", "(", "host", ")", "is", "None", "and", "not", "_is_master", "(", ")", ":", "err",...
PRIVATE METHOD - MASTER CALL Does a pre-check to make sure that all the options are set and that we can talk to solr before trying to send a command to solr. This Command should only be issued to masters. handler : str The import handler to check the state of host : str (None): The ...
[ "PRIVATE", "METHOD", "-", "MASTER", "CALL", "Does", "a", "pre", "-", "check", "to", "make", "sure", "that", "all", "the", "options", "are", "set", "and", "that", "we", "can", "talk", "to", "solr", "before", "trying", "to", "send", "a", "command", "to",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L374-L419
train
saltstack/salt
salt/modules/solr.py
_find_value
def _find_value(ret_dict, key, path=None): ''' PRIVATE METHOD Traverses a dictionary of dictionaries/lists to find key and return the value stored. TODO:// this method doesn't really work very well, and it's not really very useful in its current state. The purpose for this method is ...
python
def _find_value(ret_dict, key, path=None): ''' PRIVATE METHOD Traverses a dictionary of dictionaries/lists to find key and return the value stored. TODO:// this method doesn't really work very well, and it's not really very useful in its current state. The purpose for this method is ...
[ "def", "_find_value", "(", "ret_dict", ",", "key", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "key", "else", ":", "path", "=", "\"{0}:{1}\"", ".", "format", "(", "path", ",", "key", ")", "ret", "=", "[", "]"...
PRIVATE METHOD Traverses a dictionary of dictionaries/lists to find key and return the value stored. TODO:// this method doesn't really work very well, and it's not really very useful in its current state. The purpose for this method is to simplify parsing the JSON output so you can ...
[ "PRIVATE", "METHOD", "Traverses", "a", "dictionary", "of", "dictionaries", "/", "lists", "to", "find", "key", "and", "return", "the", "value", "stored", ".", "TODO", ":", "//", "this", "method", "doesn", "t", "really", "work", "very", "well", "and", "it", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L422-L456
train
saltstack/salt
salt/modules/solr.py
lucene_version
def lucene_version(core_name=None): ''' Gets the lucene version that solr is using. If you are running a multi-core setup you should specify a core name since all the cores run under the same servlet container, they will all have the same version. core_name : str (None) The name of the solr...
python
def lucene_version(core_name=None): ''' Gets the lucene version that solr is using. If you are running a multi-core setup you should specify a core name since all the cores run under the same servlet container, they will all have the same version. core_name : str (None) The name of the solr...
[ "def", "lucene_version", "(", "core_name", "=", "None", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "# do we want to check for all the cores?", "if", "_get_none_or_value", "(", "core_name", ")", "is", "None", "and", "_check_for_cores", "(", ")", ":", "succ...
Gets the lucene version that solr is using. If you are running a multi-core setup you should specify a core name since all the cores run under the same servlet container, they will all have the same version. core_name : str (None) The name of the solr core if using cores. Leave this blank if you ar...
[ "Gets", "the", "lucene", "version", "that", "solr", "is", "using", ".", "If", "you", "are", "running", "a", "multi", "-", "core", "setup", "you", "should", "specify", "a", "core", "name", "since", "all", "the", "cores", "run", "under", "the", "same", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L461-L501
train
saltstack/salt
salt/modules/solr.py
version
def version(core_name=None): ''' Gets the solr version for the core specified. You should specify a core here as all the cores will run under the same servlet container and so will all have the same version. core_name : str (None) The name of the solr core if using cores. Leave this blank ...
python
def version(core_name=None): ''' Gets the solr version for the core specified. You should specify a core here as all the cores will run under the same servlet container and so will all have the same version. core_name : str (None) The name of the solr core if using cores. Leave this blank ...
[ "def", "version", "(", "core_name", "=", "None", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "# do we want to check for all the cores?", "if", "_get_none_or_value", "(", "core_name", ")", "is", "None", "and", "_check_for_cores", "(", ")", ":", "success", ...
Gets the solr version for the core specified. You should specify a core here as all the cores will run under the same servlet container and so will all have the same version. core_name : str (None) The name of the solr core if using cores. Leave this blank if you are not using cores or if ...
[ "Gets", "the", "solr", "version", "for", "the", "core", "specified", ".", "You", "should", "specify", "a", "core", "here", "as", "all", "the", "cores", "will", "run", "under", "the", "same", "servlet", "container", "and", "so", "will", "all", "have", "th...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L504-L546
train
saltstack/salt
salt/modules/solr.py
optimize
def optimize(host=None, core_name=None): ''' Search queries fast, but it is a very expensive operation. The ideal process is to run this with a master/slave configuration. Then you can optimize the master, and push the optimized index to the slaves. If you are running a single solr instance, or if ...
python
def optimize(host=None, core_name=None): ''' Search queries fast, but it is a very expensive operation. The ideal process is to run this with a master/slave configuration. Then you can optimize the master, and push the optimized index to the slaves. If you are running a single solr instance, or if ...
[ "def", "optimize", "(", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "if", "_get_none_or_value", "(", "core_name", ")", "is", "None", "and", "_check_for_cores", "(", ")", ":", "success", "=", "Tr...
Search queries fast, but it is a very expensive operation. The ideal process is to run this with a master/slave configuration. Then you can optimize the master, and push the optimized index to the slaves. If you are running a single solr instance, or if you are going to run this on a slave be aware tha...
[ "Search", "queries", "fast", "but", "it", "is", "a", "very", "expensive", "operation", ".", "The", "ideal", "process", "is", "to", "run", "this", "with", "a", "master", "/", "slave", "configuration", ".", "Then", "you", "can", "optimize", "the", "master", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L549-L597
train
saltstack/salt
salt/modules/solr.py
ping
def ping(host=None, core_name=None): ''' Does a health check on solr, makes sure solr can talk to the indexes. 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 ...
python
def ping(host=None, core_name=None): ''' Does a health check on solr, makes sure solr can talk to the indexes. 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 ...
[ "def", "ping", "(", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "if", "_get_none_or_value", "(", "core_name", ")", "is", "None", "and", "_check_for_cores", "(", ")", ":", "success", "=", "True",...
Does a health check on solr, makes sure solr can talk to the indexes. 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. ...
[ "Does", "a", "health", "check", "on", "solr", "makes", "sure", "solr", "can", "talk", "to", "the", "indexes", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L600-L634
train
saltstack/salt
salt/modules/solr.py
is_replication_enabled
def is_replication_enabled(host=None, core_name=None): ''' SLAVE CALL Check for errors, and determine if a slave is replicating or not. 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 ...
python
def is_replication_enabled(host=None, core_name=None): ''' SLAVE CALL Check for errors, and determine if a slave is replicating or not. 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 ...
[ "def", "is_replication_enabled", "(", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "success", "=", "True", "# since only slaves can call this let's check the config:", "if", "_is_master", "(", ")", "and", ...
SLAVE CALL Check for errors, and determine if a slave is replicating or not. 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 al...
[ "SLAVE", "CALL", "Check", "for", "errors", "and", "determine", "if", "a", "slave", "is", "replicating", "or", "not", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L637-L708
train
saltstack/salt
salt/modules/solr.py
match_index_versions
def match_index_versions(host=None, core_name=None): ''' SLAVE CALL Verifies that the master and the slave versions are in sync by comparing the index version. If you are constantly pushing updates the index the master and slave versions will seldom match. A solution to this is pause indexing ev...
python
def match_index_versions(host=None, core_name=None): ''' SLAVE CALL Verifies that the master and the slave versions are in sync by comparing the index version. If you are constantly pushing updates the index the master and slave versions will seldom match. A solution to this is pause indexing ev...
[ "def", "match_index_versions", "(", "host", "=", "None", ",", "core_name", "=", "None", ")", ":", "# since only slaves can call this let's check the config:", "ret", "=", "_get_return_dict", "(", ")", "success", "=", "True", "if", "_is_master", "(", ")", "and", "_...
SLAVE CALL Verifies that the master and the slave versions are in sync by comparing the index version. If you are constantly pushing updates the index the master and slave versions will seldom match. A solution to this is pause indexing every so often to allow the slave to replicate and then call th...
[ "SLAVE", "CALL", "Verifies", "that", "the", "master", "and", "the", "slave", "versions", "are", "in", "sync", "by", "comparing", "the", "index", "version", ".", "If", "you", "are", "constantly", "pushing", "updates", "the", "index", "the", "master", "and", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L711-L800
train
saltstack/salt
salt/modules/solr.py
replication_details
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...
python
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", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "if", "_get_none_or_value", "(", "core_name", ")", "is", "None", ":", "success", "=", "True", "for", "name", "in", ...
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>:: ...
[ "Get", "the", "full", "replication", "details", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L803-L838
train
saltstack/salt
salt/modules/solr.py
backup
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...
python
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", ")", ":", "path", "=", "__opts__", "[", "'solr.backup_path'", "]", "num_backups", "=", "__opts__", "[", "'solr.num_backups'", "]", "if", "path...
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...
[ "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"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L841-L899
train
saltstack/salt
salt/modules/solr.py
set_is_polling
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...
python
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", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "# since only slaves can call this let's check the config:", "if", "_is_master", "(", ")", "and", "_get_none_or_valu...
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...
[ "SLAVE", "CALL", "Prevent", "the", "slaves", "from", "polling", "the", "master", "for", "updates", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L902-L945
train
saltstack/salt
salt/modules/solr.py
set_replication_enabled
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...
python
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", ")", ":", "if", "not", "_is_master", "(", ")", "and", "_get_none_or_value", "(", "host", ")", "is", "None", ":", "return", "_get_return_dict", "(", "F...
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__[...
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L948-L993
train
saltstack/salt
salt/modules/solr.py
signal
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...
python
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", ")", ":", "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"...
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', '...
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L996-L1022
train
saltstack/salt
salt/modules/solr.py
reload_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, ...
python
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", ")", ":", "ret", "=", "_get_return_dict", "(", ")", "if", "not", "_check_for_cores", "(", ")", ":", "err", "=", "[", "'solr.reload_core can only be called by \"multi-core\" minions'", ...
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...
[ "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"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1025-L1069
train
saltstack/salt
salt/modules/solr.py
reload_import_config
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 ...
python
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", ")", ":", "# make sure that it's a master minion", "if", "not", "_is_master", "(", ")", "and", "_get_none_or_value", "(", "host"...
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...
[ "MASTER", "ONLY", "re", "-", "loads", "the", "handler", "config", "XML", "file", ".", "This", "command", "can", "only", "be", "run", "if", "the", "minion", "is", "a", "master", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1114-L1154
train
saltstack/salt
salt/modules/solr.py
full_import
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...
python
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", ")", ":", "options", "=", "{", "}", "if", "options", "is", "None", "else", "options", "extra", "=",...
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...
[ "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", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1198-L1252
train
saltstack/salt
salt/modules/solr.py
import_status
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...
python
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", ")", ":", "if", "not", "_is_master", "(", ")", "and", "_get_none_or_value", "(", "host", ")", "is", "None", ":", "errors", "=...
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...
[ "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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1309-L1342
train
saltstack/salt
salt/utils/decorators/__init__.py
timing
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...
python
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", ")", ":", "@", "wraps", "(", "function", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "ret", "=", "function", "(", "*", "args", ","...
Decorator wrapper to log execution time, for profiling purposes
[ "Decorator", "wrapper", "to", "log", "execution", "time", "for", "profiling", "purposes" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L220-L238
train
saltstack/salt
salt/utils/decorators/__init__.py
memoize
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...
python
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", ")", ":", "cache", "=", "{", "}", "@", "wraps", "(", "func", ")", "def", "_memoize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "str_args", "=", "[", "]", "for", "arg", "in", "args", ":", "if", "not", ...
Memoize aka cache the return output of a function given a specific set of arguments .. versionedited:: 2016.3.4 Added **kwargs support.
[ "Memoize", "aka", "cache", "the", "return", "output", "of", "a", "function", "given", "a", "specific", "set", "of", "arguments" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L241-L266
train
saltstack/salt
salt/utils/decorators/__init__.py
ignores_kwargs
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...
python
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", ")", ":", "def", "_ignores_kwargs", "(", "fn", ")", ":", "def", "__ignores_kwargs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs_filtered", "=", "kwargs", ".", "copy", "(", ")", "for", "...
Decorator to filter out unexpected keyword arguments from the call kwarg_names: List of argument names to ignore
[ "Decorator", "to", "filter", "out", "unexpected", "keyword", "arguments", "from", "the", "call" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L636-L651
train
saltstack/salt
salt/utils/decorators/__init__.py
ensure_unicode_args
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) ...
python
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", ")", ":", "@", "wraps", "(", "function", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "six", ".", "PY2", ":", "return", "function", "(", "*", "salt", ".", "utils", ...
Decodes all arguments passed to the wrapped function
[ "Decodes", "all", "arguments", "passed", "to", "the", "wrapped", "function" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L654-L667
train
saltstack/salt
salt/utils/decorators/__init__.py
external
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__ ...
python
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", ")", ":", "def", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "'''\n Stub.\n\n :param args:\n :param kwargs:\n :return:\n '''", "return", "func", "(", "*", "args", ",", "*", "*", "kwar...
Mark function as external. :param func: :return:
[ "Mark", "function", "as", "external", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L670-L691
train
saltstack/salt
salt/utils/decorators/__init__.py
Depends.enforce_dependencies
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...
python
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", ")", ":", "for", "dependency", ",", "dependent_dict", "in", "six", ".", "iteritems", "(", "cls", ".", "dependency_dict", "[", "kind", "]", ")", ":", "for", "(", "mod_name", ",", "f...
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.
[ "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"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L135-L214
train
saltstack/salt
salt/utils/decorators/__init__.py
_DeprecationDecorator._get_args
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
python
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", ")", ":", "_args", "=", "list", "(", ")", "_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "_args", ",", "_kwargs" ]
Discard all keywords which aren't function-specific from the kwargs. :param kwargs: :return:
[ "Discard", "all", "keywords", "which", "aren", "t", "function", "-", "specific", "from", "the", "kwargs", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L295-L305
train
saltstack/salt
salt/utils/decorators/__init__.py
_DeprecationDecorator._call_function
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: ...
python
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", ")", ":", "if", "self", ".", "_raise_later", ":", "raise", "self", ".", "_raise_later", "# pylint: disable=E0702", "if", "self", ".", "_function", ":", "args", ",", "kwargs", "=", "self", ".", "_get_args",...
Call target function that has been decorated. :return:
[ "Call", "target", "function", "that", "has", "been", "decorated", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L307-L334
train
saltstack/salt
salt/utils/decorators/__init__.py
_WithDeprecated._set_function
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...
python
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", ")", ":", "full_name", "=", "\"{m_name}.{f_name}\"", ".", "format", "(", "m_name", "=", "self", ".", "_globals", ".", "get", "(", "self", ".", "MODULE_NAME", ",", "''", ")", "or", "self", ".", "_globa...
Based on the configuration, set to execute an old or a new function. :return:
[ "Based", "on", "the", "configuration", "set", "to", "execute", "an", "old", "or", "a", "new", "function", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L531-L559
train
saltstack/salt
salt/utils/decorators/__init__.py
_WithDeprecated._is_used_deprecated
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...
python
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", ")", ":", "func_path", "=", "\"{m_name}.{f_name}\"", ".", "format", "(", "m_name", "=", "self", ".", "_globals", ".", "get", "(", "self", ".", "MODULE_NAME", ",", "''", ")", "or", "self", ".", "_globals", "[", "...
Returns True, if a component configuration explicitly is asking to use an old version of the deprecated function. :return:
[ "Returns", "True", "if", "a", "component", "configuration", "explicitly", "is", "asking", "to", "use", "an", "old", "version", "of", "the", "deprecated", "function", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L561-L578
train
saltstack/salt
salt/tops/mongo.py
top
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 ``...
python
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", ")", ":", "host", "=", "__opts__", "[", "'mongo.host'", "]", "port", "=", "__opts__", "[", "'mongo.port'", "]", "collection", "=", "__opts__", "[", "'master_tops'", "]", "[", "'mongo'", "]", ".", "get", "(", "'col...
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`...
[ "Connect", "to", "a", "mongo", "database", "and", "read", "per", "-", "node", "tops", "data", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/mongo.py#L75-L141
train
saltstack/salt
salt/modules/gentoolkitmod.py
revdep_rebuild
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 ...
python
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", ")", ":", "cmd", "=", "'revdep-rebuild -i --quiet --no-progress'", "if", "lib", "is", "not", "None", ":", "cmd", "+=", "' --library={0}'", ".", "format", "(", "lib", ")", "return", "__salt__", "[", "'cmd.retcod...
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
[ "Fix", "up", "broken", "reverse", "dependencies" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L33-L51
train
saltstack/salt
salt/modules/gentoolkitmod.py
_pretty_size
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])
python
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", ")", ":", "units", "=", "[", "' G'", ",", "' M'", ",", "' K'", ",", "' B'", "]", "while", "units", "and", "size", ">=", "1000", ":", "size", "=", "size", "/", "1024.0", "units", ".", "pop", "(", ")", "return", ...
Print sizes in a similar fashion as eclean
[ "Print", "sizes", "in", "a", "similar", "fashion", "as", "eclean" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L54-L62
train
saltstack/salt
salt/modules/gentoolkitmod.py
_parse_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
python
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", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "exclude_file", ")", ":", "exclude", "=", "excludemod", ".", "parseExcludeFile", "(", "exclude_file", ",", "lambda", "x", ":", "None", ")", "else", ":", ...
Parse an exclude file. Returns a dict as defined in gentoolkit.eclean.exclude.parseExcludeFile
[ "Parse", "an", "exclude", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L65-L75
train
saltstack/salt
salt/modules/gentoolkitmod.py
eclean_dist
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...
python
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 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...
[ "Clean", "obsolete", "portage", "sources" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L78-L159
train
saltstack/salt
salt/modules/gentoolkitmod.py
eclean_pkg
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...
python
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'", ")", ":", "if", "exclude_file", "is", "None", ":", "exclude", "=", "None", "else...
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...
[ "Clean", "obsolete", "binary", "packages" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L162-L230
train
saltstack/salt
salt/modules/gentoolkitmod.py
_glsa_list_process_output
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:...
python
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", ")", ":", "ret", "=", "dict", "(", ")", "for", "line", "in", "output", ":", "try", ":", "glsa_id", ",", "status", ",", "desc", "=", "line", ".", "split", "(", "None", ",", "2", ")", "if", "'U'", "i...
Process output from glsa_check_list into a dict Returns a dict containing the glsa id, description, status, and CVEs
[ "Process", "output", "from", "glsa_check_list", "into", "a", "dict" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L233-L258
train
saltstack/salt
salt/modules/gentoolkitmod.py
glsa_check_list
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...
python
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", ")", ":", "cmd", "=", "'glsa-check --quiet --nocolor --cve --list '", "if", "isinstance", "(", "glsa_list", ",", "list", ")", ":", "for", "glsa", "in", "glsa_list", ":", "cmd", "+=", "glsa", "+", "' '", "elif", "glsa...
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 ...
[ "List", "the", "status", "of", "Gentoo", "Linux", "Security", "Advisories" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L261-L293
train
saltstack/salt
salt/modules/monit.py
summary
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...
python
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", "=", "''", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'monit summary'", "res", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "for", "line", "in", "res", ":", "if", "'daemo...
Display a summary from monit CLI Example: .. code-block:: bash salt '*' monit.summary salt '*' monit.summary <service name>
[ "Display", "a", "summary", "from", "monit" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L102-L132
train
saltstack/salt
salt/modules/monit.py
status
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'...
python
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", "=", "''", ")", ":", "cmd", "=", "'monit status'", "res", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "prostr", "=", "'Process'", "+", "' '", "*", "28", "s", "=", "res", ".", "replace", "(", "'Process'",...
Display a process status from monit CLI Example: .. code-block:: bash salt '*' monit.status salt '*' monit.status <service name>
[ "Display", "a", "process", "status", "from", "monit" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L135-L162
train
saltstack/salt
salt/modules/monit.py
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...
python
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", ")", ":", "if", "reset", ":", "id_pattern", "=", "re", ".", "compile", "(", "r'Monit id (?P<id>[^ ]+)'", ")", "cmd", "=", "'echo y|monit -r'", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "...
.. 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]
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L227-L252
train
saltstack/salt
salt/utils/state.py
search_onfail_requisites
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...
python
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", ")", ":", "onfails", "=", "[", "]", "if", "'_|-'", "in", "sid", ":", "st", "=", "salt", ".", "state", ".", "split_low_tag", "(", "sid", ")", "else", ":", "st", "=", "{", "'__id__'", ":"...
For a particular low chunk, search relevant onfail related states
[ "For", "a", "particular", "low", "chunk", "search", "relevant", "onfail", "related", "states" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L27-L77
train
saltstack/salt
salt/utils/state.py
check_onfail_requisites
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: ...
python
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", ")", ":", "nret", "=", "None", "if", "(", "state_id", "and", "state_result", "and", "highstate", "and", "isinstance", "(", "highstate", ",", "dict", ")", ...
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...
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L80-L123
train
saltstack/salt
salt/utils/state.py
check_result
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...
python
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", ")", ":", "if", "not", "isinstance", "(", "running", ",", "dict", ")", ":", "return", "False", "if", "not", "running", ":", "return", "False", "ret", "=...
Check the total return value of the run and determine if the running dict has any issues
[ "Check", "the", "total", "return", "value", "of", "the", "run", "and", "determine", "if", "the", "running", "dict", "has", "any", "issues" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L126-L161
train
saltstack/salt
salt/utils/state.py
merge_subreturn
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...
python
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", ")", ":", "if", "not", "subkey", ":", "subkey", "=", "sub_return", "[", "'name'", "]", "if", "sub_return", "[", "'result'", "]", "is", "False", ":", "# True or...
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...
[ "Update", "an", "existing", "state", "return", "(", "original_return", ")", "in", "place", "with", "another", "state", "return", "(", "sub_return", ")", "i", ".", "e", ".", "for", "a", "subresource", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L164-L215
train
saltstack/salt
salt/utils/state.py
get_sls_opts
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...
python
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", ")", ":", "opts", "=", "copy", ".", "deepcopy", "(", "opts", ")", "if", "'localconfig'", "in", "kwargs", ":", "return", "salt", ".", "config", ".", "minion_config", "(", "kwargs", "[", "'loca...
Return a copy of the opts for use, optionally load a local config on top
[ "Return", "a", "copy", "of", "the", "opts", "for", "use", "optionally", "load", "a", "local", "config", "on", "top" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L218-L248
train
saltstack/salt
salt/modules/deb_apache.py
check_site_enabled
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 ...
python
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", ")", ":", "if", "site", ".", "endswith", "(", "'.conf'", ")", ":", "site_file", "=", "site", "else", ":", "site_file", "=", "'{0}.conf'", ".", "format", "(", "site", ")", "if", "os", ".", "path", ".", "islink",...
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...
[ "Checks", "to", "see", "if", "the", "specific", "site", "symlink", "is", "in", "/", "etc", "/", "apache2", "/", "sites", "-", "enabled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L49-L73
train
saltstack/salt
salt/modules/deb_apache.py
a2dissite
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: ...
python
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", ")", ":", "ret", "=", "{", "}", "command", "=", "[", "'a2dissite'", ",", "site", "]", "try", ":", "status", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "command", ",", "python_shell", "=", "False", ")", "except", ...
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
[ "Runs", "a2dissite", "for", "the", "given", "site", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L110-L141
train
saltstack/salt
salt/modules/deb_apache.py
check_mod_enabled
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 '*' ...
python
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", ")", ":", "if", "mod", ".", "endswith", "(", "'.load'", ")", "or", "mod", ".", "endswith", "(", "'.conf'", ")", ":", "mod_file", "=", "mod", "else", ":", "mod_file", "=", "'{0}.load'", ".", "format", "(", "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 '*' apache.check_mod_enabled status.load ...
[ "Checks", "to", "see", "if", "the", "specific", "mod", "symlink", "is", "in", "/", "etc", "/", "apache2", "/", "mods", "-", "enabled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L144-L163
train
saltstack/salt
salt/modules/deb_apache.py
a2enmod
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...
python
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", ")", ":", "ret", "=", "{", "}", "command", "=", "[", "'a2enmod'", ",", "mod", "]", "try", ":", "status", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "command", ",", "python_shell", "=", "False", ")", "except", "Exce...
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
[ "Runs", "a2enmod", "for", "the", "given", "mod", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L166-L197
train
saltstack/salt
salt/modules/deb_apache.py
check_conf_enabled
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...
python
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", ")", ":", "if", "conf", ".", "endswith", "(", "'.conf'", ")", ":", "conf_file", "=", "conf", "else", ":", "conf_file", "=", "'{0}.conf'", ".", "format", "(", "conf", ")", "return", "os", ".", "path", ".", "isli...
.. 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...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L234-L254
train
saltstack/salt
salt/modules/deb_apache.py
a2enconf
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...
python
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", ")", ":", "ret", "=", "{", "}", "command", "=", "[", "'a2enconf'", ",", "conf", "]", "try", ":", "status", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "command", ",", "python_shell", "=", "False", ")", "except", "...
.. 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
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L258-L291
train
saltstack/salt
salt/modules/uwsgi.py
stats
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 '''...
python
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", ")", ":", "cmd", "=", "[", "'uwsgi'", ",", "'--connect-and-read'", ",", "'{0}'", ".", "format", "(", "socket", ")", "]", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", ...
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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uwsgi.py#L27-L45
train
saltstack/salt
salt/grains/fx2.py
_find_credentials
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...
python
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", "(", ")", ":", "usernames", "=", "[", "]", "usernames", ".", "append", "(", "__pillar__", "[", "'proxy'", "]", ".", "get", "(", "'admin_username'", ",", "'root'", ")", ")", "if", "'fallback_admin_username'", "in", "__pillar__", "....
Cycle through all the possible credentials and return the first one that works
[ "Cycle", "through", "all", "the", "possible", "credentials", "and", "return", "the", "first", "one", "that", "works" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L32-L62
train
saltstack/salt
salt/grains/fx2.py
_grains
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...
python
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", "(", ")", ":", "(", "username", ",", "password", ")", "=", "_find_credentials", "(", ")", "r", "=", "salt", ".", "modules", ".", "dracr", ".", "system_info", "(", "host", "=", "__pillar__", "[", "'proxy'", "]", "[", "'host'", "]", "...
Get the grains from the proxied device
[ "Get", "the", "grains", "from", "the", "proxied", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L65-L83
train
saltstack/salt
salt/modules/libcloud_storage.py
list_containers
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "libcloud_...
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...
[ "Return", "a", "list", "of", "containers", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L88-L113
train
saltstack/salt
salt/modules/libcloud_storage.py
list_container_objects
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "container", "=", "conn", ".", "get_container", "(", "container_name", ")", "li...
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 ...
[ "List", "container", "objects", "(", "e", ".", "g", ".", "files", ")", "for", "the", "given", "container_id", "on", "the", "given", "profile" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L116-L149
train
saltstack/salt
salt/modules/libcloud_storage.py
create_container
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_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 create_container method :type libcloud_kwargs: ``dict`` CLI Example: ...
[ "Create", "a", "container", "in", "the", "cloud" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L152-L177
train
saltstack/salt
salt/modules/libcloud_storage.py
get_container_object
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ...
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...
[ "Get", "the", "details", "for", "a", "container", "object", "(", "file", "or", "object", "in", "the", "cloud", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L208-L239
train
saltstack/salt
salt/modules/libcloud_storage.py
download_object
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...
python
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", ")", ":", "conn", "=", "_get_driver", ...
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...
[ "Download", "an", "object", "to", "the", "specified", "destination", "path", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L242-L286
train
saltstack/salt
salt/modules/libcloud_storage.py
upload_object
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...
python
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", ")", ":", "conn", "=", "_get_dri...
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 ...
[ "Upload", "an", "object", "currently", "located", "on", "a", "disk", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L289-L334
train
saltstack/salt
salt/modules/libcloud_storage.py
delete_object
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", ...
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...
[ "Delete", "an", "object", "in", "the", "cloud" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L337-L366
train
saltstack/salt
salt/modules/libcloud_storage.py
delete_container
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...
python
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", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_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's delete_container method :type libcloud_kwargs: ``dict`` :return: ...
[ "Delete", "an", "object", "container", "in", "the", "cloud" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L369-L395
train
saltstack/salt
salt/utils/vault.py
_get_token_and_url_from_master
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...
python
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", "(", ")", ":", "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...
Get a token with correct policies for the minion, and the url to the Vault service
[ "Get", "a", "token", "with", "correct", "policies", "for", "the", "minion", "and", "the", "url", "to", "the", "Vault", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L39-L92
train
saltstack/salt
salt/utils/vault.py
get_vault_connection
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']['...
python
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", "(", ")", ":", "def", "_use_local_config", "(", ")", ":", "log", ".", "debug", "(", "'Using Vault connection details from local config'", ")", "try", ":", "if", "__opts__", "[", "'vault'", "]", "[", "'auth'", "]", "[", "'method'", ...
Get the connection details for calling Vault, from local configuration if it exists, or from the master otherwise
[ "Get", "the", "connection", "details", "for", "calling", "Vault", "from", "local", "configuration", "if", "it", "exists", "or", "from", "the", "master", "otherwise" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L95-L146
train
saltstack/salt
salt/utils/vault.py
make_request
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: ...
python
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", ")", ":", "if", "not", "token", "or", "not", "vault_url", ":", "connection", "="...
Make a request to Vault
[ "Make", "a", "request", "to", "Vault" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L149-L166
train
saltstack/salt
salt/states/status.py
loadavg
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...
python
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", ")", ":", "# Monitoring state, no changes will be made so no test interface needed", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'comment'", ...
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.
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L15-L53
train
saltstack/salt
salt/states/status.py
process
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...
python
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", ")", ":", "# Monitoring state, no changes will be made so no test interface needed", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", ",", "'data'"...
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.
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L56-L81
train
saltstack/salt
salt/states/blockdev.py
tuned
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 ...
python
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", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", "kwarg_map", "=", "{", "'read-ahead'", ":", "...
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
[ "Manage", "options", "of", "block", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L51-L117
train
saltstack/salt
salt/states/blockdev.py
formatted
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...
python
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", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "'{0} already formatted with {1}'", ".", "format", "(", "...
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...
[ "Manage", "filesystems", "of", "partitions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L120-L188
train
saltstack/salt
salt/states/blockdev.py
_checkblk
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
python
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", ")", ":", "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
[ "Check", "if", "the", "blk", "exists", "and", "return", "its", "fstype", "if", "ok" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L191-L198
train
saltstack/salt
salt/modules/napalm_snmp.py
remove_config
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...
python
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: disab...
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...
[ "Removes", "a", "configuration", "element", "from", "the", "SNMP", "configuration", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_snmp.py#L84-L149
train
saltstack/salt
salt/modules/nacl.py
keygen
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "keygen", "(", "sk_file", ",", "pk_file", ...
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...
[ "Use", "libnacl", "to", "generate", "a", "keypair", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L166-L187
train
saltstack/salt
salt/modules/nacl.py
enc
def enc(data, **kwargs): ''' Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default) ''' kwargs['opts'] = __opts__ return salt.utils.nacl.enc(data, **kwargs)
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "enc", "(", "data", ",", "*", "*", "kwargs", ")" ]
Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default)
[ "Alias", "to", "{", "box_type", "}", "_encrypt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L190-L197
train
saltstack/salt
salt/modules/nacl.py
enc_file
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "enc_file", "(", "name", ",", "out", ",", "*", "*", "kwar...
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...
[ "This", "is", "a", "helper", "function", "to", "encrypt", "a", "file", "and", "return", "its", "contents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L200-L218
train
saltstack/salt
salt/modules/nacl.py
dec
def dec(data, **kwargs): ''' Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default) ''' kwargs['opts'] = __opts__ return salt.utils.nacl.dec(data, **kwargs)
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "dec", "(", "data", ",", "*", "*", "kwargs", ")" ]
Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default)
[ "Alias", "to", "{", "box_type", "}", "_decrypt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L221-L228
train
saltstack/salt
salt/modules/nacl.py
dec_file
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "dec_file", "(", "name", ",", "out", ",", "*", "*", "kwar...
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...
[ "This", "is", "a", "helper", "function", "to", "decrypt", "a", "file", "and", "return", "its", "contents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L231-L249
train
saltstack/salt
salt/modules/nacl.py
sealedbox_encrypt
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "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-call --local nacl.sealedbox_encrypt datatoenc pk_file...
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L252-L266
train
saltstack/salt
salt/modules/nacl.py
sealedbox_decrypt
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "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='pEXHQM6cuaF7A=' sk_file=/etc/salt/pki/master/nacl salt...
[ "Decrypt", "data", "using", "a", "secret", "key", "that", "was", "encrypted", "using", "a", "public", "key", "with", "nacl", ".", "sealedbox_encrypt", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L269-L282
train
saltstack/salt
salt/modules/nacl.py
secretbox_encrypt
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "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 --local nacl.secretbox_encrypt datatoenc sk_file=/etc/sa...
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L285-L299
train
saltstack/salt
salt/modules/nacl.py
secretbox_decrypt
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...
python
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", ")", ":", "kwargs", "[", "'opts'", "]", "=", "__opts__", "return", "salt", ".", "utils", ".", "nacl", ".", "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='pEXHQM6cuaF7A=' sk_file=/etc/salt/pk...
[ "Decrypt", "data", "that", "was", "encrypted", "using", "nacl", ".", "secretbox_encrypt", "using", "the", "secret", "key", "that", "was", "generated", "from", "nacl", ".", "keygen", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L302-L316
train
saltstack/salt
salt/modules/panos.py
_get_job_results
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)...
python
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", ")", ":", "if", "not", "query", ":", "raise", "CommandExecutionError", "(", "\"Query parameters cannot be empty.\"", ")", "response", "=", "__proxy__", "[", "'panos.call'", "]", "(", "query", ")", "# If the res...
Executes a query that requires a job for completion. This function will wait for the job to complete and return the results.
[ "Executes", "a", "query", "that", "requires", "a", "job", "for", "completion", ".", "This", "function", "will", "wait", "for", "the", "job", "to", "complete", "and", "return", "the", "results", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L60-L79
train
saltstack/salt
salt/modules/panos.py
deactivate_license
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 ''' ...
python
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", ")", ":", "_required_version", "=", "'7.0.0'", "if", "not", "__proxy__", "[", "'panos.is_required_version'", "]", "(", "_required_version", ")", ":", "return", "False", ",", "'The panos device requires version...
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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L162-L187
train
saltstack/salt
salt/modules/panos.py
download_software_file
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 '*...
python
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", ")", ":", "if", "not", "filename", ":", "raise", "CommandExecutionError", "(", "\"Filename option must not be none.\"", ")", "if", "not", "isinstance", "(", "synch", ",", ...
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...
[ "Download", "software", "packages", "by", "filename", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L230-L262
train
saltstack/salt
salt/modules/panos.py
download_software_version
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...
python
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", ")", ":", "if", "not", "version", ":", "raise", "CommandExecutionError", "(", "\"Version option must not be none.\"", ")", "if", "not", "isinstance", "(", "synch", ",", ...
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...
[ "Download", "software", "packages", "by", "version", "number", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L265-L297
train
saltstack/salt
salt/modules/panos.py
get_jobs
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...
python
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'", ")", ":", "if", "state", ".", "lower", "(", ")", "==", "'all'", ":", "query", "=", "{", "'type'", ":", "'op'", ",", "'cmd'", ":", "'<show><jobs><all></all></jobs></show>'", "}", "elif", "state", ".", "lower"...
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 ...
[ "List", "all", "jobs", "on", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L724-L750
train
saltstack/salt
salt/modules/panos.py
get_local_admins
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...
python
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", "(", ")", ":", "admin_list", "=", "get_users_config", "(", ")", "response", "=", "[", "]", "if", "'users'", "not", "in", "admin_list", "[", "'result'", "]", ":", "return", "response", "if", "isinstance", "(", "admin_list", "[", "...
Show all local administrator accounts. CLI Example: .. code-block:: bash salt '*' panos.get_local_admins
[ "Show", "all", "local", "administrator", "accounts", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L865-L888
train