partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
delete_key_recursive
r''' .. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER ...
salt/modules/reg.py
def delete_key_recursive(hive, key, use_32bit_registry=False): r''' .. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
def delete_key_recursive(hive, key, use_32bit_registry=False): r''' .. versionadded:: 2015.5.4 Delete a registry key to include all subkeys and value/data pairs. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
[ "r", "..", "versionadded", "::", "2015", ".", "5", ".", "4" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L411-L450
[ "def", "delete_key_recursive", "(", "hive", ",", "key", ",", "use_32bit_registry", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.delete_key_recursive'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "use_32bit_registry", "=", "use_32b...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_value
r''' Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU - HKEY_USER or HKU - HKEY_CLASSES...
salt/modules/reg.py
def delete_value(hive, key, vname=None, use_32bit_registry=False): r''' Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or...
def delete_value(hive, key, vname=None, use_32bit_registry=False): r''' Delete a registry value entry or the default value for a key. Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or...
[ "r", "Delete", "a", "registry", "value", "entry", "or", "the", "default", "value", "for", "a", "key", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L453-L491
[ "def", "delete_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.delete_value'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "vname", "=", "v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
import_file
Import registry settings from a Windows ``REG`` file by invoking ``REG.EXE``. .. versionadded:: 2018.3.0 Args: source (str): The full path of the ``REG`` file. This can be either a local file path or a URL type supported by salt (e.g. ``salt://salt_master_path``) use_...
salt/modules/reg.py
def import_file(source, use_32bit_registry=False): ''' Import registry settings from a Windows ``REG`` file by invoking ``REG.EXE``. .. versionadded:: 2018.3.0 Args: source (str): The full path of the ``REG`` file. This can be either a local file path or a URL type sup...
def import_file(source, use_32bit_registry=False): ''' Import registry settings from a Windows ``REG`` file by invoking ``REG.EXE``. .. versionadded:: 2018.3.0 Args: source (str): The full path of the ``REG`` file. This can be either a local file path or a URL type sup...
[ "Import", "registry", "settings", "from", "a", "Windows", "REG", "file", "by", "invoking", "REG", ".", "EXE", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L494-L542
[ "def", "import_file", "(", "source", ",", "use_32bit_registry", "=", "False", ")", ":", "cache_path", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ")", "if", "not", "cache_path", ":", "error_msg", "=", "\"File/URL '{0}' probably invalid.\"", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Execute a command and read the output as YAML
salt/pillar/ec2_pillar.py
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 use_grain=False, minion_ids=None, tag_match_key=None, tag_match_value='asis', tag_list_key=None, tag_list_sep=';'): ''' Execute a command and read t...
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 use_grain=False, minion_ids=None, tag_match_key=None, tag_match_value='asis', tag_list_key=None, tag_list_sep=';'): ''' Execute a command and read t...
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "YAML" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/ec2_pillar.py#L108-L254
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "use_grain", "=", "False", ",", "minion_ids", "=", "None", ",", "tag_match_key", "=", "None", ",", "tag_match_value", "=", "'asis'", ",", "tag_list_key", "=", "None", ",", "t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Return an existing set of certificates
salt/pillar/venafi.py
def ext_pillar(minion_id, pillar, conf): ''' Return an existing set of certificates ''' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) ret = {} dns_names = cache.fetch('venafi/minions', minion_id) for dns_name in dns_names: data = cache.fetch('venafi/domains', dns_name) ...
def ext_pillar(minion_id, pillar, conf): ''' Return an existing set of certificates ''' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) ret = {} dns_names = cache.fetch('venafi/minions', minion_id) for dns_name in dns_names: data = cache.fetch('venafi/domains', dns_name) ...
[ "Return", "an", "existing", "set", "of", "certificates" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/venafi.py#L32-L44
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "conf", ")", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ",", "syspaths", ".", "CACHE_DIR", ")", "ret", "=", "{", "}", "dns_names", "=", "cache", ".", "fetch", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
status
Return the status for a service via s6, return pid if running CLI Example: .. code-block:: bash salt '*' s6.status <service name>
salt/modules/s6.py
def status(name, sig=None): ''' Return the status for a service via s6, return pid if running CLI Example: .. code-block:: bash salt '*' s6.status <service name> ''' cmd = 's6-svstat {0}'.format(_service_path(name)) out = __salt__['cmd.run_stdout'](cmd) try: pid = re.s...
def status(name, sig=None): ''' Return the status for a service via s6, return pid if running CLI Example: .. code-block:: bash salt '*' s6.status <service name> ''' cmd = 's6-svstat {0}'.format(_service_path(name)) out = __salt__['cmd.run_stdout'](cmd) try: pid = re.s...
[ "Return", "the", "status", "for", "a", "service", "via", "s6", "return", "pid", "if", "running" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L135-L151
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "cmd", "=", "'s6-svstat {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "out", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "cmd", ")", "try", ":", "pid", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_all
Return a list of all available services CLI Example: .. code-block:: bash salt '*' s6.get_all
salt/modules/s6.py
def get_all(): ''' Return a list of all available services CLI Example: .. code-block:: bash salt '*' s6.get_all ''' if not SERVICE_DIR: raise CommandExecutionError("Could not find service directory.") service_list = [dirname for dirname in os.l...
def get_all(): ''' Return a list of all available services CLI Example: .. code-block:: bash salt '*' s6.get_all ''' if not SERVICE_DIR: raise CommandExecutionError("Could not find service directory.") service_list = [dirname for dirname in os.l...
[ "Return", "a", "list", "of", "all", "available", "services" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L183-L198
[ "def", "get_all", "(", ")", ":", "if", "not", "SERVICE_DIR", ":", "raise", "CommandExecutionError", "(", "\"Could not find service directory.\"", ")", "service_list", "=", "[", "dirname", "for", "dirname", "in", "os", ".", "listdir", "(", "SERVICE_DIR", ")", "if...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add_host
Add a host object for the given mac. CLI Example: .. code-block:: bash salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1 Add ddns-hostname and a fixed-ip statements: .. code-block:: bash salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1 ip=10.1.1.1 ddns=true
salt/modules/omapi.py
def add_host(mac, name=None, ip=None, ddns=False, group=None, supersede_host=False): ''' Add a host object for the given mac. CLI Example: .. code-block:: bash salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1 Add ddns-hostname and a fixed-ip statements: .. code-b...
def add_host(mac, name=None, ip=None, ddns=False, group=None, supersede_host=False): ''' Add a host object for the given mac. CLI Example: .. code-block:: bash salt dhcp-server omapi.add_host ab:ab:ab:ab:ab:ab name=host1 Add ddns-hostname and a fixed-ip statements: .. code-b...
[ "Add", "a", "host", "object", "for", "the", "given", "mac", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L60-L99
[ "def", "add_host", "(", "mac", ",", "name", "=", "None", ",", "ip", "=", "None", ",", "ddns", "=", "False", ",", "group", "=", "None", ",", "supersede_host", "=", "False", ")", ":", "statements", "=", "''", "o", "=", "_conn", "(", ")", "msg", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_host
Delete the host with the given mac or name. CLI Examples: .. code-block:: bash salt dhcp-server omapi.delete_host name=host1 salt dhcp-server omapi.delete_host mac=ab:ab:ab:ab:ab:ab
salt/modules/omapi.py
def delete_host(mac=None, name=None): ''' Delete the host with the given mac or name. CLI Examples: .. code-block:: bash salt dhcp-server omapi.delete_host name=host1 salt dhcp-server omapi.delete_host mac=ab:ab:ab:ab:ab:ab ''' if not (mac or name): raise TypeError('At...
def delete_host(mac=None, name=None): ''' Delete the host with the given mac or name. CLI Examples: .. code-block:: bash salt dhcp-server omapi.delete_host name=host1 salt dhcp-server omapi.delete_host mac=ab:ab:ab:ab:ab:ab ''' if not (mac or name): raise TypeError('At...
[ "Delete", "the", "host", "with", "the", "given", "mac", "or", "name", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L102-L130
[ "def", "delete_host", "(", "mac", "=", "None", ",", "name", "=", "None", ")", ":", "if", "not", "(", "mac", "or", "name", ")", ":", "raise", "TypeError", "(", "'At least one argument is required'", ")", "o", "=", "_conn", "(", ")", "msg", "=", "omapi",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_auth
Return the auth object
salt/modules/mine.py
def _auth(): ''' Return the auth object ''' if 'auth' not in __context__: try: __context__['auth'] = salt.crypt.SAuth(__opts__) except SaltClientError: log.error('Could not authenticate with master.' 'Mine data will not be transmitted.') ...
def _auth(): ''' Return the auth object ''' if 'auth' not in __context__: try: __context__['auth'] = salt.crypt.SAuth(__opts__) except SaltClientError: log.error('Could not authenticate with master.' 'Mine data will not be transmitted.') ...
[ "Return", "the", "auth", "object" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L40-L50
[ "def", "_auth", "(", ")", ":", "if", "'auth'", "not", "in", "__context__", ":", "try", ":", "__context__", "[", "'auth'", "]", "=", "salt", ".", "crypt", ".", "SAuth", "(", "__opts__", ")", "except", "SaltClientError", ":", "log", ".", "error", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update
Execute the configured functions and send the data back up to the master. The functions to be executed are merged from the master config, pillar and minion config under the option `mine_functions`: .. code-block:: yaml mine_functions: network.ip_addrs: - eth0 disk.u...
salt/modules/mine.py
def update(clear=False, mine_functions=None): ''' Execute the configured functions and send the data back up to the master. The functions to be executed are merged from the master config, pillar and minion config under the option `mine_functions`: .. code-block:: yaml mine_functions: ...
def update(clear=False, mine_functions=None): ''' Execute the configured functions and send the data back up to the master. The functions to be executed are merged from the master config, pillar and minion config under the option `mine_functions`: .. code-block:: yaml mine_functions: ...
[ "Execute", "the", "configured", "functions", "and", "send", "the", "data", "back", "up", "to", "the", "master", ".", "The", "functions", "to", "be", "executed", "are", "merged", "from", "the", "master", "config", "pillar", "and", "minion", "config", "under",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L86-L188
[ "def", "update", "(", "clear", "=", "False", ",", "mine_functions", "=", "None", ")", ":", "m_data", "=", "{", "}", "if", "not", "mine_functions", ":", "m_data", "=", "__salt__", "[", "'config.merge'", "]", "(", "'mine_functions'", ",", "{", "}", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
send
Send a specific function to the mine. CLI Example: .. code-block:: bash salt '*' mine.send network.ip_addrs eth0 salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0
salt/modules/mine.py
def send(func, *args, **kwargs): ''' Send a specific function to the mine. CLI Example: .. code-block:: bash salt '*' mine.send network.ip_addrs eth0 salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0 ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) mi...
def send(func, *args, **kwargs): ''' Send a specific function to the mine. CLI Example: .. code-block:: bash salt '*' mine.send network.ip_addrs eth0 salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0 ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) mi...
[ "Send", "a", "specific", "function", "to", "the", "mine", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L191-L242
[ "def", "send", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "mine_func", "=", "kwargs", ".", "pop", "(", "'mine_function'", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get data from the mine based on the target, function and tgt_type Targets can be matched based on any standard matching system that can be matched on the master via these keywords: - glob - pcre - grain - grain_pcre - compound - pillar - pillar_pcre Note that all pillar matche...
salt/modules/mine.py
def get(tgt, fun, tgt_type='glob', exclude_minion=False): ''' Get data from the mine based on the target, function and tgt_type Targets can be matched based on any standard matching system that can be matched on the master via these keywords: - glob - pcre - grain ...
def get(tgt, fun, tgt_type='glob', exclude_minion=False): ''' Get data from the mine based on the target, function and tgt_type Targets can be matched based on any standard matching system that can be matched on the master via these keywords: - glob - pcre - grain ...
[ "Get", "data", "from", "the", "mine", "based", "on", "the", "target", "function", "and", "tgt_type" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L245-L339
[ "def", "get", "(", "tgt", ",", "fun", ",", "tgt_type", "=", "'glob'", ",", "exclude_minion", "=", "False", ")", ":", "if", "__opts__", "[", "'file_client'", "]", "==", "'local'", ":", "ret", "=", "{", "}", "is_target", "=", "{", "'glob'", ":", "__sal...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Remove specific function contents of minion. Returns True on success. CLI Example: .. code-block:: bash salt '*' mine.delete 'network.interfaces'
salt/modules/mine.py
def delete(fun): ''' Remove specific function contents of minion. Returns True on success. CLI Example: .. code-block:: bash salt '*' mine.delete 'network.interfaces' ''' if __opts__['file_client'] == 'local': data = __salt__['data.get']('mine_cache') if isinstance(dat...
def delete(fun): ''' Remove specific function contents of minion. Returns True on success. CLI Example: .. code-block:: bash salt '*' mine.delete 'network.interfaces' ''' if __opts__['file_client'] == 'local': data = __salt__['data.get']('mine_cache') if isinstance(dat...
[ "Remove", "specific", "function", "contents", "of", "minion", ".", "Returns", "True", "on", "success", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L342-L362
[ "def", "delete", "(", "fun", ")", ":", "if", "__opts__", "[", "'file_client'", "]", "==", "'local'", ":", "data", "=", "__salt__", "[", "'data.get'", "]", "(", "'mine_cache'", ")", "if", "isinstance", "(", "data", ",", "dict", ")", "and", "fun", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_docker
.. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. versionchanged:: 2019.2.0 :conf_minion:`docker.update_mine` now defaults to `...
salt/modules/mine.py
def get_docker(interfaces=None, cidrs=None, with_container_id=False): ''' .. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. ver...
def get_docker(interfaces=None, cidrs=None, with_container_id=False): ''' .. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. ver...
[ "..", "versionchanged", "::", "2017", ".", "7", ".", "8", "2018", ".", "3", ".", "3", "When", ":", "conf_minion", ":", "docker", ".", "update_mine", "is", "set", "to", "False", "for", "a", "given", "minion", "no", "mine", "data", "will", "be", "popul...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L384-L489
[ "def", "get_docker", "(", "interfaces", "=", "None", ",", "cidrs", "=", "None", ",", "with_container_id", "=", "False", ")", ":", "# Enforce that interface and cidr are lists", "if", "interfaces", ":", "interface_", "=", "[", "]", "interface_", ".", "extend", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
valid
List valid entries in mine configuration. CLI Example: .. code-block:: bash salt '*' mine.valid
salt/modules/mine.py
def valid(): ''' List valid entries in mine configuration. CLI Example: .. code-block:: bash salt '*' mine.valid ''' m_data = __salt__['config.merge']('mine_functions', {}) # If we don't have any mine functions configured, then we should just bail out if not m_data: re...
def valid(): ''' List valid entries in mine configuration. CLI Example: .. code-block:: bash salt '*' mine.valid ''' m_data = __salt__['config.merge']('mine_functions', {}) # If we don't have any mine functions configured, then we should just bail out if not m_data: re...
[ "List", "valid", "entries", "in", "mine", "configuration", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L492-L528
[ "def", "valid", "(", ")", ":", "m_data", "=", "__salt__", "[", "'config.merge'", "]", "(", "'mine_functions'", ",", "{", "}", ")", "# If we don't have any mine functions configured, then we should just bail out", "if", "not", "m_data", ":", "return", "data", "=", "{...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Return data to a Pg server
salt/returners/pgjsonb.py
def returner(ret): ''' Return data to a Pg server ''' try: with _get_serv(ret, commit=True) as cur: sql = '''INSERT INTO salt_returns (fun, jid, return, id, success, full_ret, alter_time) VALUES (%s, %s, %s, %s, %s, %s, to_timestamp(%s))''' ...
def returner(ret): ''' Return data to a Pg server ''' try: with _get_serv(ret, commit=True) as cur: sql = '''INSERT INTO salt_returns (fun, jid, return, id, success, full_ret, alter_time) VALUES (%s, %s, %s, %s, %s, %s, to_timestamp(%s))''' ...
[ "Return", "data", "to", "a", "Pg", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L288-L305
[ "def", "returner", "(", "ret", ")", ":", "try", ":", "with", "_get_serv", "(", "ret", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''INSERT INTO salt_returns\n (fun, jid, return, id, success, full_ret, alter_time)\n ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
event_return
Return event to Pg server Requires that configuration be enabled via 'event_return' option in master config.
salt/returners/pgjsonb.py
def event_return(events): ''' Return event to Pg server Requires that configuration be enabled via 'event_return' option in master config. ''' with _get_serv(events, commit=True) as cur: for event in events: tag = event.get('tag', '') data = event.get('data', '')...
def event_return(events): ''' Return event to Pg server Requires that configuration be enabled via 'event_return' option in master config. ''' with _get_serv(events, commit=True) as cur: for event in events: tag = event.get('tag', '') data = event.get('data', '')...
[ "Return", "event", "to", "Pg", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L308-L322
[ "def", "event_return", "(", "events", ")", ":", "with", "_get_serv", "(", "events", ",", "commit", "=", "True", ")", "as", "cur", ":", "for", "event", "in", "events", ":", "tag", "=", "event", ".", "get", "(", "'tag'", ",", "''", ")", "data", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
save_load
Save the load to the specified jid id
salt/returners/pgjsonb.py
def save_load(jid, load, minions=None): ''' Save the load to the specified jid id ''' with _get_serv(commit=True) as cur: try: cur.execute(PG_SAVE_LOAD_SQL, {'jid': jid, 'load': psycopg2.extras.Json(load)}) except psycopg2.IntegrityError: #...
def save_load(jid, load, minions=None): ''' Save the load to the specified jid id ''' with _get_serv(commit=True) as cur: try: cur.execute(PG_SAVE_LOAD_SQL, {'jid': jid, 'load': psycopg2.extras.Json(load)}) except psycopg2.IntegrityError: #...
[ "Save", "the", "load", "to", "the", "specified", "jid", "id" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L325-L337
[ "def", "save_load", "(", "jid", ",", "load", ",", "minions", "=", "None", ")", ":", "with", "_get_serv", "(", "commit", "=", "True", ")", "as", "cur", ":", "try", ":", "cur", ".", "execute", "(", "PG_SAVE_LOAD_SQL", ",", "{", "'jid'", ":", "jid", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_load
Return the load data that marks a specified jid
salt/returners/pgjsonb.py
def get_load(jid): ''' Return the load data that marks a specified jid ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT load FROM jids WHERE jid = %s;''' cur.execute(sql, (jid,)) data = cur.fetchone() if data: return data[0] return {}
def get_load(jid): ''' Return the load data that marks a specified jid ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT load FROM jids WHERE jid = %s;''' cur.execute(sql, (jid,)) data = cur.fetchone() if data: return data[0] return {}
[ "Return", "the", "load", "data", "that", "marks", "a", "specified", "jid" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L347-L358
[ "def", "get_load", "(", "jid", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT load FROM jids WHERE jid = %s;'''", "cur", ".", "execute", "(", "sql", ",", "(", "jid", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_jid
Return the information returned when the specified job id was executed
salt/returners/pgjsonb.py
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = %s''' cur.execute(sql, (jid,)) data = cur.fetchall() ...
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = %s''' cur.execute(sql, (jid,)) data = cur.fetchall() ...
[ "Return", "the", "information", "returned", "when", "the", "specified", "job", "id", "was", "executed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L361-L376
[ "def", "get_jid", "(", "jid", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT id, full_ret FROM salt_returns\n WHERE jid = %s'''", "cur", ".", "execute", "(", "sql",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_fun
Return a dict of the last function called for all minions
salt/returners/pgjsonb.py
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT s.id,s.jid, s.full_ret FROM salt_returns s JOIN ( SELECT MAX(`jid`) as jid from salt_returns GROU...
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT s.id,s.jid, s.full_ret FROM salt_returns s JOIN ( SELECT MAX(`jid`) as jid from salt_returns GROU...
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L379-L400
[ "def", "get_fun", "(", "fun", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT s.id,s.jid, s.full_ret\n FROM salt_returns s\n JOIN ( SELECT MAX(`jid`) as jid\n ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_purge_jobs
Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return:
salt/returners/pgjsonb.py
def _purge_jobs(timestamp): ''' Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return: ''' with _get_serv() as cursor: try: sql = 'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)' ...
def _purge_jobs(timestamp): ''' Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return: ''' with _get_serv() as cursor: try: sql = 'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)' ...
[ "Purge", "records", "from", "the", "returner", "tables", ".", ":", "param", "job_age_in_seconds", ":", "Purge", "jobs", "older", "than", "this", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L444-L481
[ "def", "_purge_jobs", "(", "timestamp", ")", ":", "with", "_get_serv", "(", ")", "as", "cursor", ":", "try", ":", "sql", "=", "'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)'", "cursor", ".", "execute", "(", "sql", ",", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_archive_jobs
Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return:
salt/returners/pgjsonb.py
def _archive_jobs(timestamp): ''' Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return: ''' source_tables = ['jids', 'salt_returns', 'salt_events'] with _get_serv() as cursor: ...
def _archive_jobs(timestamp): ''' Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return: ''' source_tables = ['jids', 'salt_returns', 'salt_events'] with _get_serv() as cursor: ...
[ "Copy", "rows", "to", "a", "set", "of", "backup", "tables", "then", "purge", "rows", ".", ":", "param", "timestamp", ":", "Archive", "rows", "older", "than", "this", "timestamp", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L484-L542
[ "def", "_archive_jobs", "(", "timestamp", ")", ":", "source_tables", "=", "[", "'jids'", ",", "'salt_returns'", ",", "'salt_events'", "]", "with", "_get_serv", "(", ")", "as", "cursor", ":", "target_tables", "=", "{", "}", "for", "table_name", "in", "source_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clean_old_jobs
Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return:
salt/returners/pgjsonb.py
def clean_old_jobs(): ''' Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return: ''' if __opts__.get('keep_jobs', False) and int(__opts__.get('keep_jobs', 0)) > 0: try: with _get_serv() as cur: ...
def clean_old_jobs(): ''' Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return: ''' if __opts__.get('keep_jobs', False) and int(__opts__.get('keep_jobs', 0)) > 0: try: with _get_serv() as cur: ...
[ "Called", "in", "the", "master", "s", "event", "loop", "every", "loop_interval", ".", "Archives", "and", "/", "or", "deletes", "the", "events", "and", "job", "details", "from", "the", "database", ".", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L545-L564
[ "def", "clean_old_jobs", "(", ")", ":", "if", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "False", ")", "and", "int", "(", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "0", ")", ")", ">", "0", ":", "try", ":", "with", "_get_serv", "(", ")"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cpustats
Return information about the CPU. Returns dict: A dictionary containing information about the CPU stats CLI Example: .. code-block:: bash salt * status.cpustats
salt/modules/win_status.py
def cpustats(): ''' Return information about the CPU. Returns dict: A dictionary containing information about the CPU stats CLI Example: .. code-block:: bash salt * status.cpustats ''' # Tries to gather information similar to that returned by a Linux machine # Avoid u...
def cpustats(): ''' Return information about the CPU. Returns dict: A dictionary containing information about the CPU stats CLI Example: .. code-block:: bash salt * status.cpustats ''' # Tries to gather information similar to that returned by a Linux machine # Avoid u...
[ "Return", "information", "about", "the", "CPU", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L167-L202
[ "def", "cpustats", "(", ")", ":", "# Tries to gather information similar to that returned by a Linux machine", "# Avoid using WMI as there's a lot of overhead", "# Time related info", "user", ",", "system", ",", "idle", ",", "interrupt", ",", "dpc", "=", "psutil", ".", "cpu_t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
meminfo
Return information about physical and virtual memory on the system Returns: dict: A dictionary of information about memory on the system CLI Example: .. code-block:: bash salt * status.meminfo
salt/modules/win_status.py
def meminfo(): ''' Return information about physical and virtual memory on the system Returns: dict: A dictionary of information about memory on the system CLI Example: .. code-block:: bash salt * status.meminfo ''' # Get physical memory vm_total, vm_available, vm_per...
def meminfo(): ''' Return information about physical and virtual memory on the system Returns: dict: A dictionary of information about memory on the system CLI Example: .. code-block:: bash salt * status.meminfo ''' # Get physical memory vm_total, vm_available, vm_per...
[ "Return", "information", "about", "physical", "and", "virtual", "memory", "on", "the", "system" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L205-L242
[ "def", "meminfo", "(", ")", ":", "# Get physical memory", "vm_total", ",", "vm_available", ",", "vm_percent", ",", "vm_used", ",", "vm_free", "=", "psutil", ".", "virtual_memory", "(", ")", "# Get swap memory", "swp_total", ",", "swp_used", ",", "swp_free", ",",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vmstats
Return information about the virtual memory on the machine Returns: dict: A dictionary of virtual memory stats CLI Example: .. code-block:: bash salt * status.vmstats
salt/modules/win_status.py
def vmstats(): ''' Return information about the virtual memory on the machine Returns: dict: A dictionary of virtual memory stats CLI Example: .. code-block:: bash salt * status.vmstats ''' # Setup the SPI Structure spi = SYSTEM_PERFORMANCE_INFORMATION() retlen = ...
def vmstats(): ''' Return information about the virtual memory on the machine Returns: dict: A dictionary of virtual memory stats CLI Example: .. code-block:: bash salt * status.vmstats ''' # Setup the SPI Structure spi = SYSTEM_PERFORMANCE_INFORMATION() retlen = ...
[ "Return", "information", "about", "the", "virtual", "memory", "on", "the", "machine" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L245-L272
[ "def", "vmstats", "(", ")", ":", "# Setup the SPI Structure", "spi", "=", "SYSTEM_PERFORMANCE_INFORMATION", "(", ")", "retlen", "=", "ctypes", ".", "c_ulong", "(", ")", "# 2 means to query System Performance Information and return it in a", "# SYSTEM_PERFORMANCE_INFORMATION Str...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
diskusage
.. versionadded:: 2015.8.0 Return the disk usage for this minion human_readable : False If ``True``, usage will be in KB/MB/GB etc. CLI Example: .. code-block:: bash salt '*' status.diskusage path=c:/salt
salt/modules/win_status.py
def diskusage(human_readable=False, path=None): ''' .. versionadded:: 2015.8.0 Return the disk usage for this minion human_readable : False If ``True``, usage will be in KB/MB/GB etc. CLI Example: .. code-block:: bash salt '*' status.diskusage path=c:/salt ''' if not...
def diskusage(human_readable=False, path=None): ''' .. versionadded:: 2015.8.0 Return the disk usage for this minion human_readable : False If ``True``, usage will be in KB/MB/GB etc. CLI Example: .. code-block:: bash salt '*' status.diskusage path=c:/salt ''' if not...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L322-L355
[ "def", "diskusage", "(", "human_readable", "=", "False", ",", "path", "=", "None", ")", ":", "if", "not", "path", ":", "path", "=", "'c:/'", "disk_stats", "=", "psutil", ".", "disk_usage", "(", "path", ")", "total_val", "=", "disk_stats", ".", "total", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
procs
Return the process data count : False If ``True``, this function will simply return the number of processes. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' status.procs salt '*' status.procs count
salt/modules/win_status.py
def procs(count=False): ''' Return the process data count : False If ``True``, this function will simply return the number of processes. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' status.procs salt '*' status.procs count ''' wit...
def procs(count=False): ''' Return the process data count : False If ``True``, this function will simply return the number of processes. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' status.procs salt '*' status.procs count ''' wit...
[ "Return", "the", "process", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L358-L387
[ "def", "procs", "(", "count", "=", "False", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "wmi_obj", "=", "wmi", ".", "WMI", "(", ")", "processes", "=", "wmi_obj", ".", "win32_process", "(", ")", "#this short circu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
saltmem
.. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem salt '*' status.saltmem human_readable=True
salt/modules/win_status.py
def saltmem(human_readable=False): ''' .. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem salt '*' status.saltmem hu...
def saltmem(human_readable=False): ''' .. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem salt '*' status.saltmem hu...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L390-L416
[ "def", "saltmem", "(", "human_readable", "=", "False", ")", ":", "# psutil.Process defaults to current process (`os.getpid()`)", "p", "=", "psutil", ".", "Process", "(", ")", "# Use oneshot to get a snapshot", "with", "p", ".", "oneshot", "(", ")", ":", "mem", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
uptime
.. versionadded:: 2015.8.0 Return the system uptime for the machine Args: human_readable (bool): Return uptime in human readable format if ``True``, otherwise return seconds. Default is ``False`` .. note:: Human readable format is ``days, hours:min...
salt/modules/win_status.py
def uptime(human_readable=False): ''' .. versionadded:: 2015.8.0 Return the system uptime for the machine Args: human_readable (bool): Return uptime in human readable format if ``True``, otherwise return seconds. Default is ``False`` .. note:: ...
def uptime(human_readable=False): ''' .. versionadded:: 2015.8.0 Return the system uptime for the machine Args: human_readable (bool): Return uptime in human readable format if ``True``, otherwise return seconds. Default is ``False`` .. note:: ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L419-L453
[ "def", "uptime", "(", "human_readable", "=", "False", ")", ":", "# Get startup time", "startup_time", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "psutil", ".", "boot_time", "(", ")", ")", "# Subtract startup time from current time to get the uptime of ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_process_info
Return process information
salt/modules/win_status.py
def _get_process_info(proc): ''' Return process information ''' cmd = salt.utils.stringutils.to_unicode(proc.CommandLine or '') name = salt.utils.stringutils.to_unicode(proc.Name) info = dict( cmd=cmd, name=name, **_get_process_owner(proc) ) return info
def _get_process_info(proc): ''' Return process information ''' cmd = salt.utils.stringutils.to_unicode(proc.CommandLine or '') name = salt.utils.stringutils.to_unicode(proc.Name) info = dict( cmd=cmd, name=name, **_get_process_owner(proc) ) return info
[ "Return", "process", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L456-L467
[ "def", "_get_process_info", "(", "proc", ")", ":", "cmd", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "proc", ".", "CommandLine", "or", "''", ")", "name", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
master
.. versionadded:: 2015.5.0 Fire an event if the minion gets disconnected from its master. This function is meant to be run via a scheduled job from the minion. If master_ip is an FQDN/Hostname, is must be resolvable to a valid IPv4 address. CLI Example: .. code-block:: bash salt '*' ...
salt/modules/win_status.py
def master(master=None, connected=True): ''' .. versionadded:: 2015.5.0 Fire an event if the minion gets disconnected from its master. This function is meant to be run via a scheduled job from the minion. If master_ip is an FQDN/Hostname, is must be resolvable to a valid IPv4 address. CLI ...
def master(master=None, connected=True): ''' .. versionadded:: 2015.5.0 Fire an event if the minion gets disconnected from its master. This function is meant to be run via a scheduled job from the minion. If master_ip is an FQDN/Hostname, is must be resolvable to a valid IPv4 address. CLI ...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L506-L589
[ "def", "master", "(", "master", "=", "None", ",", "connected", "=", "True", ")", ":", "def", "_win_remotes_on", "(", "port", ")", ":", "'''\n Windows specific helper function.\n Returns set of ipv4 host addresses of remote established connections\n on local o...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_config_exists
Verify the config file is present
salt/modules/poudriere.py
def _check_config_exists(config_file=None): ''' Verify the config file is present ''' if config_file is None: config_file = _config_file() if not os.path.isfile(config_file): return False return True
def _check_config_exists(config_file=None): ''' Verify the config file is present ''' if config_file is None: config_file = _config_file() if not os.path.isfile(config_file): return False return True
[ "Verify", "the", "config", "file", "is", "present" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L43-L51
[ "def", "_check_config_exists", "(", "config_file", "=", "None", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "_config_file", "(", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "config_file", ")", ":", "return", "False", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_jail
Return True if jail exists False if not CLI Example: .. code-block:: bash salt '*' poudriere.is_jail <jail name>
salt/modules/poudriere.py
def is_jail(name): ''' Return True if jail exists False if not CLI Example: .. code-block:: bash salt '*' poudriere.is_jail <jail name> ''' jails = list_jails() for jail in jails: if jail.split()[0] == name: return True return False
def is_jail(name): ''' Return True if jail exists False if not CLI Example: .. code-block:: bash salt '*' poudriere.is_jail <jail name> ''' jails = list_jails() for jail in jails: if jail.split()[0] == name: return True return False
[ "Return", "True", "if", "jail", "exists", "False", "if", "not" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L54-L68
[ "def", "is_jail", "(", "name", ")", ":", "jails", "=", "list_jails", "(", ")", "for", "jail", "in", "jails", ":", "if", "jail", ".", "split", "(", ")", "[", "0", "]", "==", "name", ":", "return", "True", "return", "False" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
make_pkgng_aware
Make jail ``jname`` pkgng aware CLI Example: .. code-block:: bash salt '*' poudriere.make_pkgng_aware <jail name>
salt/modules/poudriere.py
def make_pkgng_aware(jname): ''' Make jail ``jname`` pkgng aware CLI Example: .. code-block:: bash salt '*' poudriere.make_pkgng_aware <jail name> ''' ret = {'changes': {}} cdir = _config_dir() # ensure cdir is there if not os.path.isdir(cdir): os.makedirs(cdir) ...
def make_pkgng_aware(jname): ''' Make jail ``jname`` pkgng aware CLI Example: .. code-block:: bash salt '*' poudriere.make_pkgng_aware <jail name> ''' ret = {'changes': {}} cdir = _config_dir() # ensure cdir is there if not os.path.isdir(cdir): os.makedirs(cdir) ...
[ "Make", "jail", "jname", "pkgng", "aware" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L71-L103
[ "def", "make_pkgng_aware", "(", "jname", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", "}", "cdir", "=", "_config_dir", "(", ")", "# ensure cdir is there", "if", "not", "os", ".", "path", ".", "isdir", "(", "cdir", ")", ":", "os", ".", "make...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
parse_config
Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config
salt/modules/poudriere.py
def parse_config(config_file=None): ''' Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config ''' if config_file is None: config_file = _config_file() ret = {} if _check_config_exists(config_file): ...
def parse_config(config_file=None): ''' Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config ''' if config_file is None: config_file = _config_file() ret = {} if _check_config_exists(config_file): ...
[ "Returns", "a", "dict", "of", "poudriere", "main", "configuration", "definitions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L106-L126
[ "def", "parse_config", "(", "config_file", "=", "None", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "_config_file", "(", ")", "ret", "=", "{", "}", "if", "_check_config_exists", "(", "config_file", ")", ":", "with", "salt", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_jail
Creates a new poudriere jail if one does not exist *NOTE* creating a new jail will take some time the master is not hanging CLI Example: .. code-block:: bash salt '*' poudriere.create_jail 90amd64 amd64
salt/modules/poudriere.py
def create_jail(name, arch, version="9.0-RELEASE"): ''' Creates a new poudriere jail if one does not exist *NOTE* creating a new jail will take some time the master is not hanging CLI Example: .. code-block:: bash salt '*' poudriere.create_jail 90amd64 amd64 ''' # Config file mus...
def create_jail(name, arch, version="9.0-RELEASE"): ''' Creates a new poudriere jail if one does not exist *NOTE* creating a new jail will take some time the master is not hanging CLI Example: .. code-block:: bash salt '*' poudriere.create_jail 90amd64 amd64 ''' # Config file mus...
[ "Creates", "a", "new", "poudriere", "jail", "if", "one", "does", "not", "exist" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L175-L204
[ "def", "create_jail", "(", "name", ",", "arch", ",", "version", "=", "\"9.0-RELEASE\"", ")", ":", "# Config file must be on system to create a poudriere jail", "_check_config_exists", "(", ")", "# Check if the jail is there", "if", "is_jail", "(", "name", ")", ":", "ret...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_jail
Run freebsd-update on `name` poudriere jail CLI Example: .. code-block:: bash salt '*' poudriere.update_jail freebsd:10:x86:64
salt/modules/poudriere.py
def update_jail(name): ''' Run freebsd-update on `name` poudriere jail CLI Example: .. code-block:: bash salt '*' poudriere.update_jail freebsd:10:x86:64 ''' if is_jail(name): cmd = 'poudriere jail -u -j {0}'.format(name) ret = __salt__['cmd.run'](cmd) return r...
def update_jail(name): ''' Run freebsd-update on `name` poudriere jail CLI Example: .. code-block:: bash salt '*' poudriere.update_jail freebsd:10:x86:64 ''' if is_jail(name): cmd = 'poudriere jail -u -j {0}'.format(name) ret = __salt__['cmd.run'](cmd) return r...
[ "Run", "freebsd", "-", "update", "on", "name", "poudriere", "jail" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L207-L222
[ "def", "update_jail", "(", "name", ")", ":", "if", "is_jail", "(", "name", ")", ":", "cmd", "=", "'poudriere jail -u -j {0}'", ".", "format", "(", "name", ")", "ret", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "return", "ret", "else", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_jail
Deletes poudriere jail with `name` CLI Example: .. code-block:: bash salt '*' poudriere.delete_jail 90amd64
salt/modules/poudriere.py
def delete_jail(name): ''' Deletes poudriere jail with `name` CLI Example: .. code-block:: bash salt '*' poudriere.delete_jail 90amd64 ''' if is_jail(name): cmd = 'poudriere jail -d -j {0}'.format(name) __salt__['cmd.run'](cmd) # Make sure jail is gone ...
def delete_jail(name): ''' Deletes poudriere jail with `name` CLI Example: .. code-block:: bash salt '*' poudriere.delete_jail 90amd64 ''' if is_jail(name): cmd = 'poudriere jail -d -j {0}'.format(name) __salt__['cmd.run'](cmd) # Make sure jail is gone ...
[ "Deletes", "poudriere", "jail", "with", "name" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L225-L257
[ "def", "delete_jail", "(", "name", ")", ":", "if", "is_jail", "(", "name", ")", ":", "cmd", "=", "'poudriere jail -d -j {0}'", ".", "format", "(", "name", ")", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# Make sure jail is gone", "if", "is_jail", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_ports_tree
Updates the ports tree, either the default or the `ports_tree` specified CLI Example: .. code-block:: bash salt '*' poudriere.update_ports_tree staging
salt/modules/poudriere.py
def update_ports_tree(ports_tree): ''' Updates the ports tree, either the default or the `ports_tree` specified CLI Example: .. code-block:: bash salt '*' poudriere.update_ports_tree staging ''' _check_config_exists() if ports_tree: cmd = 'poudriere ports -u -p {0}'.format...
def update_ports_tree(ports_tree): ''' Updates the ports tree, either the default or the `ports_tree` specified CLI Example: .. code-block:: bash salt '*' poudriere.update_ports_tree staging ''' _check_config_exists() if ports_tree: cmd = 'poudriere ports -u -p {0}'.format...
[ "Updates", "the", "ports", "tree", "either", "the", "default", "or", "the", "ports_tree", "specified" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L270-L286
[ "def", "update_ports_tree", "(", "ports_tree", ")", ":", "_check_config_exists", "(", ")", "if", "ports_tree", ":", "cmd", "=", "'poudriere ports -u -p {0}'", ".", "format", "(", "ports_tree", ")", "else", ":", "cmd", "=", "'poudriere ports -u'", "ret", "=", "__...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
bulk_build
Run bulk build on poudriere server. Return number of pkg builds, failures, and errors, on error dump to CLI CLI Example: .. code-block:: bash salt -N buildbox_group poudriere.bulk_build 90amd64 /root/pkg_list
salt/modules/poudriere.py
def bulk_build(jail, pkg_file, keep=False): ''' Run bulk build on poudriere server. Return number of pkg builds, failures, and errors, on error dump to CLI CLI Example: .. code-block:: bash salt -N buildbox_group poudriere.bulk_build 90amd64 /root/pkg_list ''' # make sure `pkg f...
def bulk_build(jail, pkg_file, keep=False): ''' Run bulk build on poudriere server. Return number of pkg builds, failures, and errors, on error dump to CLI CLI Example: .. code-block:: bash salt -N buildbox_group poudriere.bulk_build 90amd64 /root/pkg_list ''' # make sure `pkg f...
[ "Run", "bulk", "build", "on", "poudriere", "server", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L289-L321
[ "def", "bulk_build", "(", "jail", ",", "pkg_file", ",", "keep", "=", "False", ")", ":", "# make sure `pkg file` and jail is on file system", "if", "not", "os", ".", "path", ".", "isfile", "(", "pkg_file", ")", ":", "return", "'Could not find file {0} on filesystem'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_update_nilrt_restart_state
NILRT systems determine whether to reboot after various package operations including but not limited to kernel module installs/removals by checking specific file md5sums & timestamps. These files are touched/modified by the post-install/post-remove functions of their respective packages. The opkg modul...
salt/modules/opkg.py
def _update_nilrt_restart_state(): ''' NILRT systems determine whether to reboot after various package operations including but not limited to kernel module installs/removals by checking specific file md5sums & timestamps. These files are touched/modified by the post-install/post-remove functions of...
def _update_nilrt_restart_state(): ''' NILRT systems determine whether to reboot after various package operations including but not limited to kernel module installs/removals by checking specific file md5sums & timestamps. These files are touched/modified by the post-install/post-remove functions of...
[ "NILRT", "systems", "determine", "whether", "to", "reboot", "after", "various", "package", "operations", "including", "but", "not", "limited", "to", "kernel", "module", "installs", "/", "removals", "by", "checking", "specific", "file", "md5sums", "&", "timestamps"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L63-L106
[ "def", "_update_nilrt_restart_state", "(", ")", ":", "__salt__", "[", "'cmd.shell'", "]", "(", "'stat -c %Y /lib/modules/$(uname -r)/modules.dep >{0}/modules.dep.timestamp'", ".", "format", "(", "NILRT_RESTARTCHECK_STATE_PATH", ")", ")", "__salt__", "[", "'cmd.shell'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_restartcheck_result
Return restartcheck result and append errors (if any) to ``errors``
salt/modules/opkg.py
def _get_restartcheck_result(errors): ''' Return restartcheck result and append errors (if any) to ``errors`` ''' rs_result = __salt__['restartcheck.restartcheck'](verbose=False) if isinstance(rs_result, dict) and 'comment' in rs_result: errors.append(rs_result['comment']) return rs_resu...
def _get_restartcheck_result(errors): ''' Return restartcheck result and append errors (if any) to ``errors`` ''' rs_result = __salt__['restartcheck.restartcheck'](verbose=False) if isinstance(rs_result, dict) and 'comment' in rs_result: errors.append(rs_result['comment']) return rs_resu...
[ "Return", "restartcheck", "result", "and", "append", "errors", "(", "if", "any", ")", "to", "errors" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L109-L116
[ "def", "_get_restartcheck_result", "(", "errors", ")", ":", "rs_result", "=", "__salt__", "[", "'restartcheck.restartcheck'", "]", "(", "verbose", "=", "False", ")", "if", "isinstance", "(", "rs_result", ",", "dict", ")", "and", "'comment'", "in", "rs_result", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_process_restartcheck_result
Check restartcheck output to see if system/service restarts were requested and take appropriate action.
salt/modules/opkg.py
def _process_restartcheck_result(rs_result, **kwargs): ''' Check restartcheck output to see if system/service restarts were requested and take appropriate action. ''' if 'No packages seem to need to be restarted' in rs_result: return reboot_required = False for rstr in rs_result: ...
def _process_restartcheck_result(rs_result, **kwargs): ''' Check restartcheck output to see if system/service restarts were requested and take appropriate action. ''' if 'No packages seem to need to be restarted' in rs_result: return reboot_required = False for rstr in rs_result: ...
[ "Check", "restartcheck", "output", "to", "see", "if", "system", "/", "service", "restarts", "were", "requested", "and", "take", "appropriate", "action", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L119-L137
[ "def", "_process_restartcheck_result", "(", "rs_result", ",", "*", "*", "kwargs", ")", ":", "if", "'No packages seem to need to be restarted'", "in", "rs_result", ":", "return", "reboot_required", "=", "False", "for", "rstr", "in", "rs_result", ":", "if", "'System r...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
refresh_db
Updates the opkg database to latest packages based upon repositories Returns a dict, with the keys being package databases and the values being the result of the update attempt. Values can be one of the following: - ``True``: Database updated successfully - ``False``: Problem updating database fa...
salt/modules/opkg.py
def refresh_db(failhard=False, **kwargs): # pylint: disable=unused-argument ''' Updates the opkg database to latest packages based upon repositories Returns a dict, with the keys being package databases and the values being the result of the update attempt. Values can be one of the following: - `...
def refresh_db(failhard=False, **kwargs): # pylint: disable=unused-argument ''' Updates the opkg database to latest packages based upon repositories Returns a dict, with the keys being package databases and the values being the result of the update attempt. Values can be one of the following: - `...
[ "Updates", "the", "opkg", "database", "to", "latest", "packages", "based", "upon", "repositories" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L231-L294
[ "def", "refresh_db", "(", "failhard", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_build_install_command_list
Builds a list of install commands to be executed in sequence in order to process each of the to_install, to_downgrade, and to_reinstall lists.
salt/modules/opkg.py
def _build_install_command_list(cmd_prefix, to_install, to_downgrade, to_reinstall): ''' Builds a list of install commands to be executed in sequence in order to process each of the to_install, to_downgrade, and to_reinstall lists. ''' cmds = [] if to_install: cmd = copy.deepcopy(cmd_pre...
def _build_install_command_list(cmd_prefix, to_install, to_downgrade, to_reinstall): ''' Builds a list of install commands to be executed in sequence in order to process each of the to_install, to_downgrade, and to_reinstall lists. ''' cmds = [] if to_install: cmd = copy.deepcopy(cmd_pre...
[ "Builds", "a", "list", "of", "install", "commands", "to", "be", "executed", "in", "sequence", "in", "order", "to", "process", "each", "of", "the", "to_install", "to_downgrade", "and", "to_reinstall", "lists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L312-L333
[ "def", "_build_install_command_list", "(", "cmd_prefix", ",", "to_install", ",", "to_downgrade", ",", "to_reinstall", ")", ":", "cmds", "=", "[", "]", "if", "to_install", ":", "cmd", "=", "copy", ".", "deepcopy", "(", "cmd_prefix", ")", "cmd", ".", "extend",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_reported_packages_from_install_output
Parses the output of "opkg install" to determine what packages would have been installed by an operation run with the --noaction flag. We are looking for lines like: Installing <package> (<version>) on <target> or Upgrading <package> from <oldVersion> to <version> on root
salt/modules/opkg.py
def _parse_reported_packages_from_install_output(output): ''' Parses the output of "opkg install" to determine what packages would have been installed by an operation run with the --noaction flag. We are looking for lines like: Installing <package> (<version>) on <target> or Upgradi...
def _parse_reported_packages_from_install_output(output): ''' Parses the output of "opkg install" to determine what packages would have been installed by an operation run with the --noaction flag. We are looking for lines like: Installing <package> (<version>) on <target> or Upgradi...
[ "Parses", "the", "output", "of", "opkg", "install", "to", "determine", "what", "packages", "would", "have", "been", "installed", "by", "an", "operation", "run", "with", "the", "--", "noaction", "flag", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L336-L356
[ "def", "_parse_reported_packages_from_install_output", "(", "output", ")", ":", "reported_pkgs", "=", "{", "}", "install_pattern", "=", "re", ".", "compile", "(", "r'Installing\\s(?P<package>.*?)\\s\\((?P<version>.*?)\\)\\son\\s(?P<target>.*?)'", ")", "upgrade_pattern", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_execute_install_command
Executes a command for the install operation. If the command fails, its error output will be appended to the errors list. If the command succeeds and parse_output is true, updated packages will be appended to the parsed_packages dictionary.
salt/modules/opkg.py
def _execute_install_command(cmd, parse_output, errors, parsed_packages): ''' Executes a command for the install operation. If the command fails, its error output will be appended to the errors list. If the command succeeds and parse_output is true, updated packages will be appended to the parsed_pa...
def _execute_install_command(cmd, parse_output, errors, parsed_packages): ''' Executes a command for the install operation. If the command fails, its error output will be appended to the errors list. If the command succeeds and parse_output is true, updated packages will be appended to the parsed_pa...
[ "Executes", "a", "command", "for", "the", "install", "operation", ".", "If", "the", "command", "fails", "its", "error", "output", "will", "be", "appended", "to", "the", "errors", "list", ".", "If", "the", "command", "succeeds", "and", "parse_output", "is", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L359-L377
[ "def", "_execute_install_command", "(", "cmd", ",", "parse_output", ",", "errors", ",", "parsed_packages", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'trace'", ",", "python_shell", "=", "False", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install
Install the passed package, add refresh=True to update the opkg database. name The name of the package to be installed. Note that this parameter is ignored if either "pkgs" or "sources" is passed. Additionally, please note that this option can only be used to install packages from a ...
salt/modules/opkg.py
def install(name=None, refresh=False, pkgs=None, sources=None, reinstall=False, **kwargs): ''' Install the passed package, add refresh=True to update the opkg database. name The name of the package to be installed. Note that this parameter...
def install(name=None, refresh=False, pkgs=None, sources=None, reinstall=False, **kwargs): ''' Install the passed package, add refresh=True to update the opkg database. name The name of the package to be installed. Note that this parameter...
[ "Install", "the", "passed", "package", "add", "refresh", "=", "True", "to", "update", "the", "opkg", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L380-L587
[ "def", "install", "(", "name", "=", "None", ",", "refresh", "=", "False", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "reinstall", "=", "False", ",", "*", "*", "kwargs", ")", ":", "refreshdb", "=", "salt", ".", "utils", ".", "data",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_reported_packages_from_remove_output
Parses the output of "opkg remove" to determine what packages would have been removed by an operation run with the --noaction flag. We are looking for lines like Removing <package> (<version>) from <Target>...
salt/modules/opkg.py
def _parse_reported_packages_from_remove_output(output): ''' Parses the output of "opkg remove" to determine what packages would have been removed by an operation run with the --noaction flag. We are looking for lines like Removing <package> (<version>) from <Target>... ''' reported_pkg...
def _parse_reported_packages_from_remove_output(output): ''' Parses the output of "opkg remove" to determine what packages would have been removed by an operation run with the --noaction flag. We are looking for lines like Removing <package> (<version>) from <Target>... ''' reported_pkg...
[ "Parses", "the", "output", "of", "opkg", "remove", "to", "determine", "what", "packages", "would", "have", "been", "removed", "by", "an", "operation", "run", "with", "the", "--", "noaction", "flag", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L590-L605
[ "def", "_parse_reported_packages_from_remove_output", "(", "output", ")", ":", "reported_pkgs", "=", "{", "}", "remove_pattern", "=", "re", ".", "compile", "(", "r'Removing\\s(?P<package>.*?)\\s\\((?P<version>.*?)\\)\\sfrom\\s(?P<target>.*?)...'", ")", "for", "line", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Remove packages using ``opkg remove``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. remove_dependencies Remov...
salt/modules/opkg.py
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=unused-argument ''' Remove packages using ``opkg remove``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name``...
def remove(name=None, pkgs=None, **kwargs): # pylint: disable=unused-argument ''' Remove packages using ``opkg remove``. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name``...
[ "Remove", "packages", "using", "opkg", "remove", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L608-L690
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "try", ":", "pkg_params", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
upgrade
Upgrades all packages via ``opkg upgrade`` Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example: .. code-block:: bash salt '*' pkg.upgrade
salt/modules/opkg.py
def upgrade(refresh=True, **kwargs): # pylint: disable=unused-argument ''' Upgrades all packages via ``opkg upgrade`` Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example...
def upgrade(refresh=True, **kwargs): # pylint: disable=unused-argument ''' Upgrades all packages via ``opkg upgrade`` Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example...
[ "Upgrades", "all", "packages", "via", "opkg", "upgrade" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L722-L773
[ "def", "upgrade", "(", "refresh", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "}", "errors", "=", "[",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
hold
Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux' CLI Example: .. code-block:: bash salt '*' pkg.hold <package name> pkgs A list of packages to hold. Must be passed as a python list. CLI Example: ...
salt/modules/opkg.py
def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 ''' Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux' CLI Example: .. code-block:: bash salt '*' pkg.hold <package name> pkgs ...
def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613 ''' Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux' CLI Example: .. code-block:: bash salt '*' pkg.hold <package name> pkgs ...
[ "Set", "package", "in", "hold", "state", "meaning", "it", "will", "not", "be", "upgraded", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L776-L844
[ "def", "hold", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "if", "not", "name", "and", "not", "pkgs", "and", "not", "sources", ":", "raise", "SaltInvocat...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_state
View package state from the opkg database Return the state of pkg
salt/modules/opkg.py
def _get_state(pkg): ''' View package state from the opkg database Return the state of pkg ''' cmd = ['opkg', 'status'] cmd.append(pkg) out = __salt__['cmd.run'](cmd, python_shell=False) state_flag = '' for line in salt.utils.itertools.split(out, '\n'): if line.startswith('S...
def _get_state(pkg): ''' View package state from the opkg database Return the state of pkg ''' cmd = ['opkg', 'status'] cmd.append(pkg) out = __salt__['cmd.run'](cmd, python_shell=False) state_flag = '' for line in salt.utils.itertools.split(out, '\n'): if line.startswith('S...
[ "View", "package", "state", "from", "the", "opkg", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L919-L933
[ "def", "_get_state", "(", "pkg", ")", ":", "cmd", "=", "[", "'opkg'", ",", "'status'", "]", "cmd", ".", "append", "(", "pkg", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "state_flag", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_state
Change package state on the opkg database The state can be any of: - hold - noprune - user - ok - installed - unpacked This command is commonly used to mark a specific package to be held from being upgraded, that is, to be kept at a certain version. Returns a dict conta...
salt/modules/opkg.py
def _set_state(pkg, state): ''' Change package state on the opkg database The state can be any of: - hold - noprune - user - ok - installed - unpacked This command is commonly used to mark a specific package to be held from being upgraded, that is, to be kept at a ce...
def _set_state(pkg, state): ''' Change package state on the opkg database The state can be any of: - hold - noprune - user - ok - installed - unpacked This command is commonly used to mark a specific package to be held from being upgraded, that is, to be kept at a ce...
[ "Change", "package", "state", "on", "the", "opkg", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L936-L968
[ "def", "_set_state", "(", "pkg", ",", "state", ")", ":", "ret", "=", "{", "}", "valid_states", "=", "(", "'hold'", ",", "'noprune'", ",", "'user'", ",", "'ok'", ",", "'installed'", ",", "'unpacked'", ")", "if", "state", "not", "in", "valid_states", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_upgrades
List all available package upgrades. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades
salt/modules/opkg.py
def list_upgrades(refresh=True, **kwargs): # pylint: disable=unused-argument ''' List all available package upgrades. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades ''' ret = {} if salt.utils.data.is_true(refresh): refresh_db() cmd = ['opkg', 'list-upgr...
def list_upgrades(refresh=True, **kwargs): # pylint: disable=unused-argument ''' List all available package upgrades. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades ''' ret = {} if salt.utils.data.is_true(refresh): refresh_db() cmd = ['opkg', 'list-upgr...
[ "List", "all", "available", "package", "upgrades", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1018-L1051
[ "def", "list_upgrades", "(", "refresh", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "ret", "=", "{", "}", "if", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "refresh", ")", ":", "refresh_db", "(", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_convert_to_standard_attr
Helper function for _process_info_installed_output() Converts an opkg attribute name to a standard attribute name which is used across 'pkg' modules.
salt/modules/opkg.py
def _convert_to_standard_attr(attr): ''' Helper function for _process_info_installed_output() Converts an opkg attribute name to a standard attribute name which is used across 'pkg' modules. ''' ret_attr = ATTR_MAP.get(attr, None) if ret_attr is None: # All others convert to lowerca...
def _convert_to_standard_attr(attr): ''' Helper function for _process_info_installed_output() Converts an opkg attribute name to a standard attribute name which is used across 'pkg' modules. ''' ret_attr = ATTR_MAP.get(attr, None) if ret_attr is None: # All others convert to lowerca...
[ "Helper", "function", "for", "_process_info_installed_output", "()" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1054-L1065
[ "def", "_convert_to_standard_attr", "(", "attr", ")", ":", "ret_attr", "=", "ATTR_MAP", ".", "get", "(", "attr", ",", "None", ")", "if", "ret_attr", "is", "None", ":", "# All others convert to lowercase", "return", "attr", ".", "lower", "(", ")", "return", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_process_info_installed_output
Helper function for info_installed() Processes stdout output from a single invocation of 'opkg status'.
salt/modules/opkg.py
def _process_info_installed_output(out, filter_attrs): ''' Helper function for info_installed() Processes stdout output from a single invocation of 'opkg status'. ''' ret = {} name = None attrs = {} attr = None for line in salt.utils.itertools.split(out, '\n'): if line ...
def _process_info_installed_output(out, filter_attrs): ''' Helper function for info_installed() Processes stdout output from a single invocation of 'opkg status'. ''' ret = {} name = None attrs = {} attr = None for line in salt.utils.itertools.split(out, '\n'): if line ...
[ "Helper", "function", "for", "info_installed", "()" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1068-L1109
[ "def", "_process_info_installed_output", "(", "out", ",", "filter_attrs", ")", ":", "ret", "=", "{", "}", "name", "=", "None", "attrs", "=", "{", "}", "attr", "=", "None", "for", "line", "in", "salt", ".", "utils", ".", "itertools", ".", "split", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info_installed
Return the information of the named package(s), installed on the system. .. versionadded:: 2017.7.0 :param names: Names of the packages to get information about. If none are specified, will return information for all installed packages. :param attr: Comma-separated package attribu...
salt/modules/opkg.py
def info_installed(*names, **kwargs): ''' Return the information of the named package(s), installed on the system. .. versionadded:: 2017.7.0 :param names: Names of the packages to get information about. If none are specified, will return information for all installed packages. :p...
def info_installed(*names, **kwargs): ''' Return the information of the named package(s), installed on the system. .. versionadded:: 2017.7.0 :param names: Names of the packages to get information about. If none are specified, will return information for all installed packages. :p...
[ "Return", "the", "information", "of", "the", "named", "package", "(", "s", ")", "installed", "on", "the", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1112-L1182
[ "def", "info_installed", "(", "*", "names", ",", "*", "*", "kwargs", ")", ":", "attr", "=", "kwargs", ".", "pop", "(", "'attr'", ",", "None", ")", "if", "attr", "is", "None", ":", "filter_attrs", "=", "None", "elif", "isinstance", "(", "attr", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version_cmp
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` to ignore the epoch when comparing versions .. versionadded:: 2016.3.4 CLI Examp...
salt/modules/opkg.py
def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs): # pylint: disable=unused-argument ''' Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set ...
def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs): # pylint: disable=unused-argument ''' Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem making the comparison. ignore_epoch : False Set ...
[ "Do", "a", "cmp", "-", "style", "comparison", "on", "two", "packages", ".", "Return", "-", "1", "if", "pkg1", "<", "pkg2", "0", "if", "pkg1", "==", "pkg2", "and", "1", "if", "pkg1", ">", "pkg2", ".", "Return", "None", "if", "there", "was", "a", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1198-L1244
[ "def", "version_cmp", "(", "pkg1", ",", "pkg2", ",", "ignore_epoch", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "normalize", "=", "lambda", "x", ":", "six", ".", "text_type", "(", "x", ")", ".", "split", "(", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_repo_option
Set the option to repo
salt/modules/opkg.py
def _set_repo_option(repo, option): ''' Set the option to repo ''' if not option: return opt = option.split('=') if len(opt) != 2: return if opt[0] == 'trusted': repo['trusted'] = opt[1] == 'yes' else: repo[opt[0]] = opt[1]
def _set_repo_option(repo, option): ''' Set the option to repo ''' if not option: return opt = option.split('=') if len(opt) != 2: return if opt[0] == 'trusted': repo['trusted'] = opt[1] == 'yes' else: repo[opt[0]] = opt[1]
[ "Set", "the", "option", "to", "repo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1247-L1259
[ "def", "_set_repo_option", "(", "repo", ",", "option", ")", ":", "if", "not", "option", ":", "return", "opt", "=", "option", ".", "split", "(", "'='", ")", "if", "len", "(", "opt", ")", "!=", "2", ":", "return", "if", "opt", "[", "0", "]", "==", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_repo_options
Set the options to the repo.
salt/modules/opkg.py
def _set_repo_options(repo, options): ''' Set the options to the repo. ''' delimiters = "[", "]" pattern = '|'.join(map(re.escape, delimiters)) for option in options: splitted = re.split(pattern, option) for opt in splitted: _set_repo_option(repo, opt)
def _set_repo_options(repo, options): ''' Set the options to the repo. ''' delimiters = "[", "]" pattern = '|'.join(map(re.escape, delimiters)) for option in options: splitted = re.split(pattern, option) for opt in splitted: _set_repo_option(repo, opt)
[ "Set", "the", "options", "to", "the", "repo", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1262-L1271
[ "def", "_set_repo_options", "(", "repo", ",", "options", ")", ":", "delimiters", "=", "\"[\"", ",", "\"]\"", "pattern", "=", "'|'", ".", "join", "(", "map", "(", "re", ".", "escape", ",", "delimiters", ")", ")", "for", "option", "in", "options", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_create_repo
Create repo
salt/modules/opkg.py
def _create_repo(line, filename): ''' Create repo ''' repo = {} if line.startswith('#'): repo['enabled'] = False line = line[1:] else: repo['enabled'] = True cols = salt.utils.args.shlex_split(line.strip()) repo['compressed'] = not cols[0] in 'src' repo['name'...
def _create_repo(line, filename): ''' Create repo ''' repo = {} if line.startswith('#'): repo['enabled'] = False line = line[1:] else: repo['enabled'] = True cols = salt.utils.args.shlex_split(line.strip()) repo['compressed'] = not cols[0] in 'src' repo['name'...
[ "Create", "repo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1274-L1291
[ "def", "_create_repo", "(", "line", ",", "filename", ")", ":", "repo", "=", "{", "}", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "repo", "[", "'enabled'", "]", "=", "False", "line", "=", "line", "[", "1", ":", "]", "else", ":", "repo"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_read_repos
Read repos from configuration file
salt/modules/opkg.py
def _read_repos(conf_file, repos, filename, regex): ''' Read repos from configuration file ''' for line in conf_file: line = salt.utils.stringutils.to_unicode(line) if not regex.search(line): continue repo = _create_repo(line, filename) # do not store duplica...
def _read_repos(conf_file, repos, filename, regex): ''' Read repos from configuration file ''' for line in conf_file: line = salt.utils.stringutils.to_unicode(line) if not regex.search(line): continue repo = _create_repo(line, filename) # do not store duplica...
[ "Read", "repos", "from", "configuration", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1294-L1306
[ "def", "_read_repos", "(", "conf_file", ",", "repos", ",", "filename", ",", "regex", ")", ":", "for", "line", "in", "conf_file", ":", "line", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "line", ")", "if", "not", "regex", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_repos
Lists all repos on ``/etc/opkg/*.conf`` CLI Example: .. code-block:: bash salt '*' pkg.list_repos
salt/modules/opkg.py
def list_repos(**kwargs): # pylint: disable=unused-argument ''' Lists all repos on ``/etc/opkg/*.conf`` CLI Example: .. code-block:: bash salt '*' pkg.list_repos ''' repos = {} regex = re.compile(REPO_REGEXP) for filename in os.listdir(OPKG_CONFDIR): if not filename.en...
def list_repos(**kwargs): # pylint: disable=unused-argument ''' Lists all repos on ``/etc/opkg/*.conf`` CLI Example: .. code-block:: bash salt '*' pkg.list_repos ''' repos = {} regex = re.compile(REPO_REGEXP) for filename in os.listdir(OPKG_CONFDIR): if not filename.en...
[ "Lists", "all", "repos", "on", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1309-L1326
[ "def", "list_repos", "(", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "repos", "=", "{", "}", "regex", "=", "re", ".", "compile", "(", "REPO_REGEXP", ")", "for", "filename", "in", "os", ".", "listdir", "(", "OPKG_CONFDIR", ")", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_repo
Display a repo from the ``/etc/opkg/*.conf`` CLI Examples: .. code-block:: bash salt '*' pkg.get_repo repo
salt/modules/opkg.py
def get_repo(repo, **kwargs): # pylint: disable=unused-argument ''' Display a repo from the ``/etc/opkg/*.conf`` CLI Examples: .. code-block:: bash salt '*' pkg.get_repo repo ''' repos = list_repos() if repos: for source in six.itervalues(repos): for sub in s...
def get_repo(repo, **kwargs): # pylint: disable=unused-argument ''' Display a repo from the ``/etc/opkg/*.conf`` CLI Examples: .. code-block:: bash salt '*' pkg.get_repo repo ''' repos = list_repos() if repos: for source in six.itervalues(repos): for sub in s...
[ "Display", "a", "repo", "from", "the", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1329-L1346
[ "def", "get_repo", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "repos", "=", "list_repos", "(", ")", "if", "repos", ":", "for", "source", "in", "six", ".", "itervalues", "(", "repos", ")", ":", "for", "sub", "in",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_del_repo_from_file
Remove a repo from filepath
salt/modules/opkg.py
def _del_repo_from_file(repo, filepath): ''' Remove a repo from filepath ''' with salt.utils.files.fopen(filepath) as fhandle: output = [] regex = re.compile(REPO_REGEXP) for line in fhandle: line = salt.utils.stringutils.to_unicode(line) if regex.search(l...
def _del_repo_from_file(repo, filepath): ''' Remove a repo from filepath ''' with salt.utils.files.fopen(filepath) as fhandle: output = [] regex = re.compile(REPO_REGEXP) for line in fhandle: line = salt.utils.stringutils.to_unicode(line) if regex.search(l...
[ "Remove", "a", "repo", "from", "filepath" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1349-L1365
[ "def", "_del_repo_from_file", "(", "repo", ",", "filepath", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "filepath", ")", "as", "fhandle", ":", "output", "=", "[", "]", "regex", "=", "re", ".", "compile", "(", "REPO_REGEXP",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_trusted_option_if_needed
Set trusted option to repo if needed
salt/modules/opkg.py
def _set_trusted_option_if_needed(repostr, trusted): ''' Set trusted option to repo if needed ''' if trusted is True: repostr += ' [trusted=yes]' elif trusted is False: repostr += ' [trusted=no]' return repostr
def _set_trusted_option_if_needed(repostr, trusted): ''' Set trusted option to repo if needed ''' if trusted is True: repostr += ' [trusted=yes]' elif trusted is False: repostr += ' [trusted=no]' return repostr
[ "Set", "trusted", "option", "to", "repo", "if", "needed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1368-L1376
[ "def", "_set_trusted_option_if_needed", "(", "repostr", ",", "trusted", ")", ":", "if", "trusted", "is", "True", ":", "repostr", "+=", "' [trusted=yes]'", "elif", "trusted", "is", "False", ":", "repostr", "+=", "' [trusted=no]'", "return", "repostr" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_add_new_repo
Add a new repo entry
salt/modules/opkg.py
def _add_new_repo(repo, properties): ''' Add a new repo entry ''' repostr = '# ' if not properties.get('enabled') else '' repostr += 'src/gz ' if properties.get('compressed') else 'src ' if ' ' in repo: repostr += '"' + repo + '" ' else: repostr += repo + ' ' repostr += p...
def _add_new_repo(repo, properties): ''' Add a new repo entry ''' repostr = '# ' if not properties.get('enabled') else '' repostr += 'src/gz ' if properties.get('compressed') else 'src ' if ' ' in repo: repostr += '"' + repo + '" ' else: repostr += repo + ' ' repostr += p...
[ "Add", "a", "new", "repo", "entry" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1379-L1395
[ "def", "_add_new_repo", "(", "repo", ",", "properties", ")", ":", "repostr", "=", "'# '", "if", "not", "properties", ".", "get", "(", "'enabled'", ")", "else", "''", "repostr", "+=", "'src/gz '", "if", "properties", ".", "get", "(", "'compressed'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_mod_repo_in_file
Replace a repo entry in filepath with repostr
salt/modules/opkg.py
def _mod_repo_in_file(repo, repostr, filepath): ''' Replace a repo entry in filepath with repostr ''' with salt.utils.files.fopen(filepath) as fhandle: output = [] for line in fhandle: cols = salt.utils.args.shlex_split( salt.utils.stringutils.to_unicode(line)...
def _mod_repo_in_file(repo, repostr, filepath): ''' Replace a repo entry in filepath with repostr ''' with salt.utils.files.fopen(filepath) as fhandle: output = [] for line in fhandle: cols = salt.utils.args.shlex_split( salt.utils.stringutils.to_unicode(line)...
[ "Replace", "a", "repo", "entry", "in", "filepath", "with", "repostr" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1398-L1413
[ "def", "_mod_repo_in_file", "(", "repo", ",", "repostr", ",", "filepath", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "filepath", ")", "as", "fhandle", ":", "output", "=", "[", "]", "for", "line", "in", "fhandle", ":", "c...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
del_repo
Delete a repo from ``/etc/opkg/*.conf`` If the file does not contain any other repo configuration, the file itself will be deleted. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo repo
salt/modules/opkg.py
def del_repo(repo, **kwargs): # pylint: disable=unused-argument ''' Delete a repo from ``/etc/opkg/*.conf`` If the file does not contain any other repo configuration, the file itself will be deleted. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo repo ''' refresh =...
def del_repo(repo, **kwargs): # pylint: disable=unused-argument ''' Delete a repo from ``/etc/opkg/*.conf`` If the file does not contain any other repo configuration, the file itself will be deleted. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo repo ''' refresh =...
[ "Delete", "a", "repo", "from", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1416-L1459
[ "def", "del_repo", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "refresh", "=", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "kwargs", ".", "get", "(", "'refresh'", ",", "True", ")", ")", "repos", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mod_repo
Modify one or more values for a repo. If the repo does not exist, it will be created, so long as uri is defined. The following options are available to modify a repo definition: repo alias by which opkg refers to the repo. uri the URI to the repo. compressed defines (True ...
salt/modules/opkg.py
def mod_repo(repo, **kwargs): ''' Modify one or more values for a repo. If the repo does not exist, it will be created, so long as uri is defined. The following options are available to modify a repo definition: repo alias by which opkg refers to the repo. uri the URI to the r...
def mod_repo(repo, **kwargs): ''' Modify one or more values for a repo. If the repo does not exist, it will be created, so long as uri is defined. The following options are available to modify a repo definition: repo alias by which opkg refers to the repo. uri the URI to the r...
[ "Modify", "one", "or", "more", "values", "for", "a", "repo", ".", "If", "the", "repo", "does", "not", "exist", "it", "will", "be", "created", "so", "long", "as", "uri", "is", "defined", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1462-L1533
[ "def", "mod_repo", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "repos", "=", "list_repos", "(", ")", "found", "=", "False", "uri", "=", "''", "if", "'uri'", "in", "kwargs", ":", "uri", "=", "kwargs", "[", "'uri'", "]", "for", "repository", "in"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_list
List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bash salt '*' pkg.file_list httpd salt '*' pkg.file_list httpd postfix salt '*' p...
salt/modules/opkg.py
def file_list(*packages, **kwargs): # pylint: disable=unused-argument ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bash salt '*' ...
def file_list(*packages, **kwargs): # pylint: disable=unused-argument ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bash salt '*' ...
[ "List", "the", "files", "that", "belong", "to", "a", "package", ".", "Not", "specifying", "any", "packages", "will", "return", "a", "list", "of", "_every_", "file", "on", "the", "system", "s", "package", "database", "(", "not", "generally", "recommended", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1536-L1554
[ "def", "file_list", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "output", "=", "file_dict", "(", "*", "packages", ")", "files", "=", "[", "]", "for", "package", "in", "list", "(", "output", "[", "'packages'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_dict
List the files that belong to a package, grouped by package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bash salt '*' pkg.file_list httpd salt '*' pkg.file_list httpd postfi...
salt/modules/opkg.py
def file_dict(*packages, **kwargs): # pylint: disable=unused-argument ''' List the files that belong to a package, grouped by package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bas...
def file_dict(*packages, **kwargs): # pylint: disable=unused-argument ''' List the files that belong to a package, grouped by package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bas...
[ "List", "the", "files", "that", "belong", "to", "a", "package", "grouped", "by", "package", ".", "Not", "specifying", "any", "packages", "will", "return", "a", "list", "of", "_every_", "file", "on", "the", "system", "s", "package", "database", "(", "not", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1557-L1596
[ "def", "file_dict", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "errors", "=", "[", "]", "ret", "=", "{", "}", "cmd_files", "=", "[", "'opkg'", ",", "'files'", "]", "if", "not", "packages", ":", "packages...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
owner
Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned. If the file is not...
salt/modules/opkg.py
def owner(*paths, **kwargs): # pylint: disable=unused-argument ''' Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dic...
def owner(*paths, **kwargs): # pylint: disable=unused-argument ''' Return the name of the package that owns the file. Multiple file paths can be passed. Like :mod:`pkg.version <salt.modules.opkg.version`, if a single path is passed, a string will be returned, and if multiple paths are passed, a dic...
[ "Return", "the", "name", "of", "the", "package", "that", "owns", "the", "file", ".", "Multiple", "file", "paths", "can", "be", "passed", ".", "Like", ":", "mod", ":", "pkg", ".", "version", "<salt", ".", "modules", ".", "opkg", ".", "version", "if", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1599-L1630
[ "def", "owner", "(", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "if", "not", "paths", ":", "return", "''", "ret", "=", "{", "}", "cmd_search", "=", "[", "'opkg'", ",", "'search'", "]", "for", "path", "in", "pa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_send_email
send a email to inform user of account creation
salt/modules/splunk.py
def _send_email(name, email): "send a email to inform user of account creation" config = __salt__['config.option']('splunk') email_object = config.get('email') if email_object: cc = email_object.get('cc') subject = email_object.get('subject') message = email_object.get('message')...
def _send_email(name, email): "send a email to inform user of account creation" config = __salt__['config.option']('splunk') email_object = config.get('email') if email_object: cc = email_object.get('cc') subject = email_object.get('subject') message = email_object.get('message')...
[ "send", "a", "email", "to", "inform", "user", "of", "account", "creation" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L84-L100
[ "def", "_send_email", "(", "name", ",", "email", ")", ":", "config", "=", "__salt__", "[", "'config.option'", "]", "(", "'splunk'", ")", "email_object", "=", "config", ".", "get", "(", "'email'", ")", "if", "email_object", ":", "cc", "=", "email_object", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_splunk
Return the splunk client, cached into __context__ for performance
salt/modules/splunk.py
def _get_splunk(profile): ''' Return the splunk client, cached into __context__ for performance ''' config = __salt__['config.option'](profile) key = "splunk.{0}:{1}:{2}:{3}".format( config.get('host'), config.get('port'), config.get('username'), config.get('password...
def _get_splunk(profile): ''' Return the splunk client, cached into __context__ for performance ''' config = __salt__['config.option'](profile) key = "splunk.{0}:{1}:{2}:{3}".format( config.get('host'), config.get('port'), config.get('username'), config.get('password...
[ "Return", "the", "splunk", "client", "cached", "into", "__context__", "for", "performance" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L124-L144
[ "def", "_get_splunk", "(", "profile", ")", ":", "config", "=", "__salt__", "[", "'config.option'", "]", "(", "profile", ")", "key", "=", "\"splunk.{0}:{1}:{2}:{3}\"", ".", "format", "(", "config", ".", "get", "(", "'host'", ")", ",", "config", ".", "get", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_users
List all users in the splunk DB CLI Example: salt myminion splunk.list_users
salt/modules/splunk.py
def list_users(profile="splunk"): ''' List all users in the splunk DB CLI Example: salt myminion splunk.list_users ''' config = __salt__['config.option'](profile) key = "splunk.users.{0}".format( config.get('host') ) if key not in __context__: _populate_cache(...
def list_users(profile="splunk"): ''' List all users in the splunk DB CLI Example: salt myminion splunk.list_users ''' config = __salt__['config.option'](profile) key = "splunk.users.{0}".format( config.get('host') ) if key not in __context__: _populate_cache(...
[ "List", "all", "users", "in", "the", "splunk", "DB" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L147-L164
[ "def", "list_users", "(", "profile", "=", "\"splunk\"", ")", ":", "config", "=", "__salt__", "[", "'config.option'", "]", "(", "profile", ")", "key", "=", "\"splunk.users.{0}\"", ".", "format", "(", "config", ".", "get", "(", "'host'", ")", ")", "if", "k...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_user
Get a splunk user by name/email CLI Example: salt myminion splunk.get_user 'user@example.com' user_details=false salt myminion splunk.get_user 'user@example.com' user_details=true
salt/modules/splunk.py
def get_user(email, profile="splunk", **kwargs): ''' Get a splunk user by name/email CLI Example: salt myminion splunk.get_user 'user@example.com' user_details=false salt myminion splunk.get_user 'user@example.com' user_details=true ''' user_map = list_users(profile) user_foun...
def get_user(email, profile="splunk", **kwargs): ''' Get a splunk user by name/email CLI Example: salt myminion splunk.get_user 'user@example.com' user_details=false salt myminion splunk.get_user 'user@example.com' user_details=true ''' user_map = list_users(profile) user_foun...
[ "Get", "a", "splunk", "user", "by", "name", "/", "email" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L167-L196
[ "def", "get_user", "(", "email", ",", "profile", "=", "\"splunk\"", ",", "*", "*", "kwargs", ")", ":", "user_map", "=", "list_users", "(", "profile", ")", "user_found", "=", "email", ".", "lower", "(", ")", "in", "user_map", ".", "keys", "(", ")", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_user
create a splunk user by name/email CLI Example: salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser
salt/modules/splunk.py
def create_user(email, profile="splunk", **kwargs): ''' create a splunk user by name/email CLI Example: salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser ''' client = _get_splunk(profile) email = email.lower() user = list_users(p...
def create_user(email, profile="splunk", **kwargs): ''' create a splunk user by name/email CLI Example: salt myminion splunk.create_user user@example.com roles=['user'] realname="Test User" name=testuser ''' client = _get_splunk(profile) email = email.lower() user = list_users(p...
[ "create", "a", "splunk", "user", "by", "name", "/", "email" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L199-L246
[ "def", "create_user", "(", "email", ",", "profile", "=", "\"splunk\"", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_splunk", "(", "profile", ")", "email", "=", "email", ".", "lower", "(", ")", "user", "=", "list_users", "(", "profile", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_user
Create a splunk user by email CLI Example: salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User"
salt/modules/splunk.py
def update_user(email, profile="splunk", **kwargs): ''' Create a splunk user by email CLI Example: salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User" ''' client = _get_splunk(profile) email = email.lower() user = list_users(profile).get(email...
def update_user(email, profile="splunk", **kwargs): ''' Create a splunk user by email CLI Example: salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User" ''' client = _get_splunk(profile) email = email.lower() user = list_users(profile).get(email...
[ "Create", "a", "splunk", "user", "by", "email" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L249-L301
[ "def", "update_user", "(", "email", ",", "profile", "=", "\"splunk\"", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_splunk", "(", "profile", ")", "email", "=", "email", ".", "lower", "(", ")", "user", "=", "list_users", "(", "profile", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_user
Delete a splunk user by email CLI Example: salt myminion splunk_user.delete 'user@example.com'
salt/modules/splunk.py
def delete_user(email, profile="splunk"): ''' Delete a splunk user by email CLI Example: salt myminion splunk_user.delete 'user@example.com' ''' client = _get_splunk(profile) user = list_users(profile).get(email) if user: try: client.users.delete(user.name) ...
def delete_user(email, profile="splunk"): ''' Delete a splunk user by email CLI Example: salt myminion splunk_user.delete 'user@example.com' ''' client = _get_splunk(profile) user = list_users(profile).get(email) if user: try: client.users.delete(user.name) ...
[ "Delete", "a", "splunk", "user", "by", "email" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/splunk.py#L304-L326
[ "def", "delete_user", "(", "email", ",", "profile", "=", "\"splunk\"", ")", ":", "client", "=", "_get_splunk", "(", "profile", ")", "user", "=", "list_users", "(", "profile", ")", ".", "get", "(", "email", ")", "if", "user", ":", "try", ":", "client", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
shell
Return the default shell to use on this system
salt/grains/extra.py
def shell(): ''' Return the default shell to use on this system ''' # Provides: # shell if salt.utils.platform.is_windows(): env_var = 'COMSPEC' default = r'C:\Windows\system32\cmd.exe' else: env_var = 'SHELL' default = '/bin/sh' return {'shell': os.env...
def shell(): ''' Return the default shell to use on this system ''' # Provides: # shell if salt.utils.platform.is_windows(): env_var = 'COMSPEC' default = r'C:\Windows\system32\cmd.exe' else: env_var = 'SHELL' default = '/bin/sh' return {'shell': os.env...
[ "Return", "the", "default", "shell", "to", "use", "on", "this", "system" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L21-L34
[ "def", "shell", "(", ")", ":", "# Provides:", "# shell", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "env_var", "=", "'COMSPEC'", "default", "=", "r'C:\\Windows\\system32\\cmd.exe'", "else", ":", "env_var", "=", "'SHELL'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
config
Return the grains set in the grains file
salt/grains/extra.py
def config(): ''' Return the grains set in the grains file ''' if 'conf_file' not in __opts__: return {} if os.path.isdir(__opts__['conf_file']): if salt.utils.platform.is_proxy(): gfn = os.path.join( __opts__['conf_file'], 'proxy.d...
def config(): ''' Return the grains set in the grains file ''' if 'conf_file' not in __opts__: return {} if os.path.isdir(__opts__['conf_file']): if salt.utils.platform.is_proxy(): gfn = os.path.join( __opts__['conf_file'], 'proxy.d...
[ "Return", "the", "grains", "set", "in", "the", "grains", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/extra.py#L37-L77
[ "def", "config", "(", ")", ":", "if", "'conf_file'", "not", "in", "__opts__", ":", "return", "{", "}", "if", "os", ".", "path", ".", "isdir", "(", "__opts__", "[", "'conf_file'", "]", ")", ":", "if", "salt", ".", "utils", ".", "platform", ".", "is_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_output_volume
Get the output volume (range 0 to 100) CLI Example: .. code-block:: bash salt '*' desktop.get_output_volume
salt/modules/mac_desktop.py
def get_output_volume(): ''' Get the output volume (range 0 to 100) CLI Example: .. code-block:: bash salt '*' desktop.get_output_volume ''' cmd = 'osascript -e "get output volume of (get volume settings)"' call = __salt__['cmd.run_all']( cmd, output_loglevel='debu...
def get_output_volume(): ''' Get the output volume (range 0 to 100) CLI Example: .. code-block:: bash salt '*' desktop.get_output_volume ''' cmd = 'osascript -e "get output volume of (get volume settings)"' call = __salt__['cmd.run_all']( cmd, output_loglevel='debu...
[ "Get", "the", "output", "volume", "(", "range", "0", "to", "100", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L24-L42
[ "def", "get_output_volume", "(", ")", ":", "cmd", "=", "'osascript -e \"get output volume of (get volume settings)\"'", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "python_shell", "=", "False", ")", "_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_output_volume
Set the volume of sound. volume The level of volume. Can range from 0 to 100. CLI Example: .. code-block:: bash salt '*' desktop.set_output_volume <volume>
salt/modules/mac_desktop.py
def set_output_volume(volume): ''' Set the volume of sound. volume The level of volume. Can range from 0 to 100. CLI Example: .. code-block:: bash salt '*' desktop.set_output_volume <volume> ''' cmd = 'osascript -e "set volume output volume {0}"'.format(volume) call =...
def set_output_volume(volume): ''' Set the volume of sound. volume The level of volume. Can range from 0 to 100. CLI Example: .. code-block:: bash salt '*' desktop.set_output_volume <volume> ''' cmd = 'osascript -e "set volume output volume {0}"'.format(volume) call =...
[ "Set", "the", "volume", "of", "sound", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L45-L66
[ "def", "set_output_volume", "(", "volume", ")", ":", "cmd", "=", "'osascript -e \"set volume output volume {0}\"'", ".", "format", "(", "volume", ")", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "p...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
screensaver
Launch the screensaver. CLI Example: .. code-block:: bash salt '*' desktop.screensaver
salt/modules/mac_desktop.py
def screensaver(): ''' Launch the screensaver. CLI Example: .. code-block:: bash salt '*' desktop.screensaver ''' cmd = 'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app' call = __salt__['cmd.run_all']( cmd, output_lo...
def screensaver(): ''' Launch the screensaver. CLI Example: .. code-block:: bash salt '*' desktop.screensaver ''' cmd = 'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app' call = __salt__['cmd.run_all']( cmd, output_lo...
[ "Launch", "the", "screensaver", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L69-L87
[ "def", "screensaver", "(", ")", ":", "cmd", "=", "'open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "python_shell"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
say
Say some words. words The words to execute the say command with. CLI Example: .. code-block:: bash salt '*' desktop.say <word0> <word1> ... <wordN>
salt/modules/mac_desktop.py
def say(*words): ''' Say some words. words The words to execute the say command with. CLI Example: .. code-block:: bash salt '*' desktop.say <word0> <word1> ... <wordN> ''' cmd = 'say {0}'.format(' '.join(words)) call = __salt__['cmd.run_all']( cmd, ou...
def say(*words): ''' Say some words. words The words to execute the say command with. CLI Example: .. code-block:: bash salt '*' desktop.say <word0> <word1> ... <wordN> ''' cmd = 'say {0}'.format(' '.join(words)) call = __salt__['cmd.run_all']( cmd, ou...
[ "Say", "some", "words", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L111-L132
[ "def", "say", "(", "*", "words", ")", ":", "cmd", "=", "'say {0}'", ".", "format", "(", "' '", ".", "join", "(", "words", ")", ")", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "python_s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_cmd
Check the output of the cmd.run_all function call.
salt/modules/mac_desktop.py
def _check_cmd(call): ''' Check the output of the cmd.run_all function call. ''' if call['retcode'] != 0: comment = '' std_err = call.get('stderr') std_out = call.get('stdout') if std_err: comment += std_err if std_out: comment += std_out ...
def _check_cmd(call): ''' Check the output of the cmd.run_all function call. ''' if call['retcode'] != 0: comment = '' std_err = call.get('stderr') std_out = call.get('stdout') if std_err: comment += std_err if std_out: comment += std_out ...
[ "Check", "the", "output", "of", "the", "cmd", ".", "run_all", "function", "call", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L135-L150
[ "def", "_check_cmd", "(", "call", ")", ":", "if", "call", "[", "'retcode'", "]", "!=", "0", ":", "comment", "=", "''", "std_err", "=", "call", ".", "get", "(", "'stderr'", ")", "std_out", "=", "call", ".", "get", "(", "'stdout'", ")", "if", "std_er...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
build_counter_list
r''' Create a list of Counter objects to be used in the pdh query Args: counter_list (list): A list of tuples containing counter information. Each tuple should contain the object, instance, and counter name. For example, to get the ``% Processor Time`` counter for al...
salt/utils/win_pdh.py
def build_counter_list(counter_list): r''' Create a list of Counter objects to be used in the pdh query Args: counter_list (list): A list of tuples containing counter information. Each tuple should contain the object, instance, and counter name. For example, to g...
def build_counter_list(counter_list): r''' Create a list of Counter objects to be used in the pdh query Args: counter_list (list): A list of tuples containing counter information. Each tuple should contain the object, instance, and counter name. For example, to g...
[ "r", "Create", "a", "list", "of", "Counter", "objects", "to", "be", "used", "in", "the", "pdh", "query" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L292-L334
[ "def", "build_counter_list", "(", "counter_list", ")", ":", "counters", "=", "[", "]", "index", "=", "0", "for", "obj", ",", "instance", ",", "counter_name", "in", "counter_list", ":", "try", ":", "counter", "=", "Counter", ".", "build_counter", "(", "obj"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_all_counters
Get the values for all counters available to a Counter object Args: obj (str): The name of the counter object. You can get a list of valid names using the ``list_objects`` function instance_list (list): A list of instances to return. Use this to narrow down the...
salt/utils/win_pdh.py
def get_all_counters(obj, instance_list=None): ''' Get the values for all counters available to a Counter object Args: obj (str): The name of the counter object. You can get a list of valid names using the ``list_objects`` function instance_list (list): ...
def get_all_counters(obj, instance_list=None): ''' Get the values for all counters available to a Counter object Args: obj (str): The name of the counter object. You can get a list of valid names using the ``list_objects`` function instance_list (list): ...
[ "Get", "the", "values", "for", "all", "counters", "available", "to", "a", "Counter", "object" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L337-L370
[ "def", "get_all_counters", "(", "obj", ",", "instance_list", "=", "None", ")", ":", "counters", ",", "instances_avail", "=", "win32pdh", ".", "EnumObjectItems", "(", "None", ",", "None", ",", "obj", ",", "-", "1", ",", "0", ")", "if", "instance_list", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_counters
Get the values for the passes list of counters Args: counter_list (list): A list of counters to lookup Returns: dict: A dictionary of counters and their values
salt/utils/win_pdh.py
def get_counters(counter_list): ''' Get the values for the passes list of counters Args: counter_list (list): A list of counters to lookup Returns: dict: A dictionary of counters and their values ''' if not isinstance(counter_list, list): raise CommandExecut...
def get_counters(counter_list): ''' Get the values for the passes list of counters Args: counter_list (list): A list of counters to lookup Returns: dict: A dictionary of counters and their values ''' if not isinstance(counter_list, list): raise CommandExecut...
[ "Get", "the", "values", "for", "the", "passes", "list", "of", "counters" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L373-L420
[ "def", "get_counters", "(", "counter_list", ")", ":", "if", "not", "isinstance", "(", "counter_list", ",", "list", ")", ":", "raise", "CommandExecutionError", "(", "'counter_list must be a list of tuples'", ")", "try", ":", "# Start a Query instances", "query", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Counter.build_counter
r''' Makes a fully resolved counter path. Counter names are formatted like this: ``\Processor(*)\% Processor Time`` The above breaks down like this: obj = 'Processor' instance = '*' counter = '% Processor Time' Args: obj (str):...
salt/utils/win_pdh.py
def build_counter(obj, instance, instance_index, counter): r''' Makes a fully resolved counter path. Counter names are formatted like this: ``\Processor(*)\% Processor Time`` The above breaks down like this: obj = 'Processor' instance = '*' ...
def build_counter(obj, instance, instance_index, counter): r''' Makes a fully resolved counter path. Counter names are formatted like this: ``\Processor(*)\% Processor Time`` The above breaks down like this: obj = 'Processor' instance = '*' ...
[ "r", "Makes", "a", "fully", "resolved", "counter", "path", ".", "Counter", "names", "are", "formatted", "like", "this", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L132-L169
[ "def", "build_counter", "(", "obj", ",", "instance", ",", "instance_index", ",", "counter", ")", ":", "path", "=", "win32pdh", ".", "MakeCounterPath", "(", "(", "None", ",", "obj", ",", "instance", ",", "None", ",", "instance_index", ",", "counter", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Counter.add_to_query
Add the current path to the query Args: query (obj): The handle to the query to add the counter
salt/utils/win_pdh.py
def add_to_query(self, query): ''' Add the current path to the query Args: query (obj): The handle to the query to add the counter ''' self.handle = win32pdh.AddCounter(query, self.path)
def add_to_query(self, query): ''' Add the current path to the query Args: query (obj): The handle to the query to add the counter ''' self.handle = win32pdh.AddCounter(query, self.path)
[ "Add", "the", "current", "path", "to", "the", "query" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L183-L191
[ "def", "add_to_query", "(", "self", ",", "query", ")", ":", "self", ".", "handle", "=", "win32pdh", ".", "AddCounter", "(", "query", ",", "self", ".", "path", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Counter.get_info
Get information about the counter .. note:: GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes if this is called after sampling data.
salt/utils/win_pdh.py
def get_info(self): ''' Get information about the counter .. note:: GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes if this is called after sampling data. ''' if not self.info: ci = win32pdh.GetCounterInfo(self.handle, 0) ...
def get_info(self): ''' Get information about the counter .. note:: GetCounterInfo sometimes crashes in the wrapper code. Fewer crashes if this is called after sampling data. ''' if not self.info: ci = win32pdh.GetCounterInfo(self.handle, 0) ...
[ "Get", "information", "about", "the", "counter" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L193-L219
[ "def", "get_info", "(", "self", ")", ":", "if", "not", "self", ".", "info", ":", "ci", "=", "win32pdh", ".", "GetCounterInfo", "(", "self", ".", "handle", ",", "0", ")", "self", ".", "info", "=", "{", "'type'", ":", "ci", "[", "0", "]", ",", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Counter.value
Return the counter value Returns: long: The counter value
salt/utils/win_pdh.py
def value(self): ''' Return the counter value Returns: long: The counter value ''' (counter_type, value) = win32pdh.GetFormattedCounterValue( self.handle, win32pdh.PDH_FMT_DOUBLE) self.type = counter_type return value
def value(self): ''' Return the counter value Returns: long: The counter value ''' (counter_type, value) = win32pdh.GetFormattedCounterValue( self.handle, win32pdh.PDH_FMT_DOUBLE) self.type = counter_type return value
[ "Return", "the", "counter", "value" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L221-L231
[ "def", "value", "(", "self", ")", ":", "(", "counter_type", ",", "value", ")", "=", "win32pdh", ".", "GetFormattedCounterValue", "(", "self", ".", "handle", ",", "win32pdh", ".", "PDH_FMT_DOUBLE", ")", "self", ".", "type", "=", "counter_type", "return", "v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Counter.type_string
Returns the names of the flags that are set in the Type field It can be used to format the counter.
salt/utils/win_pdh.py
def type_string(self): ''' Returns the names of the flags that are set in the Type field It can be used to format the counter. ''' type = self.get_info()['type'] type_list = [] for member in dir(self): if member.startswith("PERF_"): bi...
def type_string(self): ''' Returns the names of the flags that are set in the Type field It can be used to format the counter. ''' type = self.get_info()['type'] type_list = [] for member in dir(self): if member.startswith("PERF_"): bi...
[ "Returns", "the", "names", "of", "the", "flags", "that", "are", "set", "in", "the", "Type", "field" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L233-L246
[ "def", "type_string", "(", "self", ")", ":", "type", "=", "self", ".", "get_info", "(", ")", "[", "'type'", "]", "type_list", "=", "[", "]", "for", "member", "in", "dir", "(", "self", ")", ":", "if", "member", ".", "startswith", "(", "\"PERF_\"", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
exists
Add the directory to the system PATH at index location index Position where the directory should be placed in the PATH. This is 0-indexed, so 0 means to prepend at the very start of the PATH. .. note:: If the index is not specified, and the directory needs to be added ...
salt/states/win_path.py
def exists(name, index=None): ''' Add the directory to the system PATH at index location index Position where the directory should be placed in the PATH. This is 0-indexed, so 0 means to prepend at the very start of the PATH. .. note:: If the index is not specified, and...
def exists(name, index=None): ''' Add the directory to the system PATH at index location index Position where the directory should be placed in the PATH. This is 0-indexed, so 0 means to prepend at the very start of the PATH. .. note:: If the index is not specified, and...
[ "Add", "the", "directory", "to", "the", "system", "PATH", "at", "index", "location" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_path.py#L66-L234
[ "def", "exists", "(", "name", ",", "index", "=", "None", ")", ":", "try", ":", "name", "=", "os", ".", "path", ".", "normpath", "(", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "name", ")", ")", "except", "TypeError", ":", "na...
e8541fd6e744ab0df786c0f76102e41631f45d46