repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container
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...
.. 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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2618-L2651
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container_metadata
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 ...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2658-L2694
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
set_storage_container_metadata
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...
.. 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: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2701-L2749
[ "def safe_load(stream, Loader=SaltYamlSafeLoader):\n '''\n .. versionadded:: 2018.3.0\n\n Helper function which automagically uses our custom loader.\n '''\n return yaml.load(stream, Loader=Loader)\n", "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .....
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
show_storage_container_acl
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...
.. 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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2752-L2788
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
set_storage_container_acl
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2795-L2834
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
delete_storage_container
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2837-L2876
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
lease_storage_container
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2879-L2955
null
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
list_blobs
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2958-L3028
[ "def list_blobs(storage_conn=None, **kwargs):\n '''\n .. versionadded:: 2015.8.0\n\n List blobs associated with the container\n '''\n if not storage_conn:\n storage_conn = get_storage_conn(opts=kwargs)\n\n if 'container' not in kwargs:\n raise SaltSystemExit(\n code=42,\n ...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
show_blob_service_properties
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...
.. versionadded:: 2015.8.0 Show a blob's service properties CLI Example: .. code-block:: bash salt-cloud -f show_blob_service_properties my-azure
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3031-L3054
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
set_blob_service_properties
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...
.. 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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3061-L3099
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
show_blob_properties
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...
.. 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. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3102-L3148
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
set_blob_properties
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3155-L3221
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
put_blob
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...
.. 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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3224-L3296
[ "def get_storage_conn(storage_account=None, storage_key=None, conn_kwargs=None):\n '''\n .. versionadded:: 2015.8.0\n\n Return a storage_conn object for the storage account\n '''\n if conn_kwargs is None:\n conn_kwargs = {}\n\n if not storage_account:\n storage_account = config.get_c...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/cloud/clouds/msazure.py
query
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...
Perform a query directly against the Azure REST API
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L3369-L3420
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' Azure Cloud Module ================== The Azure cloud module is used to control access to Microsoft Azure :depends: * `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/1.0.2>`_ >= 1.0.2 * python-requests, for Python < 2.7.9 :configuration: Required provider pa...
saltstack/salt
salt/modules/daemontools.py
start
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']...
Starts service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.start <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L66-L78
[ "def _service_path(name):\n '''\n build service path\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError(\"Could not find service directory.\")\n return '{0}/{1}'.format(SERVICE_DIR, name)\n" ]
# -*- coding: utf-8 -*- ''' daemontools service module. This module will create daemontools type service watcher. This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service.r...
saltstack/salt
salt/modules/daemontools.py
stop
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...
Stops service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.stop <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L82-L94
[ "def _service_path(name):\n '''\n build service path\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError(\"Could not find service directory.\")\n return '{0}/{1}'.format(SERVICE_DIR, name)\n" ]
# -*- coding: utf-8 -*- ''' daemontools service module. This module will create daemontools type service watcher. This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service.r...
saltstack/salt
salt/modules/daemontools.py
term
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)
Send a TERM to service via daemontools CLI Example: .. code-block:: bash salt '*' daemontools.term <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L97-L108
[ "def _service_path(name):\n '''\n build service path\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError(\"Could not find service directory.\")\n return '{0}/{1}'.format(SERVICE_DIR, name)\n" ]
# -*- coding: utf-8 -*- ''' daemontools service module. This module will create daemontools type service watcher. This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service.r...
saltstack/salt
salt/modules/daemontools.py
status
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...
Return the status for a service via daemontools, return pid if running CLI Example: .. code-block:: bash salt '*' daemontools.status <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L157-L173
[ "def _service_path(name):\n '''\n build service path\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError(\"Could not find service directory.\")\n return '{0}/{1}'.format(SERVICE_DIR, name)\n" ]
# -*- coding: utf-8 -*- ''' daemontools service module. This module will create daemontools type service watcher. This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service.r...
saltstack/salt
salt/modules/daemontools.py
enabled
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/daemontools.py#L221-L250
[ "def available(name):\n '''\n Returns ``True`` if the specified service is available, otherwise returns\n ``False``.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' daemontools.available foo\n '''\n return name in get_all()\n" ]
# -*- coding: utf-8 -*- ''' daemontools service module. This module will create daemontools type service watcher. This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service.r...
saltstack/salt
salt/modules/reg.py
key_exists
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L99-L123
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
list_keys
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 ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L146-L180
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
list_values
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L183-L221
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
read_value
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 ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L224-L282
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
set_value
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L285-L408
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
delete_key_recursive
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 ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L411-L450
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
delete_value
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L453-L491
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/modules/reg.py
import_file
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...
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_...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/reg.py#L494-L542
null
# -*- coding: utf-8 -*- r''' Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subkeys. Keys can have a value assigned to...
saltstack/salt
salt/pillar/ec2_pillar.py
ext_pillar
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...
Execute a command and read the output as YAML
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/ec2_pillar.py#L108-L254
[ "def _get_instance_info():\n '''\n Helper function to return the instance ID and region of the master where\n this pillar is run.\n '''\n identity = boto.utils.get_instance_identity()['document']\n return (identity['instanceId'], identity['region'])\n" ]
# -*- coding: utf-8 -*- ''' Retrieve EC2 instance data for minions for ec2_tags and ec2_tags_list The minion id must be the AWS instance-id or value in ``tag_match_key``. For example set ``tag_match_key`` to ``Name`` to have the minion-id matched against the tag 'Name'. The tag contents must be unique. The value of `...
saltstack/salt
salt/pillar/venafi.py
ext_pillar
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) ...
Return an existing set of certificates
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/venafi.py#L32-L44
[ "def fetch(self, bank, key):\n '''\n Fetch data using the specified module\n\n :param bank:\n The name of the location inside the cache which will hold the key\n and its associated data.\n\n :param key:\n The name of the key (or file inside a directory) which will hold\n the ...
# -*- coding: utf-8 -*- ''' Venafi Pillar Certificates This module will only return pillar data if the ``venafi`` runner module has already been used to create certificates. To configure this module, set ``venafi`` to ``True`` in the ``ext_pillar`` section of your ``master`` configuration file: .. code-block:: yaml ...
saltstack/salt
salt/modules/s6.py
status
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...
Return the status for a service via s6, return pid if running CLI Example: .. code-block:: bash salt '*' s6.status <service name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L135-L151
[ "def _service_path(name):\n '''\n build service path\n '''\n if not SERVICE_DIR:\n raise CommandExecutionError(\"Could not find service directory.\")\n return '{0}/{1}'.format(SERVICE_DIR, name)\n" ]
# -*- coding: utf-8 -*- ''' s6 service module This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service: - running - provider: s6 Note that the ``enabled`` ...
saltstack/salt
salt/modules/s6.py
get_all
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...
Return a list of all available services CLI Example: .. code-block:: bash salt '*' s6.get_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s6.py#L183-L198
null
# -*- coding: utf-8 -*- ''' s6 service module This module is compatible with the :mod:`service <salt.states.service>` states, so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: service: - running - provider: s6 Note that the ``enabled`` ...
saltstack/salt
salt/modules/omapi.py
add_host
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L60-L99
[ "def _conn():\n server_ip = __pillar__.get('omapi.server_ip',\n __opts__.get('omapi.server_ip', '127.0.0.1'))\n server_port = __pillar__.get('omapi.server_port',\n __opts__.get('omapi.server_port', 7991))\n key = __pillar__.get('omapi.key',\n __opts__.get('omapi.key', None)...
# -*- coding: utf-8 -*- ''' This module interacts with an ISC DHCP Server via OMAPI. server_ip and server_port params may be set in the minion config or pillar: .. code-block:: yaml omapi.server_ip: 127.0.0.1 omapi.server_port: 7991 :depends: pypureomapi Python module ''' # Import python libs from __future__ im...
saltstack/salt
salt/modules/omapi.py
delete_host
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/omapi.py#L102-L130
[ "def _conn():\n server_ip = __pillar__.get('omapi.server_ip',\n __opts__.get('omapi.server_ip', '127.0.0.1'))\n server_port = __pillar__.get('omapi.server_port',\n __opts__.get('omapi.server_port', 7991))\n key = __pillar__.get('omapi.key',\n __opts__.get('omapi.key', None)...
# -*- coding: utf-8 -*- ''' This module interacts with an ISC DHCP Server via OMAPI. server_ip and server_port params may be set in the minion config or pillar: .. code-block:: yaml omapi.server_ip: 127.0.0.1 omapi.server_port: 7991 :depends: pypureomapi Python module ''' # Import python libs from __future__ im...
saltstack/salt
salt/modules/mine.py
_auth
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.') ...
Return the auth object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L40-L50
null
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
update
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: ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L86-L188
[ "def _mine_function_available(func):\n if func not in __salt__:\n log.error('Function %s in mine_functions not available', func)\n return False\n return True\n", "def _mine_send(load, opts):\n eventer = salt.utils.event.MinionEvent(opts, listen=False)\n event_ret = eventer.fire_event(loa...
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
send
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L191-L242
[ "def format_call(fun,\n data,\n initial_ret=None,\n expected_extra_kws=(),\n is_class_method=None):\n '''\n Build the required arguments and keyword arguments required for the passed\n function.\n\n :param fun: The function to get the argspec f...
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
get
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L245-L339
[ "def _mine_get(load, opts):\n if opts.get('transport', '') in ('zeromq', 'tcp'):\n try:\n load['tok'] = _auth().gen_token(b'salt')\n except AttributeError:\n log.error('Mine could not authenticate with master. '\n 'Mine could not be retrieved.'\n ...
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
delete
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...
Remove specific function contents of minion. Returns True on success. CLI Example: .. code-block:: bash salt '*' mine.delete 'network.interfaces'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L342-L362
[ "def _mine_send(load, opts):\n eventer = salt.utils.event.MinionEvent(opts, listen=False)\n event_ret = eventer.fire_event(load, '_minion_mine')\n # We need to pause here to allow for the decoupled nature of\n # events time to allow the mine to propagate\n time.sleep(0.5)\n return event_ret\n" ]
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
get_docker
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...
.. 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 `...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L384-L489
[ "def get(tgt,\n fun,\n tgt_type='glob',\n exclude_minion=False):\n '''\n Get data from the mine based on the target, function and tgt_type\n\n Targets can be matched based on any standard matching system that can be\n matched on the master via these keywords:\n\n - glob\n - pc...
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/modules/mine.py
valid
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...
List valid entries in mine configuration. CLI Example: .. code-block:: bash salt '*' mine.valid
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mine.py#L492-L528
[ "def _mine_function_available(func):\n if func not in __salt__:\n log.error('Function %s in mine_functions not available', func)\n return False\n return True\n" ]
# -*- coding: utf-8 -*- ''' The function cache system allows for data to be stored on the master so it can be easily read by other minions ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import copy import logging import time import traceback # Import salt libs import...
saltstack/salt
salt/returners/pgjsonb.py
returner
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))''' ...
Return data to a Pg server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L288-L305
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
event_return
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', '')...
Return event to Pg server Requires that configuration be enabled via 'event_return' option in master config.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L308-L322
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
save_load
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: #...
Save the load to the specified jid id
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L325-L337
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
get_load
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 {}
Return the load data that marks a specified jid
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L347-L358
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
get_jid
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() ...
Return the information returned when the specified job id was executed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L361-L376
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
get_fun
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...
Return a dict of the last function called for all minions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L379-L400
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
_purge_jobs
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)' ...
Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L444-L481
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
_archive_jobs
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: ...
Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L484-L542
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/returners/pgjsonb.py
clean_old_jobs
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: ...
Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pgjsonb.py#L545-L564
null
# -*- coding: utf-8 -*- ''' Return data to a PostgreSQL server with json data stored in Pg's jsonb data type :maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>, C. R. Oldham <cr@saltstack.com> :maturity: Stable :depends: python-psycopg2 :platform: all .. note:: The...
saltstack/salt
salt/modules/win_status.py
cpustats
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...
Return information about the CPU. Returns dict: A dictionary containing information about the CPU stats CLI Example: .. code-block:: bash salt * status.cpustats
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L167-L202
null
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
meminfo
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L205-L242
[ "def get_unit_value(memory):\n symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')\n prefix = {}\n for i, s in enumerate(symbols):\n prefix[s] = 1 << (i + 1) * 10\n for s in reversed(symbols):\n if memory >= prefix[s]:\n value = float(memory) / prefix[s]\n return {'uni...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
vmstats
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 = ...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L245-L272
null
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
diskusage
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...
.. 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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L322-L355
[ "def _byte_calc(val):\n if val < 1024:\n tstr = six.text_type(val)+'B'\n elif val < 1038336:\n tstr = six.text_type(val/1024)+'KB'\n elif val < 1073741824:\n tstr = six.text_type(val/1038336)+'MB'\n elif val < 1099511627776:\n tstr = six.text_type(val/1073741824)+'GB'\n el...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
procs
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L358-L387
[ "def _get_process_info(proc):\n '''\n Return process information\n '''\n cmd = salt.utils.stringutils.to_unicode(proc.CommandLine or '')\n name = salt.utils.stringutils.to_unicode(proc.Name)\n info = dict(\n cmd=cmd,\n name=name,\n **_get_process_owner(proc)\n )\n retur...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
saltmem
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...
.. 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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L390-L416
[ "def _byte_calc(val):\n if val < 1024:\n tstr = six.text_type(val)+'B'\n elif val < 1038336:\n tstr = six.text_type(val/1024)+'KB'\n elif val < 1073741824:\n tstr = six.text_type(val/1038336)+'MB'\n elif val < 1099511627776:\n tstr = six.text_type(val/1073741824)+'GB'\n el...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
uptime
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:: ...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L419-L453
null
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
_get_process_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
Return process information
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L456-L467
[ "def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/win_status.py
master
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 ...
.. 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 '*' ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_status.py#L506-L589
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
# -*- coding: utf-8 -*- ''' Module for returning various status data about a minion. These data can be useful for compiling into stats later, or for problem solving if your minion is having problems. .. versionadded:: 0.12.0 :depends: - wmi ''' # Import Python Libs from __future__ import absolute_import, unicode_li...
saltstack/salt
salt/modules/poudriere.py
_check_config_exists
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
Verify the config file is present
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L43-L51
[ "def _config_file():\n '''\n Return the config file location to use\n '''\n return __salt__['config.option']('poudriere.config')\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
is_jail
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
Return True if jail exists False if not CLI Example: .. code-block:: bash salt '*' poudriere.is_jail <jail name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L54-L68
[ "def list_jails():\n '''\n Return a list of current jails managed by poudriere\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' poudriere.list_jails\n '''\n _check_config_exists()\n cmd = 'poudriere jails -l'\n res = __salt__['cmd.run'](cmd)\n return res.splitlines()\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
make_pkgng_aware
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) ...
Make jail ``jname`` pkgng aware CLI Example: .. code-block:: bash salt '*' poudriere.make_pkgng_aware <jail name>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L71-L103
[ "def _config_dir():\n '''\n Return the configuration directory to use\n '''\n return __salt__['config.option']('poudriere.config_dir')\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
parse_config
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): ...
Returns a dict of poudriere main configuration definitions CLI Example: .. code-block:: bash salt '*' poudriere.parse_config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L106-L126
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
create_jail
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L175-L204
[ "def _check_config_exists(config_file=None):\n '''\n Verify the config file is present\n '''\n if config_file is None:\n config_file = _config_file()\n if not os.path.isfile(config_file):\n return False\n return True\n", "def is_jail(name):\n '''\n Return True if jail exists ...
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
update_jail
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...
Run freebsd-update on `name` poudriere jail CLI Example: .. code-block:: bash salt '*' poudriere.update_jail freebsd:10:x86:64
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L207-L222
[ "def is_jail(name):\n '''\n Return True if jail exists False if not\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' poudriere.is_jail <jail name>\n '''\n jails = list_jails()\n for jail in jails:\n if jail.split()[0] == name:\n return True\n return False\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
delete_jail
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 ...
Deletes poudriere jail with `name` CLI Example: .. code-block:: bash salt '*' poudriere.delete_jail 90amd64
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L225-L257
[ "def is_jail(name):\n '''\n Return True if jail exists False if not\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' poudriere.is_jail <jail name>\n '''\n jails = list_jails()\n for jail in jails:\n if jail.split()[0] == name:\n return True\n return False\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
update_ports_tree
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...
Updates the ports tree, either the default or the `ports_tree` specified CLI Example: .. code-block:: bash salt '*' poudriere.update_ports_tree staging
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L270-L286
[ "def _check_config_exists(config_file=None):\n '''\n Verify the config file is present\n '''\n if config_file is None:\n config_file = _config_file()\n if not os.path.isfile(config_file):\n return False\n return True\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/poudriere.py
bulk_build
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/poudriere.py#L289-L321
[ "def is_jail(name):\n '''\n Return True if jail exists False if not\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' poudriere.is_jail <jail name>\n '''\n jails = list_jails()\n for jail in jails:\n if jail.split()[0] == name:\n return True\n return False\n" ]
# -*- coding: utf-8 -*- ''' Support for poudriere ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import logging # Import salt libs import salt.utils.files import salt.utils.path import salt.utils.stringutils log = logging.getLogger(__name__) def __virtua...
saltstack/salt
salt/modules/opkg.py
_update_nilrt_restart_state
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L63-L106
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_get_restartcheck_result
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...
Return restartcheck result and append errors (if any) to ``errors``
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L109-L116
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_process_restartcheck_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: ...
Check restartcheck output to see if system/service restarts were requested and take appropriate action.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L119-L137
[ "def _update_nilrt_restart_state():\n '''\n NILRT systems determine whether to reboot after various package operations\n including but not limited to kernel module installs/removals by checking\n specific file md5sums & timestamps. These files are touched/modified by\n the post-install/post-remove fu...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
refresh_db
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: - `...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L231-L294
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_build_install_command_list
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L312-L333
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_parse_reported_packages_from_install_output
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L336-L356
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_execute_install_command
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L359-L377
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
install
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L380-L587
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_parse_reported_packages_from_remove_output
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...
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>...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L590-L605
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
remove
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``...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L608-L690
[ "def list_pkgs(versions_as_list=False, **kwargs):\n '''\n List the packages currently installed in a dict::\n\n {'<package_name>': '<version>'}\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.list_pkgs\n salt '*' pkg.list_pkgs versions_as_list=True\n '''\n versions_...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
upgrade
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L722-L773
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
hold
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 ...
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: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L776-L844
[ "def _get_state(pkg):\n '''\n View package state from the opkg database\n\n Return the state of pkg\n '''\n cmd = ['opkg', 'status']\n cmd.append(pkg)\n out = __salt__['cmd.run'](cmd, python_shell=False)\n state_flag = ''\n for line in salt.utils.itertools.split(out, '\\n'):\n if l...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_get_state
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...
View package state from the opkg database Return the state of pkg
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L919-L933
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_set_state
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L936-L968
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
list_upgrades
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...
List all available package upgrades. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1018-L1051
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_convert_to_standard_attr
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...
Helper function for _process_info_installed_output() Converts an opkg attribute name to a standard attribute name which is used across 'pkg' modules.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1054-L1065
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_process_info_installed_output
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 ...
Helper function for info_installed() Processes stdout output from a single invocation of 'opkg status'.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1068-L1109
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
info_installed
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1112-L1182
[ "def _process_info_installed_output(out, filter_attrs):\n '''\n Helper function for info_installed()\n\n Processes stdout output from a single invocation of\n 'opkg status'.\n '''\n ret = {}\n name = None\n attrs = {}\n attr = None\n\n for line in salt.utils.itertools.split(out, '\\n')...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
version_cmp
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1198-L1244
[ "normalize = lambda x: six.text_type(x).split(':', 1)[-1] if ignore_epoch else six.text_type(x)\n" ]
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_set_repo_option
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]
Set the option to repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1247-L1259
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_set_repo_options
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)
Set the options to the repo.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1262-L1271
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_create_repo
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'...
Create repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1274-L1291
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_read_repos
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...
Read repos from configuration file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1294-L1306
[ "def to_unicode(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str or unicode, return unicode (str for python 3)\n '''\n def _normalize(s):\n return unicodedata.normalize('NFC', s) if normalize else s\n\n if encoding is None:\n # Try utf-8 first, and fall back to det...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
list_repos
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...
Lists all repos on ``/etc/opkg/*.conf`` CLI Example: .. code-block:: bash salt '*' pkg.list_repos
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1309-L1326
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
get_repo
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...
Display a repo from the ``/etc/opkg/*.conf`` CLI Examples: .. code-block:: bash salt '*' pkg.get_repo repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1329-L1346
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def list_repos(**kwargs): # pylint: disable=unused-argument\n '''\n Lists all repos on ``/etc/opkg/*.conf``\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.list_repos\n '''\n repos = {}\n regex = re.compile(REPO_R...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_del_repo_from_file
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...
Remove a repo from filepath
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1349-L1365
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_set_trusted_option_if_needed
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
Set trusted option to repo if needed
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1368-L1376
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_add_new_repo
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...
Add a new repo entry
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1379-L1395
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
_mod_repo_in_file
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)...
Replace a repo entry in filepath with repostr
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1398-L1413
null
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
del_repo
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 =...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1416-L1459
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
mod_repo
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1462-L1533
[ "def refresh_db(failhard=False, **kwargs): # pylint: disable=unused-argument\n '''\n Updates the opkg database to latest packages based upon repositories\n\n Returns a dict, with the keys being package databases and the values being\n the result of the update attempt. Values can be one of the following...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
file_list
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 '*' ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1536-L1554
[ "def file_dict(*packages, **kwargs): # pylint: disable=unused-argument\n '''\n List the files that belong to a package, grouped by package. Not\n specifying any packages will return a list of _every_ file on the system's\n package database (not generally recommended).\n\n CLI Examples:\n\n .. cod...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...
saltstack/salt
salt/modules/opkg.py
file_dict
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opkg.py#L1557-L1596
[ "def list_pkgs(versions_as_list=False, **kwargs):\n '''\n List the packages currently installed in a dict::\n\n {'<package_name>': '<version>'}\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.list_pkgs\n salt '*' pkg.list_pkgs versions_as_list=True\n '''\n versions_...
# -*- coding: utf-8 -*- ''' Support for Opkg .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. .. versionadded:...