repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container
def show_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f show_storage_container my-azure name=myservice name: Name of container t...
python
def show_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f show_storage_container my-azure name=myservice name: Name of container t...
[ "def", "show_storage_container", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_storage_container function must be called with -f ...
.. versionadded:: 2015.8.0 Show a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f show_storage_container my-azure name=myservice name: Name of container to show.
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2618-L2651
train
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container_metadata
def show_storage_container_metadata(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_metadata my-azure name=myservice name: Name of container ...
python
def show_storage_container_metadata(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_metadata my-azure name=myservice name: Name of container ...
[ "def", "show_storage_container_metadata", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_storage_container function must be called...
.. versionadded:: 2015.8.0 Show a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_metadata my-azure name=myservice name: Name of container to show. lease_id: If specified, show_storage_container_metadata only succeeds i...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2658-L2694
train
saltstack/salt
salt/cloud/clouds/msazure.py
set_storage_container_metadata
def set_storage_container_metadata(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer \\ x_ms_meta_name_values='{"my_name...
python
def set_storage_container_metadata(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer \\ x_ms_meta_name_values='{"my_name...
[ "def", "set_storage_container_metadata", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_storage_container function must be calle...
.. versionadded:: 2015.8.0 Set a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer \\ x_ms_meta_name_values='{"my_name": "my_value"}' name: Name of existing container. meta_name_values: ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2701-L2749
train
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container_acl
def show_storage_container_acl(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_acl my-azure name=myservice name: Name of existing container. l...
python
def show_storage_container_acl(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_acl my-azure name=myservice name: Name of existing container. l...
[ "def", "show_storage_container_acl", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_storage_container function must be called with...
.. versionadded:: 2015.8.0 Show a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_acl my-azure name=myservice name: Name of existing container. lease_id: If specified, show_storage_container_acl only succeeds if the ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2752-L2788
train
saltstack/salt
salt/cloud/clouds/msazure.py
set_storage_container_acl
def set_storage_container_acl(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer name: Name of existing container. signed...
python
def set_storage_container_acl(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer name: Name of existing container. signed...
[ "def", "set_storage_container_acl", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_storage_container function must be called wit...
.. versionadded:: 2015.8.0 Set a storage container's acl CLI Example: .. code-block:: bash salt-cloud -f set_storage_container my-azure name=mycontainer name: Name of existing container. signed_identifiers: SignedIdentifers instance blob_public_access: Option...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2795-L2834
train
saltstack/salt
salt/cloud/clouds/msazure.py
delete_storage_container
def delete_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Delete a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f delete_storage_container my-azure name=mycontainer name: Name of con...
python
def delete_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Delete a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f delete_storage_container my-azure name=mycontainer name: Name of con...
[ "def", "delete_storage_container", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The delete_storage_container function must be called with...
.. versionadded:: 2015.8.0 Delete a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f delete_storage_container my-azure name=mycontainer name: Name of container to create. fail_not_exist: Specify whether to throw an exception w...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2837-L2876
train
saltstack/salt
salt/cloud/clouds/msazure.py
lease_storage_container
def lease_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Lease a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f lease_storage_container my-azure name=mycontainer name: Name of contai...
python
def lease_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Lease a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f lease_storage_container my-azure name=mycontainer name: Name of contai...
[ "def", "lease_storage_container", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The lease_storage_container function must be called with -...
.. versionadded:: 2015.8.0 Lease a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f lease_storage_container my-azure name=mycontainer name: Name of container to create. lease_action: Required. Possible values: acquire|renew|re...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2879-L2955
train
saltstack/salt
salt/cloud/clouds/msazure.py
list_blobs
def list_blobs(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 List blobs associated with the container CLI Example: .. code-block:: bash salt-cloud -f list_blobs my-azure container=mycontainer container: The name of the storage container prefi...
python
def list_blobs(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 List blobs associated with the container CLI Example: .. code-block:: bash salt-cloud -f list_blobs my-azure container=mycontainer container: The name of the storage container prefi...
[ "def", "list_blobs", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_blobs function must be called with -f or --function.'", ")",...
.. versionadded:: 2015.8.0 List blobs associated with the container CLI Example: .. code-block:: bash salt-cloud -f list_blobs my-azure container=mycontainer container: The name of the storage container prefix: Optional. Filters the results to return only blobs whose nam...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2958-L3028
train
saltstack/salt
salt/cloud/clouds/msazure.py
show_blob_service_properties
def show_blob_service_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a blob's service properties CLI Example: .. code-block:: bash salt-cloud -f show_blob_service_properties my-azure ''' if call != 'function': raise SaltCloudSys...
python
def show_blob_service_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a blob's service properties CLI Example: .. code-block:: bash salt-cloud -f show_blob_service_properties my-azure ''' if call != 'function': raise SaltCloudSys...
[ "def", "show_blob_service_properties", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_blob_service_properties function must be cal...
.. versionadded:: 2015.8.0 Show a blob's service properties CLI Example: .. code-block:: bash salt-cloud -f show_blob_service_properties my-azure
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3031-L3054
train
saltstack/salt
salt/cloud/clouds/msazure.py
set_blob_service_properties
def set_blob_service_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Sets the properties of a storage account's Blob service, including Windows Azure Storage Analytics. You can also use this operation to set the default request version for all incoming requests...
python
def set_blob_service_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Sets the properties of a storage account's Blob service, including Windows Azure Storage Analytics. You can also use this operation to set the default request version for all incoming requests...
[ "def", "set_blob_service_properties", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The set_blob_service_properties function must be calle...
.. versionadded:: 2015.8.0 Sets the properties of a storage account's Blob service, including Windows Azure Storage Analytics. You can also use this operation to set the default request version for all incoming requests that do not have a version specified. CLI Example: .. code-block:: bash ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3061-L3099
train
saltstack/salt
salt/cloud/clouds/msazure.py
show_blob_properties
def show_blob_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. CLI Example: .. code-block:: bash salt-cloud -f show_blob_properties my-azure container...
python
def show_blob_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. CLI Example: .. code-block:: bash salt-cloud -f show_blob_properties my-azure container...
[ "def", "show_blob_properties", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_blob_properties function must be called with -f or -...
.. versionadded:: 2015.8.0 Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. CLI Example: .. code-block:: bash salt-cloud -f show_blob_properties my-azure container=mycontainer blob=myblob container: Name of existing container. ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3102-L3148
train
saltstack/salt
salt/cloud/clouds/msazure.py
set_blob_properties
def set_blob_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a blob's properties CLI Example: .. code-block:: bash salt-cloud -f set_blob_properties my-azure container: Name of existing container. blob: Name of existing b...
python
def set_blob_properties(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Set a blob's properties CLI Example: .. code-block:: bash salt-cloud -f set_blob_properties my-azure container: Name of existing container. blob: Name of existing b...
[ "def", "set_blob_properties", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The set_blob_properties function must be called with -f or --f...
.. versionadded:: 2015.8.0 Set a blob's properties CLI Example: .. code-block:: bash salt-cloud -f set_blob_properties my-azure container: Name of existing container. blob: Name of existing blob. blob_cache_control: Optional. Modifies the cache control string...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3155-L3221
train
saltstack/salt
salt/cloud/clouds/msazure.py
put_blob
def put_blob(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Upload a blob CLI Examples: .. code-block:: bash salt-cloud -f put_blob my-azure container=base name=top.sls blob_path=/srv/salt/top.sls salt-cloud -f put_blob my-azure container=base name=con...
python
def put_blob(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Upload a blob CLI Examples: .. code-block:: bash salt-cloud -f put_blob my-azure container=base name=top.sls blob_path=/srv/salt/top.sls salt-cloud -f put_blob my-azure container=base name=con...
[ "def", "put_blob", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The put_blob function must be called with -f or --function.'", ")", "...
.. versionadded:: 2015.8.0 Upload a blob CLI Examples: .. code-block:: bash salt-cloud -f put_blob my-azure container=base name=top.sls blob_path=/srv/salt/top.sls salt-cloud -f put_blob my-azure container=base name=content.txt blob_content='Some content' container: Name of ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3224-L3296
train
saltstack/salt
salt/cloud/clouds/msazure.py
query
def query(path, method='GET', data=None, params=None, header_dict=None, decode=True): ''' Perform a query directly against the Azure REST API ''' certificate_path = config.get_cloud_config_value( 'certificate_path', get_configured_provider(), __opts__, search_global=False ) subsc...
python
def query(path, method='GET', data=None, params=None, header_dict=None, decode=True): ''' Perform a query directly against the Azure REST API ''' certificate_path = config.get_cloud_config_value( 'certificate_path', get_configured_provider(), __opts__, search_global=False ) subsc...
[ "def", "query", "(", "path", ",", "method", "=", "'GET'", ",", "data", "=", "None", ",", "params", "=", "None", ",", "header_dict", "=", "None", ",", "decode", "=", "True", ")", ":", "certificate_path", "=", "config", ".", "get_cloud_config_value", "(", ...
Perform a query directly against the Azure REST API
[ "Perform", "a", "query", "directly", "against", "the", "Azure", "REST", "API" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3369-L3420
train
saltstack/salt
salt/modules/daemontools.py
start
def start(name): ''' Starts service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.start <service name> ''' __salt__['file.remove']('{0}/down'.format(_service_path(name))) cmd = 'svc -u {0}'.format(_service_path(name)) return not __salt__['cmd.retcode']...
python
def start(name): ''' Starts service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.start <service name> ''' __salt__['file.remove']('{0}/down'.format(_service_path(name))) cmd = 'svc -u {0}'.format(_service_path(name)) return not __salt__['cmd.retcode']...
[ "def", "start", "(", "name", ")", ":", "__salt__", "[", "'file.remove'", "]", "(", "'{0}/down'", ".", "format", "(", "_service_path", "(", "name", ")", ")", ")", "cmd", "=", "'svc -u {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "r...
Starts service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.start <service name>
[ "Starts", "service", "via", "daemontools" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L66-L78
train
saltstack/salt
salt/modules/daemontools.py
stop
def stop(name): ''' Stops service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.stop <service name> ''' __salt__['file.touch']('{0}/down'.format(_service_path(name))) cmd = 'svc -d {0}'.format(_service_path(name)) return not __salt__['cmd.retcode'](cmd...
python
def stop(name): ''' Stops service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.stop <service name> ''' __salt__['file.touch']('{0}/down'.format(_service_path(name))) cmd = 'svc -d {0}'.format(_service_path(name)) return not __salt__['cmd.retcode'](cmd...
[ "def", "stop", "(", "name", ")", ":", "__salt__", "[", "'file.touch'", "]", "(", "'{0}/down'", ".", "format", "(", "_service_path", "(", "name", ")", ")", ")", "cmd", "=", "'svc -d {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "ret...
Stops service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.stop <service name>
[ "Stops", "service", "via", "daemontools" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L82-L94
train
saltstack/salt
salt/modules/daemontools.py
term
def term(name): ''' Send a TERM to service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.term <service name> ''' cmd = 'svc -t {0}'.format(_service_path(name)) return not __salt__['cmd.retcode'](cmd, python_shell=False)
python
def term(name): ''' Send a TERM to service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.term <service name> ''' cmd = 'svc -t {0}'.format(_service_path(name)) return not __salt__['cmd.retcode'](cmd, python_shell=False)
[ "def", "term", "(", "name", ")", ":", "cmd", "=", "'svc -t {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "return", "not", "__salt__", "[", "'cmd.retcode'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")" ]
Send a TERM to service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.term <service name>
[ "Send", "a", "TERM", "to", "service", "via", "daemontools" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L97-L108
train
saltstack/salt
salt/modules/daemontools.py
status
def status(name, sig=None): ''' Return the status for a service via daemontools, return pid if running CLI Example: .. code-block:: bash salt '*' daemontools.status <service name> ''' cmd = 'svstat {0}'.format(_service_path(name)) out = __salt__['cmd.run_stdout'](cmd, python_shell...
python
def status(name, sig=None): ''' Return the status for a service via daemontools, return pid if running CLI Example: .. code-block:: bash salt '*' daemontools.status <service name> ''' cmd = 'svstat {0}'.format(_service_path(name)) out = __salt__['cmd.run_stdout'](cmd, python_shell...
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "cmd", "=", "'svstat {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "out", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "cmd", ",", "python_shell", "=", "False"...
Return the status for a service via daemontools, return pid if running CLI Example: .. code-block:: bash salt '*' daemontools.status <service name>
[ "Return", "the", "status", "for", "a", "service", "via", "daemontools", "return", "pid", "if", "running" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L157-L173
train
saltstack/salt
salt/modules/daemontools.py
enabled
def enabled(name, **kwargs): ''' Return True if the named service is enabled, false otherwise A service is considered enabled if in your service directory: - an executable ./run file exist - a file named "down" does not exist .. versionadded:: 2015.5.7 name Service name CLI Ex...
python
def enabled(name, **kwargs): ''' Return True if the named service is enabled, false otherwise A service is considered enabled if in your service directory: - an executable ./run file exist - a file named "down" does not exist .. versionadded:: 2015.5.7 name Service name CLI Ex...
[ "def", "enabled", "(", "name", ",", "*", "*", "kwargs", ")", ":", "if", "not", "available", "(", "name", ")", ":", "log", ".", "error", "(", "'Service %s not found'", ",", "name", ")", "return", "False", "run_file", "=", "os", ".", "path", ".", "join...
Return True if the named service is enabled, false otherwise A service is considered enabled if in your service directory: - an executable ./run file exist - a file named "down" does not exist .. versionadded:: 2015.5.7 name Service name CLI Example: .. code-block:: bash ...
[ "Return", "True", "if", "the", "named", "service", "is", "enabled", "false", "otherwise", "A", "service", "is", "considered", "enabled", "if", "in", "your", "service", "directory", ":", "-", "an", "executable", ".", "/", "run", "file", "exist", "-", "a", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L221-L250
train
saltstack/salt
salt/modules/reg.py
key_exists
def key_exists(hive, key, use_32bit_registry=False): r''' Check that the key is found in the registry. This refers to keys and not value/data pairs. Args: hive (str): The hive to connect to key (str): The key to check use_32bit_registry (bool): Look in the 32bit portion of th...
python
def key_exists(hive, key, use_32bit_registry=False): r''' Check that the key is found in the registry. This refers to keys and not value/data pairs. Args: hive (str): The hive to connect to key (str): The key to check use_32bit_registry (bool): Look in the 32bit portion of th...
[ "def", "key_exists", "(", "hive", ",", "key", ",", "use_32bit_registry", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.key_exists'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "use_32bit_registry", "=", "use_32bit_registry", ")" ...
r''' Check that the key is found in the registry. This refers to keys and not value/data pairs. Args: hive (str): The hive to connect to key (str): The key to check use_32bit_registry (bool): Look in the 32bit portion of the registry Returns: bool: True if exists, ot...
[ "r", "Check", "that", "the", "key", "is", "found", "in", "the", "registry", ".", "This", "refers", "to", "keys", "and", "not", "value", "/", "data", "pairs", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L99-L123
train
saltstack/salt
salt/modules/reg.py
list_keys
def list_keys(hive, key=None, use_32bit_registry=False): ''' Enumerates the subkeys in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU ...
python
def list_keys(hive, key=None, use_32bit_registry=False): ''' Enumerates the subkeys in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER or HKCU ...
[ "def", "list_keys", "(", "hive", ",", "key", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.list_keys'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "use_32bit_registry", "=", "use_32bit_re...
Enumerates the subkeys in a registry key or hive. 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_ROOT or HKCR ...
[ "Enumerates", "the", "subkeys", "in", "a", "registry", "key", "or", "hive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L146-L180
train
saltstack/salt
salt/modules/reg.py
list_values
def list_values(hive, key=None, use_32bit_registry=False, include_default=True): r''' Enumerates the values in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER ...
python
def list_values(hive, key=None, use_32bit_registry=False, include_default=True): r''' Enumerates the values in a registry key or hive. Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM - HKEY_CURRENT_USER ...
[ "def", "list_values", "(", "hive", ",", "key", "=", "None", ",", "use_32bit_registry", "=", "False", ",", "include_default", "=", "True", ")", ":", "return", "__utils__", "[", "'reg.list_values'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",...
r''' Enumerates the values in a registry key or hive. 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_ROOT or HKC...
[ "r", "Enumerates", "the", "values", "in", "a", "registry", "key", "or", "hive", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L183-L221
train
saltstack/salt
salt/modules/reg.py
read_value
def read_value(hive, key, vname=None, use_32bit_registry=False): r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM ...
python
def read_value(hive, key, vname=None, use_32bit_registry=False): r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` Args: hive (str): The name of the hive. Can be one of the following: - HKEY_LOCAL_MACHINE or HKLM ...
[ "def", "read_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "use_32bit_registry", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.read_value'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "vname", "=", "vname...
r''' Reads a registry value entry or the default value for a key. To read the default value, don't pass ``vname`` 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 ...
[ "r", "Reads", "a", "registry", "value", "entry", "or", "the", "default", "value", "for", "a", "key", ".", "To", "read", "the", "default", "value", "don", "t", "pass", "vname" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L224-L282
train
saltstack/salt
salt/modules/reg.py
set_value
def set_value(hive, key, vname=None, vdata=None, vtype='REG_SZ', use_32bit_registry=False, volatile=False): ''' Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it wil...
python
def set_value(hive, key, vname=None, vdata=None, vtype='REG_SZ', use_32bit_registry=False, volatile=False): ''' Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it wil...
[ "def", "set_value", "(", "hive", ",", "key", ",", "vname", "=", "None", ",", "vdata", "=", "None", ",", "vtype", "=", "'REG_SZ'", ",", "use_32bit_registry", "=", "False", ",", "volatile", "=", "False", ")", ":", "return", "__utils__", "[", "'reg.set_valu...
Sets a value in the registry. If ``vname`` is passed, it will be the value for that value name, otherwise it will be the default value for the specified key Args: hive (str): The name of the hive. Can be one of the following - HKEY_LOCAL_MACHINE or HKLM ...
[ "Sets", "a", "value", "in", "the", "registry", ".", "If", "vname", "is", "passed", "it", "will", "be", "the", "value", "for", "that", "value", "name", "otherwise", "it", "will", "be", "the", "default", "value", "for", "the", "specified", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L285-L408
train
saltstack/salt
salt/modules/reg.py
delete_key_recursive
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 ...
python
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", ")", ":", "return", "__utils__", "[", "'reg.delete_key_recursive'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "use_32bit_registry", "=", "use_32b...
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 ...
[ "r", "..", "versionadded", "::", "2015", ".", "5", ".", "4" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L411-L450
train
saltstack/salt
salt/modules/reg.py
delete_value
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...
python
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", ")", ":", "return", "__utils__", "[", "'reg.delete_value'", "]", "(", "hive", "=", "hive", ",", "key", "=", "key", ",", "vname", "=", "v...
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...
[ "r", "Delete", "a", "registry", "value", "entry", "or", "the", "default", "value", "for", "a", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L453-L491
train
saltstack/salt
salt/modules/reg.py
import_file
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...
python
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", ")", ":", "cache_path", "=", "__salt__", "[", "'cp.cache_file'", "]", "(", "source", ")", "if", "not", "cache_path", ":", "error_msg", "=", "\"File/URL '{0}' probably invalid.\"", ".", ...
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_...
[ "Import", "registry", "settings", "from", "a", "Windows", "REG", "file", "by", "invoking", "REG", ".", "EXE", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L494-L542
train
saltstack/salt
salt/pillar/ec2_pillar.py
ext_pillar
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...
python
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", ",", "t...
Execute a command and read the output as YAML
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "YAML" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/ec2_pillar.py#L108-L254
train
saltstack/salt
salt/pillar/venafi.py
ext_pillar
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) ...
python
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", ")", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ",", "syspaths", ".", "CACHE_DIR", ")", "ret", "=", "{", "}", "dns_names", "=", "cache", ".", "fetch", "("...
Return an existing set of certificates
[ "Return", "an", "existing", "set", "of", "certificates" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/venafi.py#L32-L44
train
saltstack/salt
salt/modules/s6.py
status
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...
python
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", ")", ":", "cmd", "=", "'s6-svstat {0}'", ".", "format", "(", "_service_path", "(", "name", ")", ")", "out", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "cmd", ")", "try", ":", "pid", "=",...
Return the status for a service via s6, return pid if running CLI Example: .. code-block:: bash salt '*' s6.status <service name>
[ "Return", "the", "status", "for", "a", "service", "via", "s6", "return", "pid", "if", "running" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L135-L151
train
saltstack/salt
salt/modules/s6.py
get_all
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...
python
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", "(", ")", ":", "if", "not", "SERVICE_DIR", ":", "raise", "CommandExecutionError", "(", "\"Could not find service directory.\"", ")", "service_list", "=", "[", "dirname", "for", "dirname", "in", "os", ".", "listdir", "(", "SERVICE_DIR", ")", "if...
Return a list of all available services CLI Example: .. code-block:: bash salt '*' s6.get_all
[ "Return", "a", "list", "of", "all", "available", "services" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L183-L198
train
saltstack/salt
salt/modules/omapi.py
add_host
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...
python
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", ")", ":", "statements", "=", "''", "o", "=", "_conn", "(", ")", "msg", "="...
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
[ "Add", "a", "host", "object", "for", "the", "given", "mac", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L60-L99
train
saltstack/salt
salt/modules/omapi.py
delete_host
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...
python
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", ")", ":", "if", "not", "(", "mac", "or", "name", ")", ":", "raise", "TypeError", "(", "'At least one argument is required'", ")", "o", "=", "_conn", "(", ")", "msg", "=", "omapi",...
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
[ "Delete", "the", "host", "with", "the", "given", "mac", "or", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L102-L130
train
saltstack/salt
salt/modules/mine.py
_auth
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.') ...
python
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", "(", ")", ":", "if", "'auth'", "not", "in", "__context__", ":", "try", ":", "__context__", "[", "'auth'", "]", "=", "salt", ".", "crypt", ".", "SAuth", "(", "__opts__", ")", "except", "SaltClientError", ":", "log", ".", "error", "(", ...
Return the auth object
[ "Return", "the", "auth", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L40-L50
train
saltstack/salt
salt/modules/mine.py
update
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: ...
python
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", ")", ":", "m_data", "=", "{", "}", "if", "not", "mine_functions", ":", "m_data", "=", "__salt__", "[", "'config.merge'", "]", "(", "'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 the option `mine_functions`: .. code-block:: yaml mine_functions: network.ip_addrs: - eth0 disk.u...
[ "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",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L86-L188
train
saltstack/salt
salt/modules/mine.py
send
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...
python
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", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "mine_func", "=", "kwargs", ".", "pop", "(", "'mine_function'", ",...
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
[ "Send", "a", "specific", "function", "to", "the", "mine", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L191-L242
train
saltstack/salt
salt/modules/mine.py
get
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 ...
python
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", ")", ":", "if", "__opts__", "[", "'file_client'", "]", "==", "'local'", ":", "ret", "=", "{", "}", "is_target", "=", "{", "'glob'", ":", "__sal...
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...
[ "Get", "data", "from", "the", "mine", "based", "on", "the", "target", "function", "and", "tgt_type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L245-L339
train
saltstack/salt
salt/modules/mine.py
delete
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...
python
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", ")", ":", "if", "__opts__", "[", "'file_client'", "]", "==", "'local'", ":", "data", "=", "__salt__", "[", "'data.get'", "]", "(", "'mine_cache'", ")", "if", "isinstance", "(", "data", ",", "dict", ")", "and", "fun", "in", ...
Remove specific function contents of minion. Returns True on success. CLI Example: .. code-block:: bash salt '*' mine.delete 'network.interfaces'
[ "Remove", "specific", "function", "contents", "of", "minion", ".", "Returns", "True", "on", "success", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L342-L362
train
saltstack/salt
salt/modules/mine.py
get_docker
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...
python
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", ")", ":", "# Enforce that interface and cidr are lists", "if", "interfaces", ":", "interface_", "=", "[", "]", "interface_", ".", "extend", "(...
.. 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 `...
[ "..", "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L384-L489
train
saltstack/salt
salt/modules/mine.py
valid
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...
python
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", "(", ")", ":", "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", "=", "{...
List valid entries in mine configuration. CLI Example: .. code-block:: bash salt '*' mine.valid
[ "List", "valid", "entries", "in", "mine", "configuration", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L492-L528
train
saltstack/salt
salt/returners/pgjsonb.py
returner
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))''' ...
python
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", ")", ":", "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 ...
Return data to a Pg server
[ "Return", "data", "to", "a", "Pg", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L288-L305
train
saltstack/salt
salt/returners/pgjsonb.py
event_return
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', '')...
python
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", ")", ":", "with", "_get_serv", "(", "events", ",", "commit", "=", "True", ")", "as", "cur", ":", "for", "event", "in", "events", ":", "tag", "=", "event", ".", "get", "(", "'tag'", ",", "''", ")", "data", "=", ...
Return event to Pg server Requires that configuration be enabled via 'event_return' option in master config.
[ "Return", "event", "to", "Pg", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L308-L322
train
saltstack/salt
salt/returners/pgjsonb.py
save_load
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: #...
python
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", ")", ":", "with", "_get_serv", "(", "commit", "=", "True", ")", "as", "cur", ":", "try", ":", "cur", ".", "execute", "(", "PG_SAVE_LOAD_SQL", ",", "{", "'jid'", ":", "jid", "...
Save the load to the specified jid id
[ "Save", "the", "load", "to", "the", "specified", "jid", "id" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L325-L337
train
saltstack/salt
salt/returners/pgjsonb.py
get_load
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 {}
python
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", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT load FROM jids WHERE jid = %s;'''", "cur", ".", "execute", "(", "sql", ",", "(", "jid", ",", ...
Return the load data that marks a specified jid
[ "Return", "the", "load", "data", "that", "marks", "a", "specified", "jid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L347-L358
train
saltstack/salt
salt/returners/pgjsonb.py
get_jid
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() ...
python
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", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT id, full_ret FROM salt_returns\n WHERE jid = %s'''", "cur", ".", "execute", "(", "sql",...
Return the information returned when the specified job id was executed
[ "Return", "the", "information", "returned", "when", "the", "specified", "job", "id", "was", "executed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L361-L376
train
saltstack/salt
salt/returners/pgjsonb.py
get_fun
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...
python
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", ")", ":", "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 ...
Return a dict of the last function called for all minions
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L379-L400
train
saltstack/salt
salt/returners/pgjsonb.py
_purge_jobs
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)' ...
python
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", ")", ":", "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", ",", "(...
Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return:
[ "Purge", "records", "from", "the", "returner", "tables", ".", ":", "param", "job_age_in_seconds", ":", "Purge", "jobs", "older", "than", "this", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L444-L481
train
saltstack/salt
salt/returners/pgjsonb.py
_archive_jobs
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: ...
python
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", ")", ":", "source_tables", "=", "[", "'jids'", ",", "'salt_returns'", ",", "'salt_events'", "]", "with", "_get_serv", "(", ")", "as", "cursor", ":", "target_tables", "=", "{", "}", "for", "table_name", "in", "source_...
Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return:
[ "Copy", "rows", "to", "a", "set", "of", "backup", "tables", "then", "purge", "rows", ".", ":", "param", "timestamp", ":", "Archive", "rows", "older", "than", "this", "timestamp", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L484-L542
train
saltstack/salt
salt/returners/pgjsonb.py
clean_old_jobs
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: ...
python
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", "(", ")", ":", "if", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "False", ")", "and", "int", "(", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "0", ")", ")", ">", "0", ":", "try", ":", "with", "_get_serv", "(", ")"...
Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return:
[ "Called", "in", "the", "master", "s", "event", "loop", "every", "loop_interval", ".", "Archives", "and", "/", "or", "deletes", "the", "events", "and", "job", "details", "from", "the", "database", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L545-L564
train
saltstack/salt
salt/modules/win_status.py
cpustats
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...
python
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", "(", ")", ":", "# 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...
Return information about the CPU. Returns dict: A dictionary containing information about the CPU stats CLI Example: .. code-block:: bash salt * status.cpustats
[ "Return", "information", "about", "the", "CPU", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L167-L202
train
saltstack/salt
salt/modules/win_status.py
meminfo
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...
python
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", "(", ")", ":", "# 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", ",",...
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
[ "Return", "information", "about", "physical", "and", "virtual", "memory", "on", "the", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L205-L242
train
saltstack/salt
salt/modules/win_status.py
vmstats
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 = ...
python
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", "(", ")", ":", "# 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...
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
[ "Return", "information", "about", "the", "virtual", "memory", "on", "the", "machine" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L245-L272
train
saltstack/salt
salt/modules/win_status.py
diskusage
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...
python
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", ")", ":", "if", "not", "path", ":", "path", "=", "'c:/'", "disk_stats", "=", "psutil", ".", "disk_usage", "(", "path", ")", "total_val", "=", "disk_stats", ".", "total", ...
.. 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
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L322-L355
train
saltstack/salt
salt/modules/win_status.py
procs
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...
python
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", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "wmi_obj", "=", "wmi", ".", "WMI", "(", ")", "processes", "=", "wmi_obj", ".", "win32_process", "(", ")", "#this short circu...
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
[ "Return", "the", "process", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L358-L387
train
saltstack/salt
salt/modules/win_status.py
saltmem
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...
python
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", ")", ":", "# psutil.Process defaults to current process (`os.getpid()`)", "p", "=", "psutil", ".", "Process", "(", ")", "# Use oneshot to get a snapshot", "with", "p", ".", "oneshot", "(", ")", ":", "mem", "=", ...
.. 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
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L390-L416
train
saltstack/salt
salt/modules/win_status.py
uptime
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:: ...
python
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", ")", ":", "# Get startup time", "startup_time", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "psutil", ".", "boot_time", "(", ")", ")", "# Subtract startup time from current time to get the uptime of ...
.. 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...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L419-L453
train
saltstack/salt
salt/modules/win_status.py
_get_process_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
python
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", ")", ":", "cmd", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "proc", ".", "CommandLine", "or", "''", ")", "name", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", ...
Return process information
[ "Return", "process", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L456-L467
train
saltstack/salt
salt/modules/win_status.py
master
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 ...
python
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", ")", ":", "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...
.. 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 '*' ...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L506-L589
train
saltstack/salt
salt/modules/poudriere.py
_check_config_exists
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
python
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", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "_config_file", "(", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "config_file", ")", ":", "return", "False", ...
Verify the config file is present
[ "Verify", "the", "config", "file", "is", "present" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L43-L51
train
saltstack/salt
salt/modules/poudriere.py
is_jail
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
python
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", ")", ":", "jails", "=", "list_jails", "(", ")", "for", "jail", "in", "jails", ":", "if", "jail", ".", "split", "(", ")", "[", "0", "]", "==", "name", ":", "return", "True", "return", "False" ]
Return True if jail exists False if not CLI Example: .. code-block:: bash salt '*' poudriere.is_jail <jail name>
[ "Return", "True", "if", "jail", "exists", "False", "if", "not" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L54-L68
train
saltstack/salt
salt/modules/poudriere.py
make_pkgng_aware
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) ...
python
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", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", "}", "cdir", "=", "_config_dir", "(", ")", "# ensure cdir is there", "if", "not", "os", ".", "path", ".", "isdir", "(", "cdir", ")", ":", "os", ".", "make...
Make jail ``jname`` pkgng aware CLI Example: .. code-block:: bash salt '*' poudriere.make_pkgng_aware <jail name>
[ "Make", "jail", "jname", "pkgng", "aware" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L71-L103
train
saltstack/salt
salt/modules/poudriere.py
parse_config
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): ...
python
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", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "_config_file", "(", ")", "ret", "=", "{", "}", "if", "_check_config_exists", "(", "config_file", ")", ":", "with", "salt", ".", ...
Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config
[ "Returns", "a", "dict", "of", "poudriere", "main", "configuration", "definitions" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L106-L126
train
saltstack/salt
salt/modules/poudriere.py
create_jail
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...
python
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\"", ")", ":", "# 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...
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
[ "Creates", "a", "new", "poudriere", "jail", "if", "one", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L175-L204
train
saltstack/salt
salt/modules/poudriere.py
update_jail
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...
python
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", ")", ":", "if", "is_jail", "(", "name", ")", ":", "cmd", "=", "'poudriere jail -u -j {0}'", ".", "format", "(", "name", ")", "ret", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "return", "ret", "else", ":"...
Run freebsd-update on `name` poudriere jail CLI Example: .. code-block:: bash salt '*' poudriere.update_jail freebsd:10:x86:64
[ "Run", "freebsd", "-", "update", "on", "name", "poudriere", "jail" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L207-L222
train
saltstack/salt
salt/modules/poudriere.py
delete_jail
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 ...
python
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", ")", ":", "if", "is_jail", "(", "name", ")", ":", "cmd", "=", "'poudriere jail -d -j {0}'", ".", "format", "(", "name", ")", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# Make sure jail is gone", "if", "is_jail", ...
Deletes poudriere jail with `name` CLI Example: .. code-block:: bash salt '*' poudriere.delete_jail 90amd64
[ "Deletes", "poudriere", "jail", "with", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L225-L257
train
saltstack/salt
salt/modules/poudriere.py
update_ports_tree
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...
python
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", ")", ":", "_check_config_exists", "(", ")", "if", "ports_tree", ":", "cmd", "=", "'poudriere ports -u -p {0}'", ".", "format", "(", "ports_tree", ")", "else", ":", "cmd", "=", "'poudriere ports -u'", "ret", "=", "__...
Updates the ports tree, either the default or the `ports_tree` specified CLI Example: .. code-block:: bash salt '*' poudriere.update_ports_tree staging
[ "Updates", "the", "ports", "tree", "either", "the", "default", "or", "the", "ports_tree", "specified" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L270-L286
train
saltstack/salt
salt/modules/poudriere.py
bulk_build
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...
python
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", ")", ":", "# 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'"...
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
[ "Run", "bulk", "build", "on", "poudriere", "server", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L289-L321
train
saltstack/salt
salt/modules/opkg.py
_update_nilrt_restart_state
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...
python
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", "(", ")", ":", "__salt__", "[", "'cmd.shell'", "]", "(", "'stat -c %Y /lib/modules/$(uname -r)/modules.dep >{0}/modules.dep.timestamp'", ".", "format", "(", "NILRT_RESTARTCHECK_STATE_PATH", ")", ")", "__salt__", "[", "'cmd.shell'", "]", ...
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...
[ "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"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L63-L106
train
saltstack/salt
salt/modules/opkg.py
_get_restartcheck_result
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...
python
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", ")", ":", "rs_result", "=", "__salt__", "[", "'restartcheck.restartcheck'", "]", "(", "verbose", "=", "False", ")", "if", "isinstance", "(", "rs_result", ",", "dict", ")", "and", "'comment'", "in", "rs_result", ...
Return restartcheck result and append errors (if any) to ``errors``
[ "Return", "restartcheck", "result", "and", "append", "errors", "(", "if", "any", ")", "to", "errors" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L109-L116
train
saltstack/salt
salt/modules/opkg.py
_process_restartcheck_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: ...
python
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", ")", ":", "if", "'No packages seem to need to be restarted'", "in", "rs_result", ":", "return", "reboot_required", "=", "False", "for", "rstr", "in", "rs_result", ":", "if", "'System r...
Check restartcheck output to see if system/service restarts were requested and take appropriate action.
[ "Check", "restartcheck", "output", "to", "see", "if", "system", "/", "service", "restarts", "were", "requested", "and", "take", "appropriate", "action", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L119-L137
train
saltstack/salt
salt/modules/opkg.py
refresh_db
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: - `...
python
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", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ...
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...
[ "Updates", "the", "opkg", "database", "to", "latest", "packages", "based", "upon", "repositories" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L231-L294
train
saltstack/salt
salt/modules/opkg.py
_build_install_command_list
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...
python
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", ")", ":", "cmds", "=", "[", "]", "if", "to_install", ":", "cmd", "=", "copy", ".", "deepcopy", "(", "cmd_prefix", ")", "cmd", ".", "extend",...
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.
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L312-L333
train
saltstack/salt
salt/modules/opkg.py
_parse_reported_packages_from_install_output
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...
python
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", ")", ":", "reported_pkgs", "=", "{", "}", "install_pattern", "=", "re", ".", "compile", "(", "r'Installing\\s(?P<package>.*?)\\s\\((?P<version>.*?)\\)\\son\\s(?P<target>.*?)'", ")", "upgrade_pattern", "=", ...
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
[ "Parses", "the", "output", "of", "opkg", "install", "to", "determine", "what", "packages", "would", "have", "been", "installed", "by", "an", "operation", "run", "with", "the", "--", "noaction", "flag", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L336-L356
train
saltstack/salt
salt/modules/opkg.py
_execute_install_command
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...
python
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", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'trace'", ",", "python_shell", "=", "False", ")", ...
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.
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L359-L377
train
saltstack/salt
salt/modules/opkg.py
install
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...
python
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", ")", ":", "refreshdb", "=", "salt", ".", "utils", ".", "data",...
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 ...
[ "Install", "the", "passed", "package", "add", "refresh", "=", "True", "to", "update", "the", "opkg", "database", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L380-L587
train
saltstack/salt
salt/modules/opkg.py
_parse_reported_packages_from_remove_output
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...
python
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", ")", ":", "reported_pkgs", "=", "{", "}", "remove_pattern", "=", "re", ".", "compile", "(", "r'Removing\\s(?P<package>.*?)\\s\\((?P<version>.*?)\\)\\sfrom\\s(?P<target>.*?)...'", ")", "for", "line", "in", ...
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>...
[ "Parses", "the", "output", "of", "opkg", "remove", "to", "determine", "what", "packages", "would", "have", "been", "removed", "by", "an", "operation", "run", "with", "the", "--", "noaction", "flag", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L590-L605
train
saltstack/salt
salt/modules/opkg.py
remove
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``...
python
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", "try", ":", "pkg_params", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", ")", ...
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...
[ "Remove", "packages", "using", "opkg", "remove", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L608-L690
train
saltstack/salt
salt/modules/opkg.py
upgrade
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...
python
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", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "}", "errors", "=", "[",...
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
[ "Upgrades", "all", "packages", "via", "opkg", "upgrade" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L722-L773
train
saltstack/salt
salt/modules/opkg.py
hold
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 ...
python
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", "if", "not", "name", "and", "not", "pkgs", "and", "not", "sources", ":", "raise", "SaltInvocat...
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: ...
[ "Set", "package", "in", "hold", "state", "meaning", "it", "will", "not", "be", "upgraded", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L776-L844
train
saltstack/salt
salt/modules/opkg.py
_get_state
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...
python
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", ")", ":", "cmd", "=", "[", "'opkg'", ",", "'status'", "]", "cmd", ".", "append", "(", "pkg", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "state_flag", "=", ...
View package state from the opkg database Return the state of pkg
[ "View", "package", "state", "from", "the", "opkg", "database" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L919-L933
train
saltstack/salt
salt/modules/opkg.py
_set_state
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...
python
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", ")", ":", "ret", "=", "{", "}", "valid_states", "=", "(", "'hold'", ",", "'noprune'", ",", "'user'", ",", "'ok'", ",", "'installed'", ",", "'unpacked'", ")", "if", "state", "not", "in", "valid_states", ":"...
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...
[ "Change", "package", "state", "on", "the", "opkg", "database" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L936-L968
train
saltstack/salt
salt/modules/opkg.py
list_upgrades
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...
python
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", "ret", "=", "{", "}", "if", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "refresh", ")", ":", "refresh_db", "(", ")", ...
List all available package upgrades. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades
[ "List", "all", "available", "package", "upgrades", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1018-L1051
train
saltstack/salt
salt/modules/opkg.py
_convert_to_standard_attr
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...
python
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", ")", ":", "ret_attr", "=", "ATTR_MAP", ".", "get", "(", "attr", ",", "None", ")", "if", "ret_attr", "is", "None", ":", "# All others convert to lowercase", "return", "attr", ".", "lower", "(", ")", "return", "...
Helper function for _process_info_installed_output() Converts an opkg attribute name to a standard attribute name which is used across 'pkg' modules.
[ "Helper", "function", "for", "_process_info_installed_output", "()" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1054-L1065
train
saltstack/salt
salt/modules/opkg.py
_process_info_installed_output
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 ...
python
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", ")", ":", "ret", "=", "{", "}", "name", "=", "None", "attrs", "=", "{", "}", "attr", "=", "None", "for", "line", "in", "salt", ".", "utils", ".", "itertools", ".", "split", "(", ...
Helper function for info_installed() Processes stdout output from a single invocation of 'opkg status'.
[ "Helper", "function", "for", "info_installed", "()" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1068-L1109
train
saltstack/salt
salt/modules/opkg.py
info_installed
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...
python
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", ")", ":", "attr", "=", "kwargs", ".", "pop", "(", "'attr'", ",", "None", ")", "if", "attr", "is", "None", ":", "filter_attrs", "=", "None", "elif", "isinstance", "(", "attr", ",", ...
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...
[ "Return", "the", "information", "of", "the", "named", "package", "(", "s", ")", "installed", "on", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1112-L1182
train
saltstack/salt
salt/modules/opkg.py
version_cmp
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 ...
python
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", "normalize", "=", "lambda", "x", ":", "six", ".", "text_type", "(", "x", ")", ".", "split", "(", "'...
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...
[ "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", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1198-L1244
train
saltstack/salt
salt/modules/opkg.py
_set_repo_option
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]
python
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", ")", ":", "if", "not", "option", ":", "return", "opt", "=", "option", ".", "split", "(", "'='", ")", "if", "len", "(", "opt", ")", "!=", "2", ":", "return", "if", "opt", "[", "0", "]", "==", ...
Set the option to repo
[ "Set", "the", "option", "to", "repo" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1247-L1259
train
saltstack/salt
salt/modules/opkg.py
_set_repo_options
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)
python
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", ")", ":", "delimiters", "=", "\"[\"", ",", "\"]\"", "pattern", "=", "'|'", ".", "join", "(", "map", "(", "re", ".", "escape", ",", "delimiters", ")", ")", "for", "option", "in", "options", ":", ...
Set the options to the repo.
[ "Set", "the", "options", "to", "the", "repo", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1262-L1271
train
saltstack/salt
salt/modules/opkg.py
_create_repo
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'...
python
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", ")", ":", "repo", "=", "{", "}", "if", "line", ".", "startswith", "(", "'#'", ")", ":", "repo", "[", "'enabled'", "]", "=", "False", "line", "=", "line", "[", "1", ":", "]", "else", ":", "repo"...
Create repo
[ "Create", "repo" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1274-L1291
train
saltstack/salt
salt/modules/opkg.py
_read_repos
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...
python
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", ")", ":", "for", "line", "in", "conf_file", ":", "line", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "line", ")", "if", "not", "regex", ".",...
Read repos from configuration file
[ "Read", "repos", "from", "configuration", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1294-L1306
train
saltstack/salt
salt/modules/opkg.py
list_repos
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...
python
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", "repos", "=", "{", "}", "regex", "=", "re", ".", "compile", "(", "REPO_REGEXP", ")", "for", "filename", "in", "os", ".", "listdir", "(", "OPKG_CONFDIR", ")", ":", ...
Lists all repos on ``/etc/opkg/*.conf`` CLI Example: .. code-block:: bash salt '*' pkg.list_repos
[ "Lists", "all", "repos", "on", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1309-L1326
train
saltstack/salt
salt/modules/opkg.py
get_repo
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...
python
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", "repos", "=", "list_repos", "(", ")", "if", "repos", ":", "for", "source", "in", "six", ".", "itervalues", "(", "repos", ")", ":", "for", "sub", "in",...
Display a repo from the ``/etc/opkg/*.conf`` CLI Examples: .. code-block:: bash salt '*' pkg.get_repo repo
[ "Display", "a", "repo", "from", "the", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1329-L1346
train
saltstack/salt
salt/modules/opkg.py
_del_repo_from_file
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...
python
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", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "filepath", ")", "as", "fhandle", ":", "output", "=", "[", "]", "regex", "=", "re", ".", "compile", "(", "REPO_REGEXP",...
Remove a repo from filepath
[ "Remove", "a", "repo", "from", "filepath" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1349-L1365
train
saltstack/salt
salt/modules/opkg.py
_set_trusted_option_if_needed
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
python
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", ")", ":", "if", "trusted", "is", "True", ":", "repostr", "+=", "' [trusted=yes]'", "elif", "trusted", "is", "False", ":", "repostr", "+=", "' [trusted=no]'", "return", "repostr" ]
Set trusted option to repo if needed
[ "Set", "trusted", "option", "to", "repo", "if", "needed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1368-L1376
train
saltstack/salt
salt/modules/opkg.py
_add_new_repo
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...
python
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", ")", ":", "repostr", "=", "'# '", "if", "not", "properties", ".", "get", "(", "'enabled'", ")", "else", "''", "repostr", "+=", "'src/gz '", "if", "properties", ".", "get", "(", "'compressed'", ")", ...
Add a new repo entry
[ "Add", "a", "new", "repo", "entry" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1379-L1395
train
saltstack/salt
salt/modules/opkg.py
_mod_repo_in_file
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)...
python
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", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "filepath", ")", "as", "fhandle", ":", "output", "=", "[", "]", "for", "line", "in", "fhandle", ":", "c...
Replace a repo entry in filepath with repostr
[ "Replace", "a", "repo", "entry", "in", "filepath", "with", "repostr" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1398-L1413
train
saltstack/salt
salt/modules/opkg.py
del_repo
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 =...
python
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", "refresh", "=", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "kwargs", ".", "get", "(", "'refresh'", ",", "True", ")", ")", "repos", "=", ...
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
[ "Delete", "a", "repo", "from", "/", "etc", "/", "opkg", "/", "*", ".", "conf" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1416-L1459
train
saltstack/salt
salt/modules/opkg.py
mod_repo
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...
python
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", ")", ":", "repos", "=", "list_repos", "(", ")", "found", "=", "False", "uri", "=", "''", "if", "'uri'", "in", "kwargs", ":", "uri", "=", "kwargs", "[", "'uri'", "]", "for", "repository", "in"...
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 ...
[ "Modify", "one", "or", "more", "values", "for", "a", "repo", ".", "If", "the", "repo", "does", "not", "exist", "it", "will", "be", "created", "so", "long", "as", "uri", "is", "defined", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1462-L1533
train
saltstack/salt
salt/modules/opkg.py
file_list
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 '*' ...
python
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", "output", "=", "file_dict", "(", "*", "packages", ")", "files", "=", "[", "]", "for", "package", "in", "list", "(", "output", "[", "'packages'...
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...
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1536-L1554
train
saltstack/salt
salt/modules/opkg.py
file_dict
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...
python
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", "errors", "=", "[", "]", "ret", "=", "{", "}", "cmd_files", "=", "[", "'opkg'", ",", "'files'", "]", "if", "not", "packages", ":", "packages...
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...
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1557-L1596
train