repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/states/cron.py
env_absent
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L725-L767
[ "def _check_cron_env(user,\n name,\n value=None):\n '''\n Return the environment changes\n '''\n if value is None:\n value = \"\" # Matching value set in salt.modules.cron._render_tab\n lst = __salt__['cron.list_tab'](user)\n for env in lst['env']:\n ...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/output/highstate.py
output
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...
The HighState Outputter is only meant to be used with the state.highstate function, or a function that returns highstate return data.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L136-L183
null
# -*- coding: utf-8 -*- ''' Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on mini...
saltstack/salt
salt/output/highstate.py
_format_host
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'), ...
Main highstate formatter. can be called recursively if a nested highstate contains other highstates (ie in an orchestration)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L186-L511
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on mini...
saltstack/salt
salt/output/highstate.py
_nested_changes
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
Print the changes data using the nested outputter
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L514-L524
null
# -*- coding: utf-8 -*- ''' Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on mini...
saltstack/salt
salt/output/highstate.py
_format_changes
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...
Format the changes dict based on what the data is
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L527-L551
null
# -*- coding: utf-8 -*- ''' Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on mini...
saltstack/salt
salt/output/highstate.py
_format_terse
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: ...
Terse formatting of a message.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/highstate.py#L554-L595
null
# -*- coding: utf-8 -*- ''' Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on mini...
saltstack/salt
salt/states/kernelpkg.py
mod_watch
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kernelpkg.py#L204-L221
[ "def latest_active(name, at_time=None, **kwargs): # pylint: disable=unused-argument\n '''\n Initiate a reboot if the running kernel is not the latest one installed.\n\n .. note::\n\n This state does not install any patches. It only compares the running\n kernel version number to other kernel...
# -*- coding: utf-8 -*- ''' Manage kernel packages and active kernel version ========================================================================= Example state to install the latest kernel from package repositories: .. code-block:: yaml install-latest-kernel: kernel.latest_installed: [] Example state...
saltstack/salt
salt/modules/solr.py
_get_none_or_value
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L99-L122
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_get_return_dict
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L138-L164
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_update_return_dict
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) ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L167-L194
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_format_url
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 (...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L197-L233
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_auth
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() ...
Install an auth handler for urllib2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L236-L255
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_http_request
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L258-L281
[ "def load(fp, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.load\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_module argument)\n '''\n return kwargs.pop('_json_module', json).load(fp, **kwargs)\n", "def _auth(url):\n '''\n I...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_replication_request
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L284-L310
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_get_admin_info
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L313-L335
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_merge_options
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L350-L371
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_pre_index_check
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L374-L419
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
_find_value
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 ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L422-L456
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
lucene_version
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L461-L501
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
version
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 ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L504-L546
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
optimize
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L549-L597
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
ping
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 ...
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. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L600-L634
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
is_replication_enabled
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L637-L708
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
match_index_versions
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L711-L800
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
replication_details
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...
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>:: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L803-L838
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
backup
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L841-L899
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
set_is_polling
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L902-L945
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
set_replication_enabled
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...
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__[...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L948-L993
[ "def _get_none_or_value(value):\n '''\n PRIVATE METHOD\n Checks to see if the value of a primitive or built-in container such as\n a list, dict, set, tuple etc is empty or none. None type is returned if the\n value is empty/None/False. Number data types that are 0 will return None.\n\n value : obj...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
signal
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...
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', '...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L996-L1022
null
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
reload_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, ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1025-L1069
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
reload_import_config
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1114-L1154
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
full_import
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1198-L1252
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/modules/solr.py
import_status
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L1309-L1342
[ "def _http_request(url, request_timeout=None):\n '''\n PRIVATE METHOD\n Uses salt.utils.json.load to fetch the JSON results from the solr API.\n\n url : str\n a complete URL that can be passed to urllib.open\n request_timeout : int (None)\n The number of seconds before the timeout shoul...
# -*- coding: utf-8 -*- ''' Apache Solr Salt Module Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011 This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if...
saltstack/salt
salt/utils/decorators/__init__.py
timing
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...
Decorator wrapper to log execution time, for profiling purposes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L220-L238
null
# -*- coding: utf-8 -*- ''' Helpful decorators for module writing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import errno import inspect import logging import subprocess import sys import time from functools import wraps from collections import defaultdict # Impo...
saltstack/salt
salt/utils/decorators/__init__.py
memoize
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...
Memoize aka cache the return output of a function given a specific set of arguments .. versionedited:: 2016.3.4 Added **kwargs support.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L241-L266
null
# -*- coding: utf-8 -*- ''' Helpful decorators for module writing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import errno import inspect import logging import subprocess import sys import time from functools import wraps from collections import defaultdict # Impo...
saltstack/salt
salt/utils/decorators/__init__.py
ignores_kwargs
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...
Decorator to filter out unexpected keyword arguments from the call kwarg_names: List of argument names to ignore
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L636-L651
null
# -*- coding: utf-8 -*- ''' Helpful decorators for module writing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import errno import inspect import logging import subprocess import sys import time from functools import wraps from collections import defaultdict # Impo...
saltstack/salt
salt/utils/decorators/__init__.py
ensure_unicode_args
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) ...
Decodes all arguments passed to the wrapped function
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L654-L667
null
# -*- coding: utf-8 -*- ''' Helpful decorators for module writing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import errno import inspect import logging import subprocess import sys import time from functools import wraps from collections import defaultdict # Impo...
saltstack/salt
salt/utils/decorators/__init__.py
external
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__ ...
Mark function as external. :param func: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L670-L691
null
# -*- coding: utf-8 -*- ''' Helpful decorators for module writing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import errno import inspect import logging import subprocess import sys import time from functools import wraps from collections import defaultdict # Impo...
saltstack/salt
salt/utils/decorators/__init__.py
Depends.enforce_dependencies
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L135-L214
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
class Depends(object): ''' This decorator will check the module when it is loaded and check that the dependencies passed in are in the globals of the module. If not, it will cause the function to be unloaded (or replaced). ''' # kind -> Dependency -> list of things that depend on it dependen...
saltstack/salt
salt/utils/decorators/__init__.py
_DeprecationDecorator._get_args
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
Discard all keywords which aren't function-specific from the kwargs. :param kwargs: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L295-L305
null
class _DeprecationDecorator(object): ''' Base mix-in class for the deprecation decorator. Takes care of a common functionality, used in its derivatives. ''' OPT_IN = 1 OPT_OUT = 2 def __init__(self, globals, version): ''' Constructor. :param globals: Module globals...
saltstack/salt
salt/utils/decorators/__init__.py
_DeprecationDecorator._call_function
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: ...
Call target function that has been decorated. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L307-L334
null
class _DeprecationDecorator(object): ''' Base mix-in class for the deprecation decorator. Takes care of a common functionality, used in its derivatives. ''' OPT_IN = 1 OPT_OUT = 2 def __init__(self, globals, version): ''' Constructor. :param globals: Module globals...
saltstack/salt
salt/utils/decorators/__init__.py
_WithDeprecated._set_function
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...
Based on the configuration, set to execute an old or a new function. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L531-L559
null
class _WithDeprecated(_DeprecationDecorator): ''' This decorator should be used with the successor functions to mark them as a new and alter its behavior in a corresponding way. It is used alone if a function content or function signature needs to be replaced, leaving the name of the function same. ...
saltstack/salt
salt/utils/decorators/__init__.py
_WithDeprecated._is_used_deprecated
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...
Returns True, if a component configuration explicitly is asking to use an old version of the deprecated function. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/__init__.py#L561-L578
null
class _WithDeprecated(_DeprecationDecorator): ''' This decorator should be used with the successor functions to mark them as a new and alter its behavior in a corresponding way. It is used alone if a function content or function signature needs to be replaced, leaving the name of the function same. ...
saltstack/salt
salt/tops/mongo.py
top
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 ``...
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`...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/mongo.py#L75-L141
null
# -*- coding: utf-8 -*- ''' Read tops data from a mongodb collection This module will load tops data from a mongo collection. It uses the node's id for lookups. Salt Master Mongo Configuration =============================== The module shares the same base mongo connection variables as :py:mod:`salt.returners.mongo_...
saltstack/salt
salt/modules/gentoolkitmod.py
revdep_rebuild
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 ...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L33-L51
null
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
_pretty_size
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])
Print sizes in a similar fashion as eclean
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L54-L62
null
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
_parse_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
Parse an exclude file. Returns a dict as defined in gentoolkit.eclean.exclude.parseExcludeFile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L65-L75
null
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
eclean_dist
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L78-L159
[ "def _pretty_size(size):\n '''\n Print sizes in a similar fashion as eclean\n '''\n units = [' G', ' M', ' K', ' B']\n while units and size >= 1000:\n size = size / 1024.0\n units.pop()\n return '{0}{1}'.format(round(size, 1), units[-1])\n", "def _parse_exclude(exclude_file):\n ...
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
eclean_pkg
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L162-L230
[ "def _pretty_size(size):\n '''\n Print sizes in a similar fashion as eclean\n '''\n units = [' G', ' M', ' K', ' B']\n while units and size >= 1000:\n size = size / 1024.0\n units.pop()\n return '{0}{1}'.format(round(size, 1), units[-1])\n", "def _parse_exclude(exclude_file):\n ...
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
_glsa_list_process_output
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:...
Process output from glsa_check_list into a dict Returns a dict containing the glsa id, description, status, and CVEs
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L233-L258
null
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/gentoolkitmod.py
glsa_check_list
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoolkitmod.py#L261-L293
[ "def _glsa_list_process_output(output):\n '''\n Process output from glsa_check_list into a dict\n\n Returns a dict containing the glsa id, description, status, and CVEs\n '''\n ret = dict()\n for line in output:\n try:\n glsa_id, status, desc = line.split(None, 2)\n if...
# -*- coding: utf-8 -*- ''' Support for Gentoolkit ''' from __future__ import absolute_import, print_function, unicode_literals import os HAS_GENTOOLKIT = False # Import third party libs try: from gentoolkit.eclean import search, clean, cli, exclude as excludemod HAS_GENTOOLKIT = True except ImportError: ...
saltstack/salt
salt/modules/monit.py
summary
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...
Display a summary from monit CLI Example: .. code-block:: bash salt '*' monit.summary salt '*' monit.summary <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L102-L132
null
# -*- coding: utf-8 -*- ''' Monit service module. This module will create a monit type service watcher. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import re # Import salt libs import salt.utils.path # Function alias to make sure not to shadow built-in's __func_a...
saltstack/salt
salt/modules/monit.py
status
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'...
Display a process status from monit CLI Example: .. code-block:: bash salt '*' monit.status salt '*' monit.status <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L135-L162
null
# -*- coding: utf-8 -*- ''' Monit service module. This module will create a monit type service watcher. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import re # Import salt libs import salt.utils.path # Function alias to make sure not to shadow built-in's __func_a...
saltstack/salt
salt/modules/monit.py
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...
.. 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]
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/monit.py#L227-L252
null
# -*- coding: utf-8 -*- ''' Monit service module. This module will create a monit type service watcher. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import re # Import salt libs import salt.utils.path # Function alias to make sure not to shadow built-in's __func_a...
saltstack/salt
salt/utils/state.py
search_onfail_requisites
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...
For a particular low chunk, search relevant onfail related states
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L27-L77
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def split_low_tag(tag):\n '''\n Take a low tag and split it back into the low dict that it came from\n '''\n state, id_, name, fun = tag.split('_|-')\n\n return {'state': state,\n '__id__': id_,\n 'name': name,\n ...
# -*- coding: utf-8 -*- ''' Utility functions for state functions .. versionadded:: 2018.3.0 ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy # Import Salt libs from salt.ext import six from salt.exceptions import CommandExecutionError import salt.state _...
saltstack/salt
salt/utils/state.py
check_onfail_requisites
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: ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L80-L123
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def split_low_tag(tag):\n '''\n Take a low tag and split it back into the low dict that it came from\n '''\n state, id_, name, fun = tag.split('_|-')\n\n return {'state': state,\n '__id__': id_,\n 'name': name,\n ...
# -*- coding: utf-8 -*- ''' Utility functions for state functions .. versionadded:: 2018.3.0 ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy # Import Salt libs from salt.ext import six from salt.exceptions import CommandExecutionError import salt.state _...
saltstack/salt
salt/utils/state.py
check_result
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...
Check the total return value of the run and determine if the running dict has any issues
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L126-L161
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def check_result(running, recurse=False, highstate=None):\n '''\n Check the total return value of the run and determine if the running\n dict has any issues\n '''\n if not isinstance(running, dict):\n return False\n\n if not runn...
# -*- coding: utf-8 -*- ''' Utility functions for state functions .. versionadded:: 2018.3.0 ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy # Import Salt libs from salt.ext import six from salt.exceptions import CommandExecutionError import salt.state _...
saltstack/salt
salt/utils/state.py
merge_subreturn
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L164-L215
null
# -*- coding: utf-8 -*- ''' Utility functions for state functions .. versionadded:: 2018.3.0 ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy # Import Salt libs from salt.ext import six from salt.exceptions import CommandExecutionError import salt.state _...
saltstack/salt
salt/utils/state.py
get_sls_opts
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...
Return a copy of the opts for use, optionally load a local config on top
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/state.py#L218-L248
[ "def minion_config(path,\n env_var='SALT_MINION_CONFIG',\n defaults=None,\n cache_minion_id=False,\n ignore_config_errors=True,\n minion_id=None,\n role='minion'):\n '''\n Reads in the minion configuration fi...
# -*- coding: utf-8 -*- ''' Utility functions for state functions .. versionadded:: 2018.3.0 ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy # Import Salt libs from salt.ext import six from salt.exceptions import CommandExecutionError import salt.state _...
saltstack/salt
salt/modules/deb_apache.py
check_site_enabled
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L49-L73
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/deb_apache.py
a2dissite
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: ...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L110-L141
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/deb_apache.py
check_mod_enabled
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 '*' ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L144-L163
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/deb_apache.py
a2enmod
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L166-L197
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/deb_apache.py
check_conf_enabled
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L234-L254
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/deb_apache.py
a2enconf
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...
.. 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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_apache.py#L258-L291
null
# -*- coding: utf-8 -*- ''' Support for Apache Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the ``apache`` namespace. ''' from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/modules/uwsgi.py
stats
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 '''...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uwsgi.py#L27-L45
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' uWSGI stats server https://uwsgi-docs.readthedocs.io/en/latest/StatsServer.html :maintainer: Peter Baumgartner <pete@lincolnloop.com> :maturity: new :platform: all ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs impor...
saltstack/salt
salt/grains/fx2.py
_find_credentials
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...
Cycle through all the possible credentials and return the first one that works
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L32-L62
[ "def get_chassis_name(host=None, admin_username=None, admin_password=None):\n '''\n Get the name of a chassis.\n\n host\n The chassis host.\n\n admin_username\n The username used to access the chassis.\n\n admin_password\n The password used to access the chassis.\n\n CLI Examp...
# -*- coding: utf-8 -*- ''' Generate baseline proxy minion grains for Dell FX2 chassis. The challenge is that most of Salt isn't bootstrapped yet, so we need to repeat a bunch of things that would normally happen in proxy/fx2.py--just enough to get data from the chassis to include in grains. ''' from __future__ import ...
saltstack/salt
salt/grains/fx2.py
_grains
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...
Get the grains from the proxied device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/fx2.py#L65-L83
[ "def inventory(host=None, admin_username=None, admin_password=None):\n def mapit(x, y):\n return {x: y}\n\n fields = {}\n fields['server'] = ['name', 'idrac_version', 'blade_type', 'gen',\n 'updateable']\n fields['switch'] = ['name', 'model_name', 'hw_version', 'fw_version'...
# -*- coding: utf-8 -*- ''' Generate baseline proxy minion grains for Dell FX2 chassis. The challenge is that most of Salt isn't bootstrapped yet, so we need to repeat a bunch of things that would normally happen in proxy/fx2.py--just enough to get data from the chassis to include in grains. ''' from __future__ import ...
saltstack/salt
salt/modules/libcloud_storage.py
list_containers
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L88-L113
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
list_container_objects
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L116-L149
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
create_container
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...
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: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L152-L177
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
get_container_object
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L208-L239
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
download_object
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L242-L286
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
upload_object
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L289-L334
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
delete_object
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L337-L366
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/modules/libcloud_storage.py
delete_container
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...
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: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_storage.py#L369-L395
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Apache Libcloud Storage Management ================================== Connection module for Apache Libcloud Storage (object/blob) management for a full list of supported clouds, see http://libcloud.readthedocs.io/en/latest/storage/supported_providers.html Clouds include Amazon S3, Google S...
saltstack/salt
salt/utils/vault.py
_get_token_and_url_from_master
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...
Get a token with correct policies for the minion, and the url to the Vault service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L39-L92
[ "def sign_message(privkey_path, message, passphrase=None):\n '''\n Use Crypto.Signature.PKCS1_v1_5 to sign a message. Returns the signature.\n '''\n key = get_rsa_key(privkey_path, passphrase)\n log.debug('salt.crypt.sign_message: Signing message.')\n if HAS_M2:\n md = EVP.MessageDigest('sh...
# -*- coding: utf-8 -*- ''' :maintainer: SaltStack :maturity: new :platform: all Utilities supporting modules for Hashicorp Vault. Configuration instructions are documented in the execution module docs. ''' from __future__ import absolute_import, print_function, unicode_literals import base64 import logg...
saltstack/salt
salt/utils/vault.py
get_vault_connection
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']['...
Get the connection details for calling Vault, from local configuration if it exists, or from the master otherwise
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L95-L146
[ "def _get_token_and_url_from_master():\n '''\n Get a token with correct policies for the minion, and the url to the Vault\n service\n '''\n minion_id = __grains__['id']\n pki_dir = __opts__['pki_dir']\n\n # When rendering pillars, the module executes on the master, but the token\n # should b...
# -*- coding: utf-8 -*- ''' :maintainer: SaltStack :maturity: new :platform: all Utilities supporting modules for Hashicorp Vault. Configuration instructions are documented in the execution module docs. ''' from __future__ import absolute_import, print_function, unicode_literals import base64 import logg...
saltstack/salt
salt/utils/vault.py
make_request
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: ...
Make a request to Vault
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vault.py#L149-L166
[ "def get_vault_connection():\n '''\n Get the connection details for calling Vault, from local configuration if\n it exists, or from the master otherwise\n '''\n def _use_local_config():\n log.debug('Using Vault connection details from local config')\n try:\n if __opts__['vaul...
# -*- coding: utf-8 -*- ''' :maintainer: SaltStack :maturity: new :platform: all Utilities supporting modules for Hashicorp Vault. Configuration instructions are documented in the execution module docs. ''' from __future__ import absolute_import, print_function, unicode_literals import base64 import logg...
saltstack/salt
salt/states/status.py
loadavg
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L15-L53
null
# -*- coding: utf-8 -*- ''' Minion status monitoring Maps to the `status` execution module. ''' from __future__ import absolute_import, print_function, unicode_literals __monitor__ = [ 'loadavg', 'process', ] def process(name): ''' Return whether the specified signature is found in ...
saltstack/salt
salt/states/status.py
process
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/status.py#L56-L81
null
# -*- coding: utf-8 -*- ''' Minion status monitoring Maps to the `status` execution module. ''' from __future__ import absolute_import, print_function, unicode_literals __monitor__ = [ 'loadavg', 'process', ] def loadavg(name, maximum=None, minimum=None): ''' Return the current load ...
saltstack/salt
salt/states/blockdev.py
tuned
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 ...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L51-L117
null
# -*- coding: utf-8 -*- ''' Management of Block Devices A state module to manage blockdevices .. code-block:: yaml /dev/sda: blockdev.tuned: - read-only: True master-data: blockdev.tuned: - name: /dev/vg/master-data - read-only: True - read-ahead: 1024 .. versi...
saltstack/salt
salt/states/blockdev.py
formatted
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L120-L188
[ "def _checkblk(name):\n '''\n Check if the blk exists and return its fstype if ok\n '''\n\n blk = __salt__['cmd.run']('blkid -o value -s TYPE {0}'.format(name),\n ignore_retcode=True)\n return '' if not blk else blk\n" ]
# -*- coding: utf-8 -*- ''' Management of Block Devices A state module to manage blockdevices .. code-block:: yaml /dev/sda: blockdev.tuned: - read-only: True master-data: blockdev.tuned: - name: /dev/vg/master-data - read-only: True - read-ahead: 1024 .. versi...
saltstack/salt
salt/states/blockdev.py
_checkblk
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
Check if the blk exists and return its fstype if ok
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/blockdev.py#L191-L198
null
# -*- coding: utf-8 -*- ''' Management of Block Devices A state module to manage blockdevices .. code-block:: yaml /dev/sda: blockdev.tuned: - read-only: True master-data: blockdev.tuned: - name: /dev/vg/master-data - read-only: True - read-ahead: 1024 .. versi...
saltstack/salt
salt/modules/napalm_snmp.py
remove_config
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_snmp.py#L84-L149
null
# -*- coding: utf-8 -*- ''' NAPALM SNMP =========== Manages SNMP on network devices. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - :mod:`NAPALM proxy minion <salt.proxy.napalm>` - :mod:`NET basic features <salt.modules.napalm_net...
saltstack/salt
salt/modules/nacl.py
keygen
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L166-L187
[ "def keygen(sk_file=None, pk_file=None, **kwargs):\n '''\n Use libnacl to generate a keypair.\n\n If no `sk_file` is defined return a keypair.\n\n If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`.\n\n When the `sk_file` is already existing, but `pk_file` is not....
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
enc
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)
Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L190-L197
[ "def enc(data, **kwargs):\n '''\n Alias to `{box_type}_encrypt`\n\n box_type: secretbox, sealedbox(default)\n '''\n if 'keyfile' in kwargs:\n salt.utils.versions.warn_until(\n 'Neon',\n 'The \\'keyfile\\' argument has been deprecated and will be removed in Salt '\n ...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
enc_file
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L200-L218
[ "def enc_file(name, out=None, **kwargs):\n '''\n This is a helper function to encrypt a file and return its contents.\n\n You can provide an optional output file using `out`\n\n `name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.\n\n CLI Examples:\n\n ...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
dec
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)
Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L221-L228
[ "def dec(data, **kwargs):\n '''\n Alias to `{box_type}_decrypt`\n\n box_type: secretbox, sealedbox(default)\n '''\n if 'keyfile' in kwargs:\n salt.utils.versions.warn_until(\n 'Neon',\n 'The \\'keyfile\\' argument has been deprecated and will be removed in Salt '\n ...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
dec_file
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L231-L249
[ "def dec_file(name, out=None, **kwargs):\n '''\n This is a helper function to decrypt a file and return its contents.\n\n You can provide an optional output file using `out`\n\n `name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc.\n\n CLI Examples:\n\n ...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
sealedbox_encrypt
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L252-L266
[ "def sealedbox_encrypt(data, **kwargs):\n '''\n Encrypt data using a public key generated from `nacl.keygen`.\n The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-run nacl.sealedbox_encrypt datatoenc\n...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
sealedbox_decrypt
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L269-L282
[ "def sealedbox_decrypt(data, **kwargs):\n '''\n Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A=\n salt-call --local nacl.sealedbox_decrypt dat...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
secretbox_encrypt
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L285-L299
[ "def secretbox_encrypt(data, **kwargs):\n '''\n Encrypt data using a secret key generated from `nacl.keygen`.\n The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-run nacl.secretbox_encrypt datatoenc\n ...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/nacl.py
secretbox_decrypt
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L302-L316
[ "def secretbox_decrypt(data, **kwargs):\n '''\n Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key\n that was generated from `nacl.keygen`.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A=\n salt-call --local...
# -*- coding: utf-8 -*- ''' This module helps include encrypted passwords in pillars, grains and salt state files. :depends: libnacl, https://github.com/saltstack/libnacl This is often useful if you wish to store your pillars in source control or share your pillar data with others that you trust. I don't advise makin...
saltstack/salt
salt/modules/panos.py
_get_job_results
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)...
Executes a query that requires a job for completion. This function will wait for the job to complete and return the results.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L60-L79
[ "def get_job(jid=None):\n '''\n List all a single job by ID.\n\n jid\n The ID of the job to retrieve.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' panos.get_job jid=15\n\n '''\n if not jid:\n raise CommandExecutionError(\"ID option must not be none.\")\n\n quer...
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...
saltstack/salt
salt/modules/panos.py
deactivate_license
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 ''' ...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L162-L187
null
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...
saltstack/salt
salt/modules/panos.py
download_software_file
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 '*...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L230-L262
[ "def _get_job_results(query=None):\n '''\n Executes a query that requires a job for completion. This function will wait for the job to complete\n and return the results.\n '''\n if not query:\n raise CommandExecutionError(\"Query parameters cannot be empty.\")\n\n response = __proxy__['pano...
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...
saltstack/salt
salt/modules/panos.py
download_software_version
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L265-L297
[ "def _get_job_results(query=None):\n '''\n Executes a query that requires a job for completion. This function will wait for the job to complete\n and return the results.\n '''\n if not query:\n raise CommandExecutionError(\"Query parameters cannot be empty.\")\n\n response = __proxy__['pano...
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...
saltstack/salt
salt/modules/panos.py
get_jobs
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L724-L750
null
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...
saltstack/salt
salt/modules/panos.py
get_local_admins
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...
Show all local administrator accounts. CLI Example: .. code-block:: bash salt '*' panos.get_local_admins
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/panos.py#L865-L888
[ "def get_users_config():\n '''\n Get the local administrative user account configuration.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' panos.get_users_config\n\n '''\n query = {'type': 'config',\n 'action': 'get',\n 'xpath': '/config/mgt-config/users'}\n\n ...
# -*- coding: utf-8 -*- ''' Module to provide Palo Alto compatibility to Salt :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix .. versionadded:: 2018.3.0 Configuration ============= This module accepts connection configuration details either as paramete...