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/modules/win_service.py
modify
python
def modify(name, bin_path=None, exe_args=None, display_name=None, description=None, service_type=None, start_type=None, start_delayed=None, error_control=None, load_order_group=None, dependencies=None, ...
Modify a service's parameters. Changes will not be made for parameters that are not passed. .. versionadded:: 2016.11.0 Args: name (str): The name of the service. Can be found using the ``service.get_service_name`` function bin_path (str): The path to t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L862-L1100
[ "def _cmd_quote(cmd):\n r'''\n Helper function to properly format the path to the binary for the service\n Must be wrapped in double quotes to account for paths that have spaces. For\n example:\n\n ``\"C:\\Program Files\\Path\\to\\bin.exe\"``\n\n Args:\n cmd (str): Full path to the binary\n...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
enable
python
def enable(name, start_type='auto', start_delayed=False, **kwargs): ''' Enable the named service to start at boot Args: name (str): The name of the service to enable. start_type (str): Specifies the service start type. Valid options are as follows: - boot: Device d...
Enable the named service to start at boot Args: name (str): The name of the service to enable. start_type (str): Specifies the service start type. Valid options are as follows: - boot: Device driver that is loaded by the boot loader - system: Device driver that...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1103-L1139
[ "def info(name):\n '''\n Get information about a service on the system\n\n Args:\n name (str): The name of the service. This is not the display name. Use\n ``get_service_name`` to find the service name.\n\n Returns:\n dict: A dictionary containing information about the service.\...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
create
python
def create(name, bin_path, exe_args=None, display_name=None, description=None, service_type='own', start_type='manual', start_delayed=False, error_control='normal', load_order_group=None, dependencies=None, ...
Create the named service. .. versionadded:: 2015.8.0 Args: name (str): Specifies the service name. This is not the display_name bin_path (str): Specifies the path to the service binary file. Backslashes must be escaped, eg: ``C:\\path\\to\\binary.exe`` ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1200-L1391
[ "def info(name):\n '''\n Get information about a service on the system\n\n Args:\n name (str): The name of the service. This is not the display name. Use\n ``get_service_name`` to find the service name.\n\n Returns:\n dict: A dictionary containing information about the service.\...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/modules/win_service.py
delete
python
def delete(name, timeout=90): ''' Delete the named service Args: name (str): The name of the service to delete timeout (int): The time in seconds to wait for the service to be deleted before returning. This is necessary because a service must be stopped ...
Delete the named service Args: name (str): The name of the service to delete timeout (int): The time in seconds to wait for the service to be deleted before returning. This is necessary because a service must be stopped before it can be deleted. Default is 90 s...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_service.py#L1394-L1447
[ "def get_all():\n '''\n Return all installed services\n\n Returns:\n list: Returns a list of all services on the system.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.get_all\n '''\n services = _get_services()\n\n ret = set()\n for service in services:\n ...
# -*- coding: utf-8 -*- ''' Windows Service module. .. versionchanged:: 2016.11.0 - Rewritten to use PyWin32 ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import fnmatch import logging import re import time # Import Salt libs import salt.utils.platform from salt.ex...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_conn
python
def get_conn(): ''' Return a conn object for the passed VM data ''' driver = get_driver(Provider.CLOUDSTACK) verify_ssl_cert = config.get_cloud_config_value('verify_ssl_cert', get_configured_provider(), __opts__, default=True, search_global=False) ...
Return a conn object for the passed VM data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L112-L156
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_location
python
def get_location(conn, vm_): ''' Return the node location to use ''' locations = conn.list_locations() # Default to Dallas if not otherwise set loc = config.get_cloud_config_value('location', vm_, __opts__, default=2) for location in locations: if six.text_type(loc) in (six.text_type...
Return the node location to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L159-L168
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_security_groups
python
def get_security_groups(conn, vm_): ''' Return a list of security groups to use, defaulting to ['default'] ''' securitygroup_enabled = config.get_cloud_config_value( 'securitygroup_enabled', vm_, __opts__, default=True ) if securitygroup_enabled: return config.get_cloud_config_va...
Return a list of security groups to use, defaulting to ['default']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L171-L183
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_keypair
python
def get_keypair(vm_): ''' Return the keypair to use ''' keypair = config.get_cloud_config_value('keypair', vm_, __opts__) if keypair: return keypair else: return False
Return the keypair to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L206-L215
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_ip
python
def get_ip(data): ''' Return the IP address of the VM If the VM has public IP as defined by libcloud module then use it Otherwise try to extract the private IP and use that one. ''' try: ip = data.public_ips[0] except Exception: ip = data.private_ips[0] return ip
Return the IP address of the VM If the VM has public IP as defined by libcloud module then use it Otherwise try to extract the private IP and use that one.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L218-L228
null
# -*- coding: utf-8 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_networkid
python
def get_networkid(vm_): ''' Return the networkid to use, only valid for Advanced Zone ''' networkid = config.get_cloud_config_value('networkid', vm_, __opts__) if networkid is not None: return networkid else: return False
Return the networkid to use, only valid for Advanced Zone
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L231-L240
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
get_project
python
def get_project(conn, vm_): ''' Return the project to use. ''' try: projects = conn.ex_list_projects() except AttributeError: # with versions <0.15 of libcloud this is causing an AttributeError. log.warning('Cannot get projects, you may need to update libcloud to 0.15 or late...
Return the project to use.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L243-L263
[ "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 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
create
python
def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured(__opts__, __active_provider_name__ or 'clo...
Create a single VM from a data dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L266-L431
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "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 ...
# -*- coding: utf-8 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/cloud/clouds/cloudstack.py
destroy
python
def destroy(name, conn=None, call=None): ''' Delete a single VM, and all of its volumes ''' if call == 'function': raise SaltCloudSystemExit( 'The destroy action must be called with -d, --destroy, ' '-a or --action.' ) __utils__['cloud.fire_event']( '...
Delete a single VM, and all of its volumes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/cloudstack.py#L434-L525
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n driver = get_driver(Provider.CLOUDSTACK)\n\n verify_ssl_cert = config.get_cloud_config_value('verify_ssl_cert',\n get_configured_provider(),\n __opts__,\n default=True,\n search_gl...
# -*- coding: utf-8 -*- ''' CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-c...
saltstack/salt
salt/modules/sysrc.py
get
python
def get(**kwargs): ''' Return system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.get includeDefaults=True ''' cmd = 'sysrc -v' if 'file' in kwargs: cmd += ' -f '+kwargs['file'] if 'jail' in kwargs: cmd += ' -j '+kwargs['jail...
Return system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.get includeDefaults=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L30-L74
null
# -*- coding: utf-8 -*- ''' sysrc module for FreeBSD ''' # Import Python libs from __future__ import absolute_import # Import Salt libs import salt.utils.path from salt.exceptions import CommandExecutionError __virtualname__ = 'sysrc' __func_alias__ = { 'set_': 'set' } def __virtual__(): ''' Only run...
saltstack/salt
salt/modules/sysrc.py
set_
python
def set_(name, value, **kwargs): ''' Set system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.set name=sshd_flags value="-p 2222" ''' cmd = 'sysrc -v' if 'file' in kwargs: cmd += ' -f '+kwargs['file'] if 'jail' in kwargs: cmd ...
Set system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.set name=sshd_flags value="-p 2222"
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L77-L123
null
# -*- coding: utf-8 -*- ''' sysrc module for FreeBSD ''' # Import Python libs from __future__ import absolute_import # Import Salt libs import salt.utils.path from salt.exceptions import CommandExecutionError __virtualname__ = 'sysrc' __func_alias__ = { 'set_': 'set' } def __virtual__(): ''' Only run...
saltstack/salt
salt/modules/sysrc.py
remove
python
def remove(name, **kwargs): ''' Remove system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.remove name=sshd_enable ''' cmd = 'sysrc -v' if 'file' in kwargs: cmd += ' -f '+kwargs['file'] if 'jail' in kwargs: cmd += ' -j '+kwar...
Remove system rc configuration variables CLI Example: .. code-block:: bash salt '*' sysrc.remove name=sshd_enable
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysrc.py#L126-L151
null
# -*- coding: utf-8 -*- ''' sysrc module for FreeBSD ''' # Import Python libs from __future__ import absolute_import # Import Salt libs import salt.utils.path from salt.exceptions import CommandExecutionError __virtualname__ = 'sysrc' __func_alias__ = { 'set_': 'set' } def __virtual__(): ''' Only run...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
create
python
def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured( __opts__, __active_provider_name__ or 'dimensiondata', ...
Create a single VM from a data dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L193-L346
[ "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 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
create_lb
python
def create_lb(kwargs=None, call=None): r''' Create a load-balancer configuration. CLI Example: .. code-block:: bash salt-cloud -f create_lb dimensiondata \ name=dev-lb port=80 protocol=http \ members=w1,w2,w3 algorithm=ROUND_ROBIN ''' conn = get_conn() if ca...
r''' Create a load-balancer configuration. CLI Example: .. code-block:: bash salt-cloud -f create_lb dimensiondata \ name=dev-lb port=80 protocol=http \ members=w1,w2,w3 algorithm=ROUND_ROBIN
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L349-L441
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n vm_ = get_configured_provider()\n driver = get_driver(Provider.DIMENSIONDATA)\n\n region = config.get_cloud_config_value(\n 'region', vm_, __opts__\n )\n\n user_id = config.get_cloud_config_value(\n '...
# -*- coding: utf-8 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
stop
python
def stop(name, call=None): ''' Stop a VM in DimensionData. name: The name of the VM to stop. CLI Example: .. code-block:: bash salt-cloud -a stop vm_name ''' conn = get_conn() node = get_node(conn, name) # pylint: disable=not-callable log.debug('Node of Cloud VM:...
Stop a VM in DimensionData. name: The name of the VM to stop. CLI Example: .. code-block:: bash salt-cloud -a stop vm_name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L483-L503
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n vm_ = get_configured_provider()\n driver = get_driver(Provider.DIMENSIONDATA)\n\n region = config.get_cloud_config_value(\n 'region', vm_, __opts__\n )\n\n user_id = config.get_cloud_config_value(\n '...
# -*- coding: utf-8 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
start
python
def start(name, call=None): ''' Stop a VM in DimensionData. :param str name: The name of the VM to stop. CLI Example: .. code-block:: bash salt-cloud -a stop vm_name ''' conn = get_conn() node = get_node(conn, name) # pylint: disable=not-callable log.debug('Node...
Stop a VM in DimensionData. :param str name: The name of the VM to stop. CLI Example: .. code-block:: bash salt-cloud -a stop vm_name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L506-L527
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n vm_ = get_configured_provider()\n driver = get_driver(Provider.DIMENSIONDATA)\n\n region = config.get_cloud_config_value(\n 'region', vm_, __opts__\n )\n\n user_id = config.get_cloud_config_value(\n '...
# -*- coding: utf-8 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
get_conn
python
def get_conn(): ''' Return a conn object for the passed VM data ''' vm_ = get_configured_provider() driver = get_driver(Provider.DIMENSIONDATA) region = config.get_cloud_config_value( 'region', vm_, __opts__ ) user_id = config.get_cloud_config_value( 'user_id', vm_, __...
Return a conn object for the passed VM data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L530-L555
[ "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 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
get_lb_conn
python
def get_lb_conn(dd_driver=None): ''' Return a load-balancer conn object ''' vm_ = get_configured_provider() region = config.get_cloud_config_value( 'region', vm_, __opts__ ) user_id = config.get_cloud_config_value( 'user_id', vm_, __opts__ ) key = config.get_cloud_co...
Return a load-balancer conn object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L558-L578
[ "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 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/cloud/clouds/dimensiondata.py
_to_event_data
python
def _to_event_data(obj): ''' Convert the specified object into a form that can be serialised by msgpack as event data. :param obj: The object to convert. ''' if obj is None: return None if isinstance(obj, bool): return obj if isinstance(obj, int): return obj if ...
Convert the specified object into a form that can be serialised by msgpack as event data. :param obj: The object to convert.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L581-L621
[ "def _to_event_data(obj):\n '''\n Convert the specified object into a form that can be serialised by msgpack as event data.\n\n :param obj: The object to convert.\n '''\n\n if obj is None:\n return None\n if isinstance(obj, bool):\n return obj\n if isinstance(obj, int):\n r...
# -*- coding: utf-8 -*- ''' Dimension Data Cloud Module =========================== This is a cloud module for the Dimension Data Cloud, using the existing Libcloud driver for Dimension Data. .. code-block:: yaml # Note: This example is for /etc/salt/cloud.providers # or any file in the # /etc/salt/cloud...
saltstack/salt
salt/proxy/dummy.py
package_install
python
def package_install(name, **kwargs): ''' Install a "package" on the REST server ''' DETAILS = _load_state() if kwargs.get('version', False): version = kwargs['version'] else: version = '1.0' DETAILS['packages'][name] = version _save_state(DETAILS) return {name: versio...
Install a "package" on the REST server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L164-L175
[ "def _save_state(details):\n with salt.utils.files.fopen(FILENAME, 'wb') as pck:\n pickle.dump(details, pck)\n", "def _load_state():\n try:\n if six.PY3 is True:\n mode = 'rb'\n else:\n mode = 'r'\n\n with salt.utils.files.fopen(FILENAME, mode) as pck:\n ...
# -*- coding: utf-8 -*- ''' This is the a dummy proxy-minion designed for testing the proxy minion subsystem. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import pickle import logging # Import Salt libs import salt.ext.six as six import salt.utils.files ...
saltstack/salt
salt/proxy/dummy.py
upgrade
python
def upgrade(): ''' "Upgrade" packages ''' DETAILS = _load_state() pkgs = uptodate() DETAILS['packages'] = pkgs _save_state(DETAILS) return pkgs
"Upgrade" packages
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L178-L186
[ "def _save_state(details):\n with salt.utils.files.fopen(FILENAME, 'wb') as pck:\n pickle.dump(details, pck)\n", "def _load_state():\n try:\n if six.PY3 is True:\n mode = 'rb'\n else:\n mode = 'r'\n\n with salt.utils.files.fopen(FILENAME, mode) as pck:\n ...
# -*- coding: utf-8 -*- ''' This is the a dummy proxy-minion designed for testing the proxy minion subsystem. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import pickle import logging # Import Salt libs import salt.ext.six as six import salt.utils.files ...
saltstack/salt
salt/proxy/dummy.py
uptodate
python
def uptodate(): ''' Call the REST endpoint to see if the packages on the "server" are up to date. ''' DETAILS = _load_state() for p in DETAILS['packages']: version_float = float(DETAILS['packages'][p]) version_float = version_float + 1.0 DETAILS['packages'][p] = six.text_type...
Call the REST endpoint to see if the packages on the "server" are up to date.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L189-L198
[ "def _load_state():\n try:\n if six.PY3 is True:\n mode = 'rb'\n else:\n mode = 'r'\n\n with salt.utils.files.fopen(FILENAME, mode) as pck:\n DETAILS = pickle.load(pck)\n except EOFError:\n DETAILS = {}\n DETAILS['initialized'] = False\n ...
# -*- coding: utf-8 -*- ''' This is the a dummy proxy-minion designed for testing the proxy minion subsystem. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import pickle import logging # Import Salt libs import salt.ext.six as six import salt.utils.files ...
saltstack/salt
salt/proxy/dummy.py
package_remove
python
def package_remove(name): ''' Remove a "package" on the REST server ''' DETAILS = _load_state() DETAILS['packages'].pop(name) _save_state(DETAILS) return DETAILS['packages']
Remove a "package" on the REST server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L201-L208
[ "def _save_state(details):\n with salt.utils.files.fopen(FILENAME, 'wb') as pck:\n pickle.dump(details, pck)\n", "def _load_state():\n try:\n if six.PY3 is True:\n mode = 'rb'\n else:\n mode = 'r'\n\n with salt.utils.files.fopen(FILENAME, mode) as pck:\n ...
# -*- coding: utf-8 -*- ''' This is the a dummy proxy-minion designed for testing the proxy minion subsystem. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import pickle import logging # Import Salt libs import salt.ext.six as six import salt.utils.files ...
saltstack/salt
salt/proxy/dummy.py
shutdown
python
def shutdown(opts): ''' For this proxy shutdown is a no-op ''' log.debug('dummy proxy shutdown() called...') DETAILS = _load_state() if 'filename' in DETAILS: os.unlink(DETAILS['filename'])
For this proxy shutdown is a no-op
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/dummy.py#L228-L235
[ "def _load_state():\n try:\n if six.PY3 is True:\n mode = 'rb'\n else:\n mode = 'r'\n\n with salt.utils.files.fopen(FILENAME, mode) as pck:\n DETAILS = pickle.load(pck)\n except EOFError:\n DETAILS = {}\n DETAILS['initialized'] = False\n ...
# -*- coding: utf-8 -*- ''' This is the a dummy proxy-minion designed for testing the proxy minion subsystem. ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import pickle import logging # Import Salt libs import salt.ext.six as six import salt.utils.files ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector.open
python
def open(self): ''' Opens archive. :return: ''' if self.__arch is not None: raise salt.exceptions.SaltException('Archive already opened.') self.__arch = tarfile.TarFile.bz2open(self.archive_path, 'w')
Opens archive. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L63-L70
null
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector.close
python
def close(self): ''' Closes the archive. :return: ''' if self.__arch is None: raise salt.exceptions.SaltException('Archive already closed') self._flush_content() self.__arch.close() self.__arch = None
Closes the archive. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L72-L81
[ "def _flush_content(self):\n '''\n Flush content to the archive\n :return:\n '''\n if self.__current_section is not None:\n buff = BytesIO()\n buff._dirty = False\n for action_return in self.__current_section:\n for title, ret_data in action_return.items():\n ...
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector._flush_content
python
def _flush_content(self): ''' Flush content to the archive :return: ''' if self.__current_section is not None: buff = BytesIO() buff._dirty = False for action_return in self.__current_section: for title, ret_data in action_retur...
Flush content to the archive :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L83-L108
null
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector.add
python
def add(self, name): ''' Start a new section. :param name: :return: ''' if self.__current_section: self._flush_content() self.discard_current(name)
Start a new section. :param name: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L110-L118
[ "def _flush_content(self):\n '''\n Flush content to the archive\n :return:\n '''\n if self.__current_section is not None:\n buff = BytesIO()\n buff._dirty = False\n for action_return in self.__current_section:\n for title, ret_data in action_return.items():\n ...
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector._printout
python
def _printout(self, data, output): ''' Use salt outputter to printout content. :return: ''' opts = {'extension_modules': '', 'color': False} try: printout = salt.output.get_printout(output, opts)(data) if printout is not None: retu...
Use salt outputter to printout content. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L128-L151
null
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector.write
python
def write(self, title, data, output=None): ''' Add a data to the current opened section. :return: ''' if not isinstance(data, (dict, list, tuple)): data = {'raw-content': str(data)} output = output or self.__default_outputter if output != 'null': ...
Add a data to the current opened section. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L153-L178
null
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SupportDataCollector.link
python
def link(self, title, path): ''' Add a static file on the file system. :param title: :param path: :return: ''' # The filehandler needs to be explicitly passed here, so PyLint needs to accept that. # pylint: disable=W8470 if not isinstance(path, fi...
Add a static file on the file system. :param title: :param path: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L180-L192
[ "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 ...
class SupportDataCollector(object): ''' Data collector. It behaves just like another outputter, except it grabs the data to the archive files. ''' def __init__(self, name, output): ''' constructor of the data collector :param name: :param path: :param format: ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._setup_fun_config
python
def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' conf = copy.deepcopy(self.config) conf['file_client'] = 'local' conf['fun'] = '' conf['arg'] = [] conf['kwarg'] = {} conf['cache_job...
Setup function configuration. :param conf: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L203-L220
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _get_runner(self, conf): ''' Get & setup runner. :param conf: :return: ''' conf = self._setup_...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._get_runner
python
def _get_runner(self, conf): ''' Get & setup runner. :param conf: :return: ''' conf = self._setup_fun_config(copy.deepcopy(conf)) if not getattr(self, '_runner', None): self._runner = salt.cli.support.localrunner.LocalRunner(conf) else: ...
Get & setup runner. :param conf: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L222-L234
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._get_caller
python
def _get_caller(self, conf): ''' Get & setup caller from the factory. :param conf: :return: ''' conf = self._setup_fun_config(copy.deepcopy(conf)) if not getattr(self, '_caller', None): self._caller = salt.cli.caller.Caller.factory(conf) else:...
Get & setup caller from the factory. :param conf: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L236-L248
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._local_call
python
def _local_call(self, call_conf): ''' Execute local call ''' try: ret = self._get_caller(call_conf).call() except SystemExit: ret = 'Data is not available at this moment' self.out.error(ret) except Exception as ex: ret = 'Un...
Execute local call
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L250-L264
[ "def _get_caller(self, conf):\n '''\n Get & setup caller from the factory.\n\n :param conf:\n :return:\n '''\n conf = self._setup_fun_config(copy.deepcopy(conf))\n if not getattr(self, '_caller', None):\n self._caller = salt.cli.caller.Caller.factory(conf)\n else:\n self._calle...
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._local_run
python
def _local_run(self, run_conf): ''' Execute local runner :param run_conf: :return: ''' try: ret = self._get_runner(run_conf).run() except SystemExit: ret = 'Runner is not available at this moment' self.out.error(ret) ex...
Execute local runner :param run_conf: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L266-L282
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._internal_function_call
python
def _internal_function_call(self, call_conf): ''' Call internal function. :param call_conf: :return: ''' def stub(*args, **kwargs): message = 'Function {} is not available'.format(call_conf['fun']) self.out.error(message) log.debug( ...
Call internal function. :param call_conf: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L284-L303
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._get_action
python
def _get_action(self, action_meta): ''' Parse action and turn into a calling point. :param action_meta: :return: ''' conf = { 'fun': list(action_meta.keys())[0], 'arg': [], 'kwargs': {}, } if not len(conf['fun'].split('....
Parse action and turn into a calling point. :param action_meta: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L305-L327
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport.collect_internal_data
python
def collect_internal_data(self): ''' Dumps current running pillars, configuration etc. :return: ''' section = 'configuration' self.out.put(section) self.collector.add(section) self.out.put('Saving config', indent=2) self.collector.write('General Co...
Dumps current running pillars, configuration etc. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L329-L346
[ "def _local_call(self, call_conf):\n '''\n Execute local call\n '''\n try:\n ret = self._get_caller(call_conf).call()\n except SystemExit:\n ret = 'Data is not available at this moment'\n self.out.error(ret)\n except Exception as ex:\n ret = 'Unhandled exception occurre...
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._extract_return
python
def _extract_return(self, data): ''' Extracts return data from the results. :param data: :return: ''' if isinstance(data, dict): data = data.get('return', data) return data
Extracts return data from the results. :param data: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L348-L358
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport.collect_local_data
python
def collect_local_data(self, profile=None, profile_source=None): ''' Collects master system data. :return: ''' def call(func, *args, **kwargs): ''' Call wrapper for templates :param func: :return: ''' return ...
Collects master system data. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L360-L407
[ "def get_profile(profile, caller, runner):\n '''\n Get profile.\n\n :param profile:\n :return:\n '''\n profiles = profile.split(',')\n data = {}\n for profile in profiles:\n if os.path.basename(profile) == profile:\n profile = profile.split('.')[0] # Trim extension if some...
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._get_action_type
python
def _get_action_type(self, action): ''' Get action type. :param action: :return: ''' action_name = next(iter(action or {'': None})) if ':' not in action_name: action_name = '{}:{}'.format(self.CALL_TYPE, action_name) return action_name.split('...
Get action type. :param action: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L409-L419
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._cleanup
python
def _cleanup(self): ''' Cleanup if crash/exception :return: ''' if (hasattr(self, 'config') and self.config.get('support_archive') and os.path.exists(self.config['support_archive'])): self.out.warning('Terminated earlier, cleaning up') ...
Cleanup if crash/exception :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L421-L434
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/cli/support/collector.py
SaltSupport._check_existing_archive
python
def _check_existing_archive(self): ''' Check if archive exists or not. If exists and --force was not specified, bail out. Otherwise remove it and move on. :return: ''' if os.path.exists(self.config['support_archive']): if self.config['support_archive_force_ov...
Check if archive exists or not. If exists and --force was not specified, bail out. Otherwise remove it and move on. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L436-L458
null
class SaltSupport(salt.utils.parsers.SaltSupportOptionParser): ''' Class to run Salt Support subsystem. ''' RUNNER_TYPE = 'run' CALL_TYPE = 'call' def _setup_fun_config(self, fun_conf): ''' Setup function configuration. :param conf: :return: ''' ...
saltstack/salt
salt/spm/__init__.py
SPMClient.run
python
def run(self, args): ''' Run the SPM command ''' command = args[0] try: if command == 'install': self._install(args) elif command == 'local': self._local(args) elif command == 'repo': self._repo(a...
Run the SPM command
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L118-L149
[ "def _close(self):\n if self.db_conn:\n self.db_conn.close()\n", "def _list(self, args):\n '''\n Process local commands\n '''\n args.pop(0)\n command = args[0]\n if command == 'packages':\n self._list_packages(args)\n elif command == 'files':\n self._list_files(args)\n...
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._list
python
def _list(self, args): ''' Process local commands ''' args.pop(0) command = args[0] if command == 'packages': self._list_packages(args) elif command == 'files': self._list_files(args) elif command == 'repos': self._repo_...
Process local commands
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L163-L176
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._local
python
def _local(self, args): ''' Process local commands ''' args.pop(0) command = args[0] if command == 'install': self._local_install(args) elif command == 'files': self._local_list_files(args) elif command == 'info': self._...
Process local commands
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L178-L191
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._repo
python
def _repo(self, args): ''' Process repo commands ''' args.pop(0) command = args[0] if command == 'list': self._repo_list(args) elif command == 'packages': self._repo_packages(args) elif command == 'search': self._repo_pa...
Process repo commands
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L193-L210
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._repo_packages
python
def _repo_packages(self, args, search=False): ''' List packages for one or more configured repos ''' packages = [] repo_metadata = self._get_repo_metadata() for repo in repo_metadata: for pkg in repo_metadata[repo]['packages']: if args[1] in pk...
List packages for one or more configured repos
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L212-L228
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._repo_list
python
def _repo_list(self, args): ''' List configured repos This can be called either as a ``repo`` command or a ``list`` command ''' repo_metadata = self._get_repo_metadata() for repo in repo_metadata: self.ui.status(repo)
List configured repos This can be called either as a ``repo`` command or a ``list`` command
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L230-L238
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._install
python
def _install(self, args): ''' Install a package from a repo ''' if len(args) < 2: raise SPMInvocationError('A package must be specified') caller_opts = self.opts.copy() caller_opts['file_client'] = 'local' self.caller = salt.client.Caller(mopts=caller...
Install a package from a repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L240-L380
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._local_install
python
def _local_install(self, args, pkg_name=None): ''' Install a package from a file ''' if len(args) < 2: raise SPMInvocationError('A package file must be specified') self._install(args)
Install a package from a file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L382-L389
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._check_all_deps
python
def _check_all_deps(self, pkg_name=None, pkg_file=None, formula_def=None): ''' Starting with one package, check all packages for dependencies ''' if pkg_file and not os.path.exists(pkg_file): raise SPMInvocationError('Package file {0} not found'.format(pkg_file)) sel...
Starting with one package, check all packages for dependencies
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L391-L463
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._install_indv_pkg
python
def _install_indv_pkg(self, pkg_name, pkg_file): ''' Install one individual package ''' self.ui.status('... installing {0}'.format(pkg_name)) formula_tar = tarfile.open(pkg_file, 'r:bz2') formula_ref = formula_tar.extractfile('{0}/FORMULA'.format(pkg_name)) formul...
Install one individual package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L465-L567
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._resolve_deps
python
def _resolve_deps(self, formula_def): ''' Return a list of packages which need to be installed, to resolve all dependencies ''' pkg_info = self.pkgdb['{0}.info'.format(self.db_prov)](formula_def['name']) if not isinstance(pkg_info, dict): pkg_info = {} ...
Return a list of packages which need to be installed, to resolve all dependencies
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L569-L618
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._traverse_repos
python
def _traverse_repos(self, callback, repo_name=None): ''' Traverse through all repo files and apply the functionality provided in the callback to them ''' repo_files = [] if os.path.exists(self.opts['spm_repos_config']): repo_files.append(self.opts['spm_repos_c...
Traverse through all repo files and apply the functionality provided in the callback to them
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L620-L644
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._query_http
python
def _query_http(self, dl_path, repo_info): ''' Download files via http ''' query = None response = None try: if 'username' in repo_info: try: if 'password' in repo_info: query = http.query( ...
Download files via http
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L646-L683
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._download_repo_metadata
python
def _download_repo_metadata(self, args): ''' Connect to all repos and download metadata ''' cache = salt.cache.Cache(self.opts, self.opts['spm_cache_dir']) def _update_metadata(repo, repo_info): dl_path = '{0}/SPM-METADATA'.format(repo_info['url']) if dl_...
Connect to all repos and download metadata
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L685-L703
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._get_repo_metadata
python
def _get_repo_metadata(self): ''' Return cached repo metadata ''' cache = salt.cache.Cache(self.opts, self.opts['spm_cache_dir']) metadata = {} def _read_metadata(repo, repo_info): if cache.updated('.', repo) is None: log.warning('Updating rep...
Return cached repo metadata
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L705-L723
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._create_repo
python
def _create_repo(self, args): ''' Scan a directory and create an SPM-METADATA file which describes all of the SPM files in that directory. ''' if len(args) < 2: raise SPMInvocationError('A path to a directory must be specified') if args[1] == '.': ...
Scan a directory and create an SPM-METADATA file which describes all of the SPM files in that directory.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L725-L832
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._remove
python
def _remove(self, args): ''' Remove a package ''' if len(args) < 2: raise SPMInvocationError('A package must be specified') packages = args[1:] msg = 'Removing packages:\n\t{0}'.format('\n\t'.join(packages)) if not self.opts['assume_yes']: ...
Remove a package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L834-L884
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._verbose
python
def _verbose(self, msg, level=log.debug): ''' Display verbose information ''' if self.opts.get('verbose', False) is True: self.ui.status(msg) level(msg)
Display verbose information
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L886-L892
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._local_info
python
def _local_info(self, args): ''' List info for a package file ''' if len(args) < 2: raise SPMInvocationError('A package filename must be specified') pkg_file = args[1] if not os.path.exists(pkg_file): raise SPMInvocationError('Package file {0} no...
List info for a package file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L894-L915
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._info
python
def _info(self, args): ''' List info for a package ''' if len(args) < 2: raise SPMInvocationError('A package must be specified') package = args[1] pkg_info = self._pkgdb_fun('info', package, self.db_conn) if pkg_info is None: raise SPMPac...
List info for a package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L917-L929
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._get_info
python
def _get_info(self, formula_def): ''' Get package info ''' fields = ( 'name', 'os', 'os_family', 'release', 'version', 'dependencies', 'os_dependencies', 'os_family_dependencies', ...
Get package info
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L931-L965
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._local_list_files
python
def _local_list_files(self, args): ''' List files for a package file ''' if len(args) < 2: raise SPMInvocationError('A package filename must be specified') pkg_file = args[1] if not os.path.exists(pkg_file): raise SPMPackageError('Package file {0}...
List files for a package file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L967-L981
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._list_packages
python
def _list_packages(self, args): ''' List files for an installed package ''' packages = self._pkgdb_fun('list_packages', self.db_conn) for package in packages: if self.opts['verbose']: status_msg = ','.join(package) else: sta...
List files for an installed package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L983-L993
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._list_files
python
def _list_files(self, args): ''' List files for an installed package ''' if len(args) < 2: raise SPMInvocationError('A package name must be specified') package = args[-1] files = self._pkgdb_fun('list_files', package, self.db_conn) if files is None: ...
List files for an installed package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L995-L1013
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._build
python
def _build(self, args): ''' Build a package ''' if len(args) < 2: raise SPMInvocationError('A path to a formula must be specified') self.abspath = args[1].rstrip('/') comps = self.abspath.split('/') self.relpath = comps[-1] formula_path = '{0...
Build a package
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L1015-L1077
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._exclude
python
def _exclude(self, member): ''' Exclude based on opts ''' if isinstance(member, string_types): return None for item in self.opts['spm_build_exclude']: if member.name.startswith('{0}/{1}'.format(self.formula_conf['name'], item)): return Non...
Exclude based on opts
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L1079-L1091
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/spm/__init__.py
SPMClient._render
python
def _render(self, data, formula_def): ''' Render a [pre|post]_local_state or [pre|post]_tgt_state script ''' # FORMULA can contain a renderer option renderer = formula_def.get('renderer', self.opts.get('renderer', 'jinja|yaml')) rend = salt.loader.render(self.opts, {}) ...
Render a [pre|post]_local_state or [pre|post]_tgt_state script
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L1093-L1112
null
class SPMClient(object): ''' Provide an SPM Client ''' def __init__(self, ui, opts=None): # pylint: disable=W0231 self.ui = ui if not opts: opts = salt.config.spm_config( os.path.join(syspaths.CONFIG_DIR, 'spm') ) self.opts = opts ...
saltstack/salt
salt/modules/boto_sqs.py
_preprocess_attributes
python
def _preprocess_attributes(attributes): ''' Pre-process incoming queue attributes before setting them ''' if isinstance(attributes, six.string_types): attributes = salt.utils.json.loads(attributes) def stringified(val): # Some attributes take full json policy documents, but they tak...
Pre-process incoming queue attributes before setting them
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L88-L104
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json ...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
exists
python
def exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if a queue exists. CLI Example: .. code-block:: bash salt myminion boto_sqs.exists myqueue region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: ...
Check to see if a queue exists. CLI Example: .. code-block:: bash salt myminion boto_sqs.exists myqueue region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L107-L126
null
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
create
python
def create( name, attributes=None, region=None, key=None, keyid=None, profile=None, ): ''' Create an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.create myqueue region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, pr...
Create an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.create myqueue region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L129-L156
[ "def _preprocess_attributes(attributes):\n '''\n Pre-process incoming queue attributes before setting them\n '''\n if isinstance(attributes, six.string_types):\n attributes = salt.utils.json.loads(attributes)\n\n def stringified(val):\n # Some attributes take full json policy documents,...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
delete
python
def delete(name, region=None, key=None, keyid=None, profile=None): ''' Delete an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.delete myqueue region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: url = conn....
Delete an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.delete myqueue region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L159-L176
null
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
list_
python
def list_(prefix='', region=None, key=None, keyid=None, profile=None): ''' Return a list of the names of all visible queues. .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt myminion boto_sqs.list region=us-east-1 ''' conn = _get_conn(region=region, key=key, key...
Return a list of the names of all visible queues. .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt myminion boto_sqs.list region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L179-L203
null
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
get_attributes
python
def get_attributes(name, region=None, key=None, keyid=None, profile=None): ''' Return attributes currently set on an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.get_attributes myqueue ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Return attributes currently set on an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.get_attributes myqueue
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L206-L223
null
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/modules/boto_sqs.py
set_attributes
python
def set_attributes( name, attributes, region=None, key=None, keyid=None, profile=None, ): ''' Set attributes on an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.set_attributes myqueue '{ReceiveMessageWaitTimeSeconds: 20}' region=us-east-1 ''' ...
Set attributes on an SQS queue. CLI Example: .. code-block:: bash salt myminion boto_sqs.set_attributes myqueue '{ReceiveMessageWaitTimeSeconds: 20}' region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sqs.py#L226-L252
[ "def _preprocess_attributes(attributes):\n '''\n Pre-process incoming queue attributes before setting them\n '''\n if isinstance(attributes, six.string_types):\n attributes = salt.utils.json.loads(attributes)\n\n def stringified(val):\n # Some attributes take full json policy documents,...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SQS .. versionadded:: 2014.7.0 :configuration: This module accepts explicit sqs credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no furthe...
saltstack/salt
salt/states/netconfig.py
_update_config
python
def _update_config(template_name, template_source=None, template_hash=None, template_hash_name=None, template_user='root', template_group='root', template_mode='755', template_attrs='----...
Call the necessary functions in order to execute the state. For the moment this only calls the ``net.load_template`` function from the :mod:`Network-related basic features execution module <salt.modules.napalm_network>`, but this may change in time.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L56-L95
null
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/states/netconfig.py
replace_pattern
python
def replace_pattern(name, pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, ...
.. versionadded:: 2019.2.0 Replace occurrences of a pattern in the configuration source. If ``show_changes`` is ``True``, then a diff of what changed will be returned, otherwise a ``True`` will be returned when changes are made, and ``False`` when no changes are made. This is a pure Python implemen...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L102-L244
[ "def default_ret(name):\n '''\n Return the default dict of the state output.\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n", "def loaded_ret(ret, loaded, test, debug, compliance_report=False, opts=None):\n ''...
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/states/netconfig.py
saved
python
def saved(name, source='running', user=None, group=None, mode=None, attrs=None, makedirs=False, dir_mode=None, replace=True, backup='', show_changes=True, create=True, tmp_dir='', tmp_ext=''...
.. versionadded:: 2019.2.0 Save the configuration to a file on the local file system. name Absolute path to file where to save the configuration. To push the files to the Master, use :mod:`cp.push <salt.modules.cp.push>` Execution function. source: ``running`` The configur...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L247-L451
null
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/states/netconfig.py
managed
python
def managed(name, template_name=None, template_source=None, template_hash=None, template_hash_name=None, saltenv='base', template_engine='jinja', skip_verify=False, context=None, defaults=None, test=F...
Manages the configuration on network devices. By default this state will commit the changes on the device. If there are no changes required, it does not commit and the field ``already_configured`` from the output dictionary will be set as ``True`` to notify that. To avoid committing the configuration, set...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L454-L848
[ "def default_ret(name):\n '''\n Return the default dict of the state output.\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n", "def loaded_ret(ret, loaded, test, debug, compliance_report=False, opts=None):\n ''...
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/states/netconfig.py
commit_cancelled
python
def commit_cancelled(name): ''' .. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_...
.. versionadded:: 2019.2.0 Cancel a commit scheduled to be executed via the ``commit_in`` and ``commit_at`` arguments from the :py:func:`net.load_template <salt.modules.napalm_network.load_template>` or :py:func:`net.load_config <salt.modules.napalm_network.load_config>` execution functions. The co...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L851-L880
null
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/states/netconfig.py
commit_confirmed
python
def commit_confirmed(name): ''' .. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>...
.. versionadded:: 2019.2.0 Confirm a commit scheduled to be reverted via the ``revert_in`` and ``revert_at`` arguments from the :mod:`net.load_template <salt.modules.napalm_network.load_template>` or :mod:`net.load_config <salt.modules.napalm_network.load_config>` execution functions. The commit ID...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netconfig.py#L883-L912
null
# -*- coding: utf-8 -*- ''' Network Config ============== Manage the configuration on a network device given a specific static config or template. :codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com> :maturity: new :depends: napalm :platform: unix Dependencies ------------ - ...
saltstack/salt
salt/serializers/python.py
serialize
python
def serialize(obj, **options): ''' Serialize Python data to a Python string representation (via pprint.format) :param obj: the data structure to serialize :param options: options given to pprint.format ''' #round-trip this through JSON to avoid OrderedDict types # there's probably a more p...
Serialize Python data to a Python string representation (via pprint.format) :param obj: the data structure to serialize :param options: options given to pprint.format
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/python.py#L25-L43
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' salt.serializers.python ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2016.3.0 Implements a Python serializer (via pprint.format) ''' from __future__ import absolute_import, unicode_literals import pprint try: import simplejson as _json except ImportError: import j...
saltstack/salt
salt/proxy/ssh_sample.py
init
python
def init(opts): ''' Required. Can be used to initialize the server connection. ''' try: DETAILS['server'] = SSHConnection(host=__opts__['proxy']['host'], username=__opts__['proxy']['username'], password=__opt...
Required. Can be used to initialize the server connection.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L38-L52
null
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
grains
python
def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): cmd = 'info' # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and return the right fields as a dict DETAILS['grain...
Get the grains from the proxied device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L64-L78
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
ping
python
def ping(): ''' Required. Ping the device on the other end of the connection ''' try: out, err = DETAILS['server'].sendline('help') return True except TerminalException as e: log.error(e) return False
Required. Ping the device on the other end of the connection
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L94-L104
null
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
parse
python
def parse(out): ''' Extract json from out. Parameter out: Type string. The data returned by the ssh command. ''' jsonret = [] in_json = False for ln_ in out.split('\n'): if '{' in ln_: in_json = True if in_json: jsonret.append(ln_) ...
Extract json from out. Parameter out: Type string. The data returned by the ssh command.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L114-L131
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
package_install
python
def package_install(name, **kwargs): ''' Install a "package" on the ssh server ''' cmd = 'pkg_install ' + name if kwargs.get('version', False): cmd += ' ' + kwargs['version'] # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and retu...
Install a "package" on the ssh server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L150-L162
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
package_remove
python
def package_remove(name): ''' Remove a "package" on the ssh server ''' cmd = 'pkg_remove ' + name # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and return the right fields as a dict return parse(out)
Remove a "package" on the ssh server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L165-L175
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
service_start
python
def service_start(name): ''' Start a "service" on the ssh server .. versionadded:: 2015.8.2 ''' cmd = 'start ' + name # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and return the right fields as a dict return parse(out)
Start a "service" on the ssh server .. versionadded:: 2015.8.2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L193-L205
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
service_stop
python
def service_stop(name): ''' Stop a "service" on the ssh server .. versionadded:: 2015.8.2 ''' cmd = 'stop ' + name # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and return the right fields as a dict return parse(out)
Stop a "service" on the ssh server .. versionadded:: 2015.8.2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L208-L220
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/proxy/ssh_sample.py
service_restart
python
def service_restart(name): ''' Restart a "service" on the ssh server .. versionadded:: 2015.8.2 ''' cmd = 'restart ' + name # Send the command to execute out, err = DETAILS['server'].sendline(cmd) # "scrape" the output and return the right fields as a dict return parse(out)
Restart a "service" on the ssh server .. versionadded:: 2015.8.2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/ssh_sample.py#L223-L235
[ "def parse(out):\n '''\n Extract json from out.\n\n Parameter\n out: Type string. The data returned by the\n ssh command.\n '''\n jsonret = []\n in_json = False\n for ln_ in out.split('\\n'):\n if '{' in ln_:\n in_json = True\n if in_json:\n jso...
# -*- coding: utf-8 -*- ''' This is a simple proxy-minion designed to connect to and communicate with a server that exposes functionality via SSH. This can be used as an option when the device does not provide an api over HTTP and doesn't have the python stack to run a minion. ''' from __future__ import...
saltstack/salt
salt/modules/jboss7_cli.py
run_command
python
def run_command(jboss_config, command, fail_on_error=True): ''' Execute a command against jboss instance through the CLI interface. jboss_config Configuration dictionary with properties specified above. command Command to execute against jboss instance fail_on_error (default=T...
Execute a command against jboss instance through the CLI interface. jboss_config Configuration dictionary with properties specified above. command Command to execute against jboss instance fail_on_error (default=True) Is true, raise CommandExecutionError exception if execut...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7_cli.py#L55-L83
[ "def __call_cli(jboss_config, command, retries=1):\n command_segments = [\n jboss_config['cli_path'],\n '--connect',\n '--controller=\"{0}\"'.format(jboss_config['controller'])\n ]\n if 'cli_user' in six.iterkeys(jboss_config):\n command_segments.append('--user=\"{0}\"'.format(j...
# -*- coding: utf-8 -*- ''' Module for low-level interaction with JbossAS7 through CLI. This module exposes two ways of interaction with the CLI, either through commands or operations. .. note:: Following JBoss documentation (https://developer.jboss.org/wiki/CommandLineInterface): "Operations are considered a low...
saltstack/salt
salt/modules/jboss7_cli.py
run_operation
python
def run_operation(jboss_config, operation, fail_on_error=True, retries=1): ''' Execute an operation against jboss instance through the CLI interface. jboss_config Configuration dictionary with properties specified above. operation An operation to execute against jboss instance ...
Execute an operation against jboss instance through the CLI interface. jboss_config Configuration dictionary with properties specified above. operation An operation to execute against jboss instance fail_on_error (default=True) Is true, raise CommandExecutionError exceptio...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jboss7_cli.py#L86-L132
[ "def _parse(cli_output):\n tokens = __tokenize(cli_output)\n result = __process_tokens(tokens)\n\n log.debug('=== RESULT: %s', pprint.pformat(result))\n return result\n", "def __call_cli(jboss_config, command, retries=1):\n command_segments = [\n jboss_config['cli_path'],\n '--connect...
# -*- coding: utf-8 -*- ''' Module for low-level interaction with JbossAS7 through CLI. This module exposes two ways of interaction with the CLI, either through commands or operations. .. note:: Following JBoss documentation (https://developer.jboss.org/wiki/CommandLineInterface): "Operations are considered a low...