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/ext/ipaddress.py
IPv6Address.is_reserved
python
def is_reserved(self): reserved_networks = [IPv6Network('::/8'), IPv6Network('100::/8'), IPv6Network('200::/7'), IPv6Network('400::/6'), IPv6Network('800::/5'), IPv6Network('1000::/4'), IPv6Network('4000::/3'), IPv6Network('6...
Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L1948-L1965
null
class IPv6Address(_BaseV6, _BaseAddress): """Represent and manipulate single IPv6 Addresses.""" def __init__(self, address): """Instantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so ...
saltstack/salt
salt/ext/ipaddress.py
IPv6Address.is_private
python
def is_private(self): return (self in IPv6Network('::1/128') or self in IPv6Network('::/128') or self in IPv6Network('::ffff:0:0/96') or self in IPv6Network('100::/64') or self in IPv6Network('2001::/23') or self in IPv6Network('200...
Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv6-special-registry.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L1994-L2011
null
class IPv6Address(_BaseV6, _BaseAddress): """Represent and manipulate single IPv6 Addresses.""" def __init__(self, address): """Instantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so ...
saltstack/salt
salt/ext/ipaddress.py
IPv6Network.hosts
python
def hosts(self): network = int(self.network_address) broadcast = int(self.broadcast_address) for x in long_range(1, broadcast - network + 1): yield self._address_class(network + x)
Generate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the Subnet-Router anycast address.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/ipaddress.py#L2250-L2260
[ "def long_range(start, end):\n while start < end:\n yield start\n start += 1\n" ]
class IPv6Network(_BaseV6, _BaseNetwork): """This class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f'...
saltstack/salt
salt/beacons/network_info.py
_to_list
python
def _to_list(obj): ''' Convert snetinfo object to list ''' ret = {} for attr in __attrs: if hasattr(obj, attr): ret[attr] = getattr(obj, attr) return ret
Convert snetinfo object to list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/network_info.py#L33-L42
null
# -*- coding: utf-8 -*- ''' Beacon to monitor statistics from ethernet adapters .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import third party libs # pylint: disable=import-error try: import salt.utils.psutil_compat as psutil H...
saltstack/salt
salt/beacons/network_info.py
validate
python
def validate(config): ''' Validate the beacon configuration ''' VALID_ITEMS = [ 'type', 'bytes_sent', 'bytes_recv', 'packets_sent', 'packets_recv', 'errin', 'errout', 'dropin', 'dropout' ] # Configuration for load beacon should be a list of dicts if not isinstance(c...
Validate the beacon configuration
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/network_info.py#L51-L78
null
# -*- coding: utf-8 -*- ''' Beacon to monitor statistics from ethernet adapters .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import third party libs # pylint: disable=import-error try: import salt.utils.psutil_compat as psutil H...
saltstack/salt
salt/beacons/network_info.py
beacon
python
def beacon(config): ''' Emit the network statistics of this host. Specify thresholds for each network stat and only emit a beacon if any of them are exceeded. Emit beacon when any values are equal to configured values. .. code-block:: yaml beacons: network_info: ...
Emit the network statistics of this host. Specify thresholds for each network stat and only emit a beacon if any of them are exceeded. Emit beacon when any values are equal to configured values. .. code-block:: yaml beacons: network_info: - interfaces: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/network_info.py#L81-L166
[ "def _to_list(obj):\n '''\n Convert snetinfo object to list\n '''\n ret = {}\n\n for attr in __attrs:\n if hasattr(obj, attr):\n ret[attr] = getattr(obj, attr)\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Beacon to monitor statistics from ethernet adapters .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import third party libs # pylint: disable=import-error try: import salt.utils.psutil_compat as psutil H...
saltstack/salt
salt/modules/apcups.py
status
python
def status(): ''' Return apcaccess output CLI Example: .. code-block:: bash salt '*' apcups.status ''' ret = {} apcaccess = _check_apcaccess() res = __salt__['cmd.run_all'](apcaccess) retcode = res['retcode'] if retcode != 0: ret['Error'] = 'Something with wron...
Return apcaccess output CLI Example: .. code-block:: bash salt '*' apcups.status
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apcups.py#L42-L64
null
# -*- coding: utf-8 -*- ''' Module for apcupsd ''' from __future__ import absolute_import, print_function, unicode_literals # Import Python libs import logging # Import Salt libs import salt.utils.path import salt.utils.decorators as decorators log = logging.getLogger(__name__) # Define the module's virtual name __...
saltstack/salt
salt/modules/apcups.py
status_load
python
def status_load(): ''' Return load CLI Example: .. code-block:: bash salt '*' apcups.status_load ''' data = status() if 'LOADPCT' in data: load = data['LOADPCT'].split() if load[1].lower() == 'percent': return float(load[0]) return {'Error': 'Load ...
Return load CLI Example: .. code-block:: bash salt '*' apcups.status_load
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apcups.py#L67-L83
[ "def status():\n '''\n Return apcaccess output\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' apcups.status\n '''\n ret = {}\n apcaccess = _check_apcaccess()\n res = __salt__['cmd.run_all'](apcaccess)\n retcode = res['retcode']\n if retcode != 0:\n ret['Error'] = ...
# -*- coding: utf-8 -*- ''' Module for apcupsd ''' from __future__ import absolute_import, print_function, unicode_literals # Import Python libs import logging # Import Salt libs import salt.utils.path import salt.utils.decorators as decorators log = logging.getLogger(__name__) # Define the module's virtual name __...
saltstack/salt
salt/modules/apcups.py
status_charge
python
def status_charge(): ''' Return battery charge CLI Example: .. code-block:: bash salt '*' apcups.status_charge ''' data = status() if 'BCHARGE' in data: charge = data['BCHARGE'].split() if charge[1].lower() == 'percent': return float(charge[0]) ret...
Return battery charge CLI Example: .. code-block:: bash salt '*' apcups.status_charge
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apcups.py#L86-L102
[ "def status():\n '''\n Return apcaccess output\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' apcups.status\n '''\n ret = {}\n apcaccess = _check_apcaccess()\n res = __salt__['cmd.run_all'](apcaccess)\n retcode = res['retcode']\n if retcode != 0:\n ret['Error'] = ...
# -*- coding: utf-8 -*- ''' Module for apcupsd ''' from __future__ import absolute_import, print_function, unicode_literals # Import Python libs import logging # Import Salt libs import salt.utils.path import salt.utils.decorators as decorators log = logging.getLogger(__name__) # Define the module's virtual name __...
saltstack/salt
salt/states/esxi.py
coredump_configured
python
def coredump_configured(name, enabled, dump_ip, host_vnic='vmk0', dump_port=6500): ''' Ensures a host's core dump configuration. name Name of the state. enabled Sets whether or not ESXi core dump collection should be enabled. This is a boolean value set to ``True`` or ``False``...
Ensures a host's core dump configuration. name Name of the state. enabled Sets whether or not ESXi core dump collection should be enabled. This is a boolean value set to ``True`` or ``False`` to enable or disable core dumps. Note that ESXi requires that the core dump m...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L139-L274
null
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
password_present
python
def password_present(name, password): ''' Ensures the given password is set on the ESXi host. Passwords cannot be obtained from host, so if a password is set in this state, the ``vsphere.update_host_password`` function will always run (except when using test=True functionality) and the state's chang...
Ensures the given password is set on the ESXi host. Passwords cannot be obtained from host, so if a password is set in this state, the ``vsphere.update_host_password`` function will always run (except when using test=True functionality) and the state's changes dictionary will always be populated. The u...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L277-L323
null
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
ntp_configured
python
def ntp_configured(name, service_running, ntp_servers=None, service_policy=None, service_restart=False, update_datetime=False): ''' Ensures a host's NTP server configuration such as setting NTP servers, ensuring the ...
Ensures a host's NTP server configuration such as setting NTP servers, ensuring the NTP daemon is running or stopped, or restarting the NTP daemon for the ESXi host. name Name of the state. service_running Ensures the running state of the ntp daemon for the host. Boolean value where ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L326-L497
null
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
vmotion_configured
python
def vmotion_configured(name, enabled, device='vmk0'): ''' Configures a host's VMotion properties such as enabling VMotion and setting the device VirtualNic that VMotion will use. name Name of the state. enabled Ensures whether or not VMotion should be enabled on a host as a boolean...
Configures a host's VMotion properties such as enabling VMotion and setting the device VirtualNic that VMotion will use. name Name of the state. enabled Ensures whether or not VMotion should be enabled on a host as a boolean value where ``True`` indicates that VMotion should be ena...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L500-L569
null
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
vsan_configured
python
def vsan_configured(name, enabled, add_disks_to_vsan=False): ''' Configures a host's VSAN properties such as enabling or disabling VSAN, or adding VSAN-eligible disks to the VSAN system for the host. name Name of the state. enabled Ensures whether or not VSAN should be enabled on a...
Configures a host's VSAN properties such as enabling or disabling VSAN, or adding VSAN-eligible disks to the VSAN system for the host. name Name of the state. enabled Ensures whether or not VSAN should be enabled on a host as a boolean value where ``True`` indicates that VSAN shoul...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L572-L666
null
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
ssh_configured
python
def ssh_configured(name, service_running, ssh_key=None, ssh_key_file=None, service_policy=None, service_restart=False, certificate_verify=False): ''' Manage the SSH configuration for a host includin...
Manage the SSH configuration for a host including whether or not SSH is running or the presence of a given SSH key. Note: Only one ssh key can be uploaded for root. Uploading a second key will replace any existing key. name Name of the state. service_running Ensures whether or not the ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L669-L866
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
syslog_configured
python
def syslog_configured(name, syslog_configs, firewall=True, reset_service=True, reset_syslog_config=False, reset_configs=None): ''' Ensures the specified syslog configuration parameters. By default, ...
Ensures the specified syslog configuration parameters. By default, this state will reset the syslog service after any new or changed parameters are set successfully. name Name of the state. syslog_configs Name of parameter to set (corresponds to the command line switch for esxc...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L869-L1025
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _lookup_syslog_config(config):\n '''\n Helper function that looks up syslog_config keys available from\n ``vsphere.get_syslog_config``.\n '''\n lookup = {'default-timeout': 'Default Network Retry Timeout',\n 'logdir': 'Loc...
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
diskgroups_configured
python
def diskgroups_configured(name, diskgroups, erase_disks=False): ''' Configures the disk groups to use for vsan. This function will do the following: 1. Check whether or not all disks in the diskgroup spec exist, and raises and errors if they do not. 2. Create diskgroups with the correct di...
Configures the disk groups to use for vsan. This function will do the following: 1. Check whether or not all disks in the diskgroup spec exist, and raises and errors if they do not. 2. Create diskgroups with the correct disk configurations if diskgroup (identified by the cache disk canonica...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L1030-L1300
[ "def serialize(cls, id_=None):\n # Get the initial serialization\n serialized = super(DefinitionsSchema, cls).serialize(id_)\n complex_items = []\n # Augment the serializations with the definitions of all complex items\n aux_items = cls._items.values()\n\n # Convert dict_view object to a list on P...
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/esxi.py
host_cache_configured
python
def host_cache_configured(name, enabled, datastore, swap_size='100%', dedicated_backing_disk=False, erase_backing_disk=False): ''' Configures the host cache used for swapping. It will do the following: 1. Checks if backing disk exists 2. Creates...
Configures the host cache used for swapping. It will do the following: 1. Checks if backing disk exists 2. Creates the VMFS datastore if doesn't exist (datastore partition will be created and use the entire disk) 3. Raises an error if ``dedicated_backing_disk`` is ``True`` and partitions ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxi.py#L1305-L1594
[ "def serialize(cls, id_=None):\n # Get the initial serialization\n serialized = super(DefinitionsSchema, cls).serialize(id_)\n complex_items = []\n # Augment the serializations with the definitions of all complex items\n aux_items = cls._items.values()\n\n # Convert dict_view object to a list on P...
# -*- coding: utf-8 -*- ''' Manage VMware ESXi Hosts. .. versionadded:: 2015.8.4 Dependencies ============ - pyVmomi Python Module - ESXCLI pyVmomi ------- PyVmomi can be installed via pip: .. code-block:: bash pip install pyVmomi .. note:: Version 6.0 of pyVmomi has some problems with SSL error handl...
saltstack/salt
salt/states/cimc.py
hostname
python
def hostname(name, hostname=None): ''' Ensures that the hostname is set to the specified value. .. versionadded:: 2019.2.0 name: The name of the module function to execute. hostname(str): The hostname of the server. SLS Example: .. code-block:: yaml set_name: cimc.hos...
Ensures that the hostname is set to the specified value. .. versionadded:: 2019.2.0 name: The name of the module function to execute. hostname(str): The hostname of the server. SLS Example: .. code-block:: yaml set_name: cimc.hostname: - hostname: foobar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L46-L100
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/states/cimc.py
logging_levels
python
def logging_levels(name, remote=None, local=None): ''' Ensures that the logging levels are set on the device. The logging levels must match the following options: emergency, alert, critical, error, warning, notice, informational, debug. .. versionadded:: 2019.2.0 name: The name of the module f...
Ensures that the logging levels are set on the device. The logging levels must match the following options: emergency, alert, critical, error, warning, notice, informational, debug. .. versionadded:: 2019.2.0 name: The name of the module function to execute. remote(str): The logging level for SYS...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L103-L165
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/states/cimc.py
ntp
python
def ntp(name, servers): ''' Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four NTP servers will be reviewed. Any entries past four will be ignored. name: The name of the module function to execute. servers(str, list): The IP address ...
Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four NTP servers will be reviewed. Any entries past four will be ignored. name: The name of the module function to execute. servers(str, list): The IP address or FQDN of the NTP servers. SLS...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L168-L247
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/states/cimc.py
power_configuration
python
def power_configuration(name, policy=None, delayType=None, delayValue=None): ''' Ensures that the power configuration is configured on the system. This is only available on some C-Series servers. .. versionadded:: 2019.2.0 name: The name of the module function to execute. policy(str): The act...
Ensures that the power configuration is configured on the system. This is only available on some C-Series servers. .. versionadded:: 2019.2.0 name: The name of the module function to execute. policy(str): The action to be taken when chassis power is restored after an unexpected power loss. This c...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L250-L348
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/states/cimc.py
syslog
python
def syslog(name, primary=None, secondary=None): ''' Ensures that the syslog servers are set to the specified values. A value of None will be ignored. name: The name of the module function to execute. primary(str): The IP address or FQDN of the primary syslog server. secondary(str): The IP address...
Ensures that the syslog servers are set to the specified values. A value of None will be ignored. name: The name of the module function to execute. primary(str): The IP address or FQDN of the primary syslog server. secondary(str): The IP address or FQDN of the secondary syslog server. SLS Example: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L351-L434
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/states/cimc.py
user
python
def user(name, id='', user='', priv='', password='', status='active'): ''' Ensures that a user is configured on the device. Due to being unable to verify the user password. This is a forced operation. .. versionadded:: 2019.2.0 name: The name of the module function to execute. id(int): The us...
Ensures that a user is configured on the device. Due to being unable to verify the user password. This is a forced operation. .. versionadded:: 2019.2.0 name: The name of the module function to execute. id(int): The user ID slot on the device. user(str): The username of the user. priv(str):...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cimc.py#L437-L503
[ "def _default_ret(name):\n '''\n Set the default response values.\n\n '''\n ret = {\n 'name': name,\n 'changes': {},\n 'result': False,\n 'comment': ''\n }\n return ret\n" ]
# -*- coding: utf-8 -*- ''' A state module to manage Cisco UCS chassis devices. :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>`` :maturity: new :depends: none :platform: unix About ===== This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This modu...
saltstack/salt
salt/proxy/esxcluster.py
init
python
def init(opts): ''' This function gets called when the proxy starts up. For login the protocol and port are cached. ''' log.debug('Initting esxcluster proxy module in process %s', os.getpid()) log.debug('Validating esxcluster proxy input') schema = EsxclusterProxySchema.serialize() l...
This function gets called when the proxy starts up. For login the protocol and port are cached.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxcluster.py#L197-L257
[ "def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):\n if strategy == 'smart':\n if renderer.split('|')[-1] == 'yamlex' or renderer.startswith('yamlex_'):\n strategy = 'aggregate'\n else:\n strategy = 'recurse'\n\n if strategy == 'list':\n ...
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMWare ESXi clusters. Dependencies ============ - pyVmomi - jsonschema Configuration ============= To use this integration proxy module, please configure the following: Pillar ------ Proxy minions get their configuration from Salt's Pillar. Thi...
saltstack/salt
salt/proxy/esxcluster.py
find_credentials
python
def find_credentials(): ''' Cycle through all the possible credentials and return the first one that works. ''' # if the username and password were already found don't fo though the # connection process again if 'username' in DETAILS and 'password' in DETAILS: return DETAILS['userna...
Cycle through all the possible credentials and return the first one that works.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxcluster.py#L281-L302
null
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMWare ESXi clusters. Dependencies ============ - pyVmomi - jsonschema Configuration ============= To use this integration proxy module, please configure the following: Pillar ------ Proxy minions get their configuration from Salt's Pillar. Thi...
saltstack/salt
salt/roster/flat.py
targets
python
def targets(tgt, tgt_type='glob', **kwargs): ''' Return the targets from the flat yaml file, checks opts for location but defaults to /etc/salt/roster ''' template = get_roster_file(__opts__) rend = salt.loader.render(__opts__, {}) raw = compile_template(template, ...
Return the targets from the flat yaml file, checks opts for location but defaults to /etc/salt/roster
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/flat.py#L18-L36
[ "def compile_template(template,\n renderers,\n default,\n blacklist,\n whitelist,\n saltenv='base',\n sls='',\n input_data='',\n **kwargs):\n '''\n Ta...
# -*- coding: utf-8 -*- ''' Read in the roster from a flat file using the renderer system ''' from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.loader import salt.config from salt.ext import six from salt.template import compile_template from salt.roster import get...
saltstack/salt
salt/cli/key.py
SaltKey.run
python
def run(self): ''' Execute salt-key ''' import salt.key self.parse_args() self.setup_logfile_logger() verify_log(self.config) key = salt.key.KeyCLI(self.config) if check_user(self.config['user']): key.run()
Execute salt-key
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/key.py#L14-L26
[ "def check_user(user):\n '''\n Check user and assign process uid/gid.\n '''\n if salt.utils.platform.is_windows():\n return True\n if user == salt.utils.user.get_user():\n return True\n import pwd # after confirming not running Windows\n try:\n pwuser = pwd.getpwnam(user)\...
class SaltKey(salt.utils.parsers.SaltKeyOptionParser): ''' Initialize the Salt key manager '''
saltstack/salt
salt/sdb/tism.py
get
python
def get(key, service=None, profile=None): # pylint: disable=W0613 ''' Get a decrypted secret from the tISMd API ''' if not profile.get('url') or not profile.get('token'): raise SaltConfigurationError("url and/or token missing from the tism sdb profile") request = {"token": profile['token'...
Get a decrypted secret from the tISMd API
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/tism.py#L53-L78
null
# -*- coding: utf-8 -*- ''' tISM - the Immutable Secrets Manager SDB Module :maintainer: tISM :maturity: New :platform: all .. versionadded:: 2017.7.0 This module will decrypt PGP encrypted secrets against a tISM server. .. code:: sdb://<profile>/<encrypted secret> sdb://tism/hQEMAzJ+GfdAB3KqAQf9...
saltstack/salt
salt/pillar/postgres.py
ext_pillar
python
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Execute queries against POSTGRES, merge and return as a dict ''' return POSTGRESExtPillar().fetch(minion_id, pillar, *args, **kwargs)
Execute queries against POSTGRES, merge and return as a dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/postgres.py#L112-L119
null
# -*- coding: utf-8 -*- ''' Retrieve Pillar data by doing a postgres query .. versionadded:: 2017.7.0 :maturity: new :depends: psycopg2 :platform: all Complete Example ================ .. code-block:: yaml postgres: user: 'salt' pass: 'super_secret_password' db: 'salt_db' ext_pillar: ...
saltstack/salt
salt/pillar/postgres.py
POSTGRESExtPillar._get_cursor
python
def _get_cursor(self): ''' Yield a POSTGRES cursor ''' _options = self._get_options() conn = psycopg2.connect(host=_options['host'], user=_options['user'], password=_options['pass'], d...
Yield a POSTGRES cursor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/postgres.py#L85-L102
null
class POSTGRESExtPillar(SqlBaseExtPillar): ''' This class receives and processes the database rows from POSTGRES. ''' @classmethod def _db_name(cls): return 'POSTGRES' def _get_options(self): ''' Returns options used for the POSTGRES connection. ''' defau...
saltstack/salt
salt/pillar/postgres.py
POSTGRESExtPillar.extract_queries
python
def extract_queries(self, args, kwargs): ''' This function normalizes the config block into a set of queries we can use. The return is a list of consistently laid out dicts. ''' return super(POSTGRESExtPillar, self).extract_queries(args, kwargs)
This function normalizes the config block into a set of queries we can use. The return is a list of consistently laid out dicts.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/postgres.py#L104-L109
[ "def extract_queries(self, args, kwargs):\n '''\n This function normalizes the config block into a set of queries we\n can use. The return is a list of consistently laid out dicts.\n '''\n # Please note the function signature is NOT an error. Neither args, nor\n # kwargs should have asterisks. ...
class POSTGRESExtPillar(SqlBaseExtPillar): ''' This class receives and processes the database rows from POSTGRES. ''' @classmethod def _db_name(cls): return 'POSTGRES' def _get_options(self): ''' Returns options used for the POSTGRES connection. ''' defau...
saltstack/salt
salt/modules/ps.py
_get_proc_cmdline
python
def _get_proc_cmdline(proc): ''' Returns the cmdline of a Process instance. It's backward compatible with < 2.0 versions of psutil. ''' try: return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline) except (psutil.NoSuchProcess, psutil.AccessDenied): return []
Returns the cmdline of a Process instance. It's backward compatible with < 2.0 versions of psutil.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L50-L59
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
_get_proc_create_time
python
def _get_proc_create_time(proc): ''' Returns the create_time of a Process instance. It's backward compatible with < 2.0 versions of psutil. ''' try: return salt.utils.data.decode(proc.create_time() if PSUTIL2 else proc.create_time) except (psutil.NoSuchProcess, psutil.AccessDenied): ...
Returns the create_time of a Process instance. It's backward compatible with < 2.0 versions of psutil.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L62-L71
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
_get_proc_name
python
def _get_proc_name(proc): ''' Returns the name of a Process instance. It's backward compatible with < 2.0 versions of psutil. ''' try: return salt.utils.data.decode(proc.name() if PSUTIL2 else proc.name) except (psutil.NoSuchProcess, psutil.AccessDenied): return []
Returns the name of a Process instance. It's backward compatible with < 2.0 versions of psutil.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L74-L83
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
_get_proc_status
python
def _get_proc_status(proc): ''' Returns the status of a Process instance. It's backward compatible with < 2.0 versions of psutil. ''' try: return salt.utils.data.decode(proc.status() if PSUTIL2 else proc.status) except (psutil.NoSuchProcess, psutil.AccessDenied): return None
Returns the status of a Process instance. It's backward compatible with < 2.0 versions of psutil.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L86-L95
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
_get_proc_username
python
def _get_proc_username(proc): ''' Returns the username of a Process instance. It's backward compatible with < 2.0 versions of psutil. ''' try: return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username) except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError): ...
Returns the username of a Process instance. It's backward compatible with < 2.0 versions of psutil.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L98-L107
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
top
python
def top(num_processes=5, interval=3): ''' Return a list of top CPU consuming processes during the interval. num_processes = return the top N CPU consuming processes interval = the number of seconds to sample CPU usage over CLI Examples: .. code-block:: bash salt '*' ps.top sa...
Return a list of top CPU consuming processes during the interval. num_processes = return the top N CPU consuming processes interval = the number of seconds to sample CPU usage over CLI Examples: .. code-block:: bash salt '*' ps.top salt '*' ps.top 5 10
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L119-L178
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _get_proc_cmdline(proc):\n '''\n Returns the cmdline of a Process instance.\n\n It's backward compatible with < 2.0 versions of psutil.\n '''\n try:\n return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)\n ...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
proc_info
python
def proc_info(pid, attrs=None): ''' Return a dictionary of information for a process id (PID). CLI Example: .. code-block:: bash salt '*' ps.proc_info 2322 salt '*' ps.proc_info 2322 attrs='["pid", "name"]' pid PID of process to query. attrs Optional list of ...
Return a dictionary of information for a process id (PID). CLI Example: .. code-block:: bash salt '*' ps.proc_info 2322 salt '*' ps.proc_info 2322 attrs='["pid", "name"]' pid PID of process to query. attrs Optional list of desired process attributes. The list of pos...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L194-L217
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
kill_pid
python
def kill_pid(pid, signal=15): ''' Kill a process by PID. .. code-block:: bash salt 'minion' ps.kill_pid pid [signal=signal_number] pid PID of process to kill. signal Signal to send to the process. See manpage entry for kill for possible values. Default: 15 (SIGTER...
Kill a process by PID. .. code-block:: bash salt 'minion' ps.kill_pid pid [signal=signal_number] pid PID of process to kill. signal Signal to send to the process. See manpage entry for kill for possible values. Default: 15 (SIGTERM). **Example:** Send SIGKILL to...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L220-L247
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
pkill
python
def pkill(pattern, user=None, signal=15, full=False): ''' Kill processes matching a pattern. .. code-block:: bash salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\ [full=(true|false)] pattern Pattern to search for in the process list. user ...
Kill processes matching a pattern. .. code-block:: bash salt '*' ps.pkill pattern [user=username] [signal=signal_number] \\ [full=(true|false)] pattern Pattern to search for in the process list. user Limit matches to the given username. Default: All users. si...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L250-L302
[ "def _get_proc_cmdline(proc):\n '''\n Returns the cmdline of a Process instance.\n\n It's backward compatible with < 2.0 versions of psutil.\n '''\n try:\n return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)\n except (psutil.NoSuchProcess, psutil.AccessDenied):\n ...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
pgrep
python
def pgrep(pattern, user=None, full=False, pattern_is_regex=False): ''' Return the pids for processes matching a pattern. If full is true, the full command line is searched for a match, otherwise only the name of the command is searched. .. code-block:: bash salt '*' ps.pgrep pattern [user...
Return the pids for processes matching a pattern. If full is true, the full command line is searched for a match, otherwise only the name of the command is searched. .. code-block:: bash salt '*' ps.pgrep pattern [user=username] [full=(true|false)] pattern Pattern to search for in th...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L305-L368
[ "def _get_proc_cmdline(proc):\n '''\n Returns the cmdline of a Process instance.\n\n It's backward compatible with < 2.0 versions of psutil.\n '''\n try:\n return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)\n except (psutil.NoSuchProcess, psutil.AccessDenied):\n ...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
cpu_percent
python
def cpu_percent(interval=0.1, per_cpu=False): ''' Return the percent of time the CPU is busy. interval the number of seconds to sample CPU usage over per_cpu if True return an array of CPU percent busy for each CPU, otherwise aggregate all percents into one number CLI Examp...
Return the percent of time the CPU is busy. interval the number of seconds to sample CPU usage over per_cpu if True return an array of CPU percent busy for each CPU, otherwise aggregate all percents into one number CLI Example: .. code-block:: bash salt '*' ps.cpu_per...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L371-L391
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
cpu_times
python
def cpu_times(per_cpu=False): ''' Return the percent of time the CPU spends in each state, e.g. user, system, idle, nice, iowait, irq, softirq. per_cpu if True return an array of percents for each CPU, otherwise aggregate all percents into one number CLI Example: .. code-block...
Return the percent of time the CPU spends in each state, e.g. user, system, idle, nice, iowait, irq, softirq. per_cpu if True return an array of percents for each CPU, otherwise aggregate all percents into one number CLI Example: .. code-block:: bash salt '*' ps.cpu_times
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L394-L413
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
virtual_memory
python
def virtual_memory(): ''' .. versionadded:: 2014.7.0 Return a dict that describes statistics about system memory usage. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.virtual_memory ''' if p...
.. versionadded:: 2014.7.0 Return a dict that describes statistics about system memory usage. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.virtual_memory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L416-L435
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
swap_memory
python
def swap_memory(): ''' .. versionadded:: 2014.7.0 Return a dict that describes swap memory statistics. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.swap_memory ''' if psutil.version_info <...
.. versionadded:: 2014.7.0 Return a dict that describes swap memory statistics. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.swap_memory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L438-L457
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
disk_partitions
python
def disk_partitions(all=False): ''' Return a list of disk partitions and their device, mount point, and filesystem type. all if set to False, only return local, physical partitions (hard disk, USB, CD/DVD partitions). If True, return all filesystems. CLI Example: .. code-bloc...
Return a list of disk partitions and their device, mount point, and filesystem type. all if set to False, only return local, physical partitions (hard disk, USB, CD/DVD partitions). If True, return all filesystems. CLI Example: .. code-block:: bash salt '*' ps.disk_partition...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L460-L477
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
disk_partition_usage
python
def disk_partition_usage(all=False): ''' Return a list of disk partitions plus the mount point, filesystem and usage statistics. CLI Example: .. code-block:: bash salt '*' ps.disk_partition_usage ''' result = disk_partitions(all) for partition in result: partition.upda...
Return a list of disk partitions plus the mount point, filesystem and usage statistics. CLI Example: .. code-block:: bash salt '*' ps.disk_partition_usage
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L494-L508
[ "def disk_partitions(all=False):\n '''\n Return a list of disk partitions and their device, mount point, and\n filesystem type.\n\n all\n if set to False, only return local, physical partitions (hard disk,\n USB, CD/DVD partitions). If True, return all filesystems.\n\n CLI Example:\n\n...
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
total_physical_memory
python
def total_physical_memory(): ''' Return the total number of bytes of physical memory. CLI Example: .. code-block:: bash salt '*' ps.total_physical_memory ''' if psutil.version_info < (0, 6, 0): msg = 'virtual_memory is only available in psutil 0.6.0 or greater' raise C...
Return the total number of bytes of physical memory. CLI Example: .. code-block:: bash salt '*' ps.total_physical_memory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L511-L529
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
boot_time
python
def boot_time(time_format=None): ''' Return the boot time in number of seconds since the epoch began. CLI Example: time_format Optionally specify a `strftime`_ format string. Use ``time_format='%c'`` to get a nicely-formatted locale specific date and time (i.e. ``Fri May 2 19:...
Return the boot time in number of seconds since the epoch began. CLI Example: time_format Optionally specify a `strftime`_ format string. Use ``time_format='%c'`` to get a nicely-formatted locale specific date and time (i.e. ``Fri May 2 19:08:32 2014``). .. _strftime: https:/...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L550-L582
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
network_io_counters
python
def network_io_counters(interface=None): ''' Return network I/O statistics. CLI Example: .. code-block:: bash salt '*' ps.network_io_counters salt '*' ps.network_io_counters interface=eth0 ''' if not interface: return dict(psutil.net_io_counters()._asdict()) else:...
Return network I/O statistics. CLI Example: .. code-block:: bash salt '*' ps.network_io_counters salt '*' ps.network_io_counters interface=eth0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L585-L604
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
disk_io_counters
python
def disk_io_counters(device=None): ''' Return disk I/O statistics. CLI Example: .. code-block:: bash salt '*' ps.disk_io_counters salt '*' ps.disk_io_counters device=sda1 ''' if not device: return dict(psutil.disk_io_counters()._asdict()) else: stats = psu...
Return disk I/O statistics. CLI Example: .. code-block:: bash salt '*' ps.disk_io_counters salt '*' ps.disk_io_counters device=sda1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L607-L626
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
get_users
python
def get_users(): ''' Return logged-in users. CLI Example: .. code-block:: bash salt '*' ps.get_users ''' try: recs = psutil.users() return [dict(x._asdict()) for x in recs] except AttributeError: # get_users is only present in psutil > v0.5.0 # try ...
Return logged-in users. CLI Example: .. code-block:: bash salt '*' ps.get_users
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L629-L660
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
lsof
python
def lsof(name): ''' Retrieve the lsof information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.lsof apache2 ''' sanitize_name = six.text_type(name) lsof_infos = __salt__['cmd.run']("lsof -c " + sanitize_name) ret = [] ret.extend([sanitize_name, ...
Retrieve the lsof information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.lsof apache2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L663-L677
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
netstat
python
def netstat(name): ''' Retrieve the netstat information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.netstat apache2 ''' sanitize_name = six.text_type(name) netstat_infos = __salt__['cmd.run']("netstat -nap") found_infos = [] ret = [] for in...
Retrieve the netstat information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.netstat apache2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L681-L699
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
ss
python
def ss(name): ''' Retrieve the ss information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.ss apache2 .. versionadded:: 2016.11.6 ''' sanitize_name = six.text_type(name) ss_infos = __salt__['cmd.run']("ss -neap") found_infos = [] ret = [] ...
Retrieve the ss information of the given process name. CLI Example: .. code-block:: bash salt '*' ps.ss apache2 .. versionadded:: 2016.11.6
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L703-L724
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/modules/ps.py
psaux
python
def psaux(name): ''' Retrieve information corresponding to a "ps aux" filtered with the given pattern. It could be just a name or a regular expression (using python search from "re" module). CLI Example: .. code-block:: bash salt '*' ps.psaux www-data.+apache2 ''' sanitize_nam...
Retrieve information corresponding to a "ps aux" filtered with the given pattern. It could be just a name or a regular expression (using python search from "re" module). CLI Example: .. code-block:: bash salt '*' ps.psaux www-data.+apache2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L727-L756
null
# -*- coding: utf-8 -*- ''' A salt interface to psutil, a system and process library. See http://code.google.com/p/psutil. :depends: - psutil Python module, version 0.3.0 or later - python-utmp package (optional) ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_fu...
saltstack/salt
salt/states/pagerduty_service.py
present
python
def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs): ''' Ensure pagerduty service exists. This method accepts as arguments everything defined in https://developer.pagerduty.com/documentation/rest/services/create Note that many arguments are mutually exclusive, depending on the ...
Ensure pagerduty service exists. This method accepts as arguments everything defined in https://developer.pagerduty.com/documentation/rest/services/create Note that many arguments are mutually exclusive, depending on the "type" argument. Examples: .. code-block:: yaml # create a PagerDut...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_service.py#L30-L84
null
# -*- coding: utf-8 -*- ''' Manage PagerDuty services Escalation policies can be referenced by pagerduty ID or by namea. For example: .. code-block:: yaml ensure test service pagerduty_service.present: - name: 'my service' - escalation_policy_id: 'my escalation policy' ...
saltstack/salt
salt/states/pagerduty_service.py
absent
python
def absent(profile='pagerduty', subdomain=None, api_key=None, **kwargs): ''' Ensure a pagerduty service does not exist. Name can be the service name or pagerduty service id. ''' r = __salt__['pagerduty_util.resource_absent']('services', ['name', 'id...
Ensure a pagerduty service does not exist. Name can be the service name or pagerduty service id.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_service.py#L87-L98
null
# -*- coding: utf-8 -*- ''' Manage PagerDuty services Escalation policies can be referenced by pagerduty ID or by namea. For example: .. code-block:: yaml ensure test service pagerduty_service.present: - name: 'my service' - escalation_policy_id: 'my escalation policy' ...
saltstack/salt
salt/states/pagerduty_service.py
_diff
python
def _diff(state_data, resource_object): '''helper method to compare salt state info with the PagerDuty API json structure, and determine if we need to update. returns the dict to pass to the PD API to perform the update, or empty dict if no update. ''' objects_differ = None for k, v in state_d...
helper method to compare salt state info with the PagerDuty API json structure, and determine if we need to update. returns the dict to pass to the PD API to perform the update, or empty dict if no update.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty_service.py#L101-L126
null
# -*- coding: utf-8 -*- ''' Manage PagerDuty services Escalation policies can be referenced by pagerduty ID or by namea. For example: .. code-block:: yaml ensure test service pagerduty_service.present: - name: 'my service' - escalation_policy_id: 'my escalation policy' ...
saltstack/salt
salt/modules/baredoc.py
modules_and_args
python
def modules_and_args(modules=True, states=False, names_only=False): ''' Walk the Salt install tree and return a dictionary or a list of the functions therein as well as their arguments. :param modules: Walk the modules directory if True :param states: Walk the states directory if True :param na...
Walk the Salt install tree and return a dictionary or a list of the functions therein as well as their arguments. :param modules: Walk the modules directory if True :param states: Walk the states directory if True :param names_only: Return only a list of the callable functions instead of a dictionary w...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/baredoc.py#L96-L151
[ "def _mods_with_args(dirs):\n ret = {}\n for d in dirs:\n for m in os.listdir(d):\n if m.endswith('.py'):\n with salt.utils.files.fopen(os.path.join(d, m), 'r') as f:\n in_def = False\n fn_def = u''\n modulename = m.spli...
# -*- coding: utf-8 -*- ''' Baredoc walks the installed module and state directories and generates dictionaries and lists of the function names and their arguments. .. versionadded:: Neon ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import logging import os import...
saltstack/salt
salt/output/pony.py
output
python
def output(data, **kwargs): # pylint: disable=unused-argument ''' Mane function ''' high_out = __salt__['highstate'](data) return subprocess.check_output(['ponysay', salt.utils.data.decode(high_out)])
Mane function
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/pony.py#L62-L67
[ "def decode(data, encoding=None, errors='strict', keep=False,\n normalize=False, preserve_dict_class=False, preserve_tuples=False,\n to_str=False):\n '''\n Generic function which will decode whichever type is passed, if necessary.\n Optionally use to_str=True to ensure strings are str t...
# -*- coding: utf-8 -*- r''' Display Pony output data structure ================================== :depends: - ponysay CLI program Display output from a pony. Ponies are better than cows because everybody wants a pony. Example output: .. code-block:: cfg < {'local': True} > ----------------- \ ...
saltstack/salt
salt/modules/win_dsc.py
run_config
python
def run_config(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base'): r''' Compile a DSC Configuration in the form of a PowerShell script (.ps1) and ap...
r''' Compile a DSC Configuration in the form of a PowerShell script (.ps1) and apply it. The PowerShell script can be cached from the master using the ``source`` option. If there is more than one config within the PowerShell script, the desired configuration can be applied by passing the name in the ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L95-L180
[ "def compile_config(path,\n source=None,\n config_name=None,\n config_data=None,\n config_data_source=None,\n script_parameters=None,\n salt_env='base'):\n r'''\n Compile a config from a PowerShell scri...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
compile_config
python
def compile_config(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base'): r''' Compile a config from a PowerShell script (``.ps1``)...
r''' Compile a config from a PowerShell script (``.ps1``) Args: path (str): Path (local) to the script that will create the ``.mof`` configuration file. If no source is passed, the file must exist locally. Required. source (str): Path to the script on ``file_roots`` to...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L183-L329
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
apply_config
python
def apply_config(path, source=None, salt_env='base'): r''' Run an compiled DSC configuration (a folder containing a .mof file). The folder can be cached from the salt master using the ``source`` option. Args: path (str): Local path to the directory that contains the .mof configurat...
r''' Run an compiled DSC configuration (a folder containing a .mof file). The folder can be cached from the salt master using the ``source`` option. Args: path (str): Local path to the directory that contains the .mof configuration file to apply. Required. source (str): Path t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L332-L408
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
get_config
python
def get_config(): ''' Get the current DSC Configuration Returns: dict: A dictionary representing the DSC Configuration on the machine Raises: CommandExecutionError: On failure CLI Example: .. code-block:: bash salt '*' dsc.get_config ''' cmd = 'Get-DscConfigu...
Get the current DSC Configuration Returns: dict: A dictionary representing the DSC Configuration on the machine Raises: CommandExecutionError: On failure CLI Example: .. code-block:: bash salt '*' dsc.get_config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L411-L448
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
remove_config
python
def remove_config(reset=False): ''' Remove the current DSC Configuration. Removes current, pending, and previous dsc configurations. .. versionadded:: 2017.7.5 Args: reset (bool): Attempts to reset the DSC configuration by removing the following from ``C:\\Windows\\...
Remove the current DSC Configuration. Removes current, pending, and previous dsc configurations. .. versionadded:: 2017.7.5 Args: reset (bool): Attempts to reset the DSC configuration by removing the following from ``C:\\Windows\\System32\\Configuration``: - Fi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L451-L532
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
restore_config
python
def restore_config(): ''' Reapplies the previous configuration. .. versionadded:: 2017.7.5 .. note:: The current configuration will be come the previous configuration. If run a second time back-to-back it is like toggling between two configs. Returns: bool: True if success...
Reapplies the previous configuration. .. versionadded:: 2017.7.5 .. note:: The current configuration will be come the previous configuration. If run a second time back-to-back it is like toggling between two configs. Returns: bool: True if successfully restored Raises: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L535-L564
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
get_config_status
python
def get_config_status(): ''' Get the status of the current DSC Configuration Returns: dict: A dictionary representing the status of the current DSC Configuration on the machine CLI Example: .. code-block:: bash salt '*' dsc.get_config_status ''' cmd = 'Get-Dsc...
Get the status of the current DSC Configuration Returns: dict: A dictionary representing the status of the current DSC Configuration on the machine CLI Example: .. code-block:: bash salt '*' dsc.get_config_status
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L589-L612
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/win_dsc.py
set_lcm_config
python
def set_lcm_config(config_mode=None, config_mode_freq=None, refresh_freq=None, reboot_if_needed=None, action_after_reboot=None, refresh_mode=None, certificate_id=None, configuration_id=No...
For detailed descriptions of the parameters see: https://msdn.microsoft.com/en-us/PowerShell/DSC/metaConfig config_mode (str): How the LCM applies the configuration. Valid values are: - ApplyOnly - ApplyAndMonitor - ApplyAndAutoCorrect config_mode_freq (int): How often, in...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dsc.py#L637-L801
[ "def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):\n '''\n Execute the desired PowerShell command and ensure that it returns data\n in json format and load that into python. Either return a dict or raise a\n CommandExecutionError.\n '''\n if 'convertto-json' not in cmd.lower():\n ...
# -*- coding: utf-8 -*- ''' Module for working with Windows PowerShell DSC (Desired State Configuration) This module is Alpha This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files. Use the ``psget`` module to manage PowerShell resources. The idea is to ...
saltstack/salt
salt/modules/sensors.py
sense
python
def sense(chip, fahrenheit=False): ''' Gather lm-sensors data from a given chip To determine the chip to query, use the 'sensors' command and see the leading line in the block. Example: /usr/bin/sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +56.0°C (high = +87.0...
Gather lm-sensors data from a given chip To determine the chip to query, use the 'sensors' command and see the leading line in the block. Example: /usr/bin/sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +56.0°C (high = +87.0°C, crit = +105.0°C) Core 0: +52.0°...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sensors.py#L25-L55
null
# -*- coding: utf-8 -*- ''' Read lm-sensors .. versionadded:: 2014.1.3 ''' from __future__ import absolute_import, unicode_literals, print_function # Import python libs import logging # import Salt libs import salt.utils.path log = logging.getLogger(__name__) def __virtual__(): if salt.utils.path.which('sens...
saltstack/salt
salt/states/influxdb_retention_policy.py
convert_duration
python
def convert_duration(duration): ''' Convert the a duration string into XXhYYmZZs format duration Duration to convert Returns: duration_string String representation of duration in XXhYYmZZs format ''' # durations must be specified in days, weeks or hours if duration.endswi...
Convert the a duration string into XXhYYmZZs format duration Duration to convert Returns: duration_string String representation of duration in XXhYYmZZs format
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb_retention_policy.py#L24-L49
null
# -*- coding: utf-8 -*- ''' Management of Influxdb retention policies ========================================= .. versionadded:: 2017.7.0 (compatible with InfluxDB version 0.9+) ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals def __virtual__(): ''' Only lo...
saltstack/salt
salt/states/influxdb_retention_policy.py
present
python
def present(name, database, duration="7d", replication=1, default=False, **client_args): ''' Ensure that given retention policy is present. name Name of the retention policy to create. database Database to create retention policy on. ''' ret = {'name': n...
Ensure that given retention policy is present. name Name of the retention policy to create. database Database to create retention policy on.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb_retention_policy.py#L52-L126
[ "def convert_duration(duration):\n '''\n Convert the a duration string into XXhYYmZZs format\n\n duration\n Duration to convert\n\n Returns: duration_string\n String representation of duration in XXhYYmZZs format\n '''\n\n # durations must be specified in days, weeks or hours\n\n ...
# -*- coding: utf-8 -*- ''' Management of Influxdb retention policies ========================================= .. versionadded:: 2017.7.0 (compatible with InfluxDB version 0.9+) ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals def __virtual__(): ''' Only lo...
saltstack/salt
salt/modules/event.py
_dict_subset
python
def _dict_subset(keys, master_dict): ''' Return a dictionary of only the subset of keys/values specified in keys ''' return dict([(k, v) for k, v in six.iteritems(master_dict) if k in keys])
Return a dictionary of only the subset of keys/values specified in keys
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L27-L31
null
# -*- coding: utf-8 -*- ''' Use the :ref:`Salt Event System <events>` to fire events from the master to the minion and vice-versa. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import collections import logging import os import sys import traceback # Import salt lib...
saltstack/salt
salt/modules/event.py
fire_master
python
def fire_master(data, tag, preload=None, timeout=60): ''' Fire an event off up to the master server CLI Example: .. code-block:: bash salt '*' event.fire_master '{"data":"my event data"}' 'tag' ''' if (__opts__.get('local', None) or __opts__.get('file_client', None) == 'local') and no...
Fire an event off up to the master server CLI Example: .. code-block:: bash salt '*' event.fire_master '{"data":"my event data"}' 'tag'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L34-L98
[ "def ip_bracket(addr):\n '''\n Convert IP address representation to ZMQ (URL) format. ZMQ expects\n brackets around IPv6 literals, since they are used in URLs.\n '''\n addr = ipaddress.ip_address(addr)\n return ('[{}]' if addr.version == 6 else '{}').format(addr)\n", "def factory(opts, **kwargs)...
# -*- coding: utf-8 -*- ''' Use the :ref:`Salt Event System <events>` to fire events from the master to the minion and vice-versa. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import collections import logging import os import sys import traceback # Import salt lib...
saltstack/salt
salt/modules/event.py
fire
python
def fire(data, tag, timeout=None): ''' Fire an event on the local minion event bus. Data must be formed as a dict. CLI Example: .. code-block:: bash salt '*' event.fire '{"data":"my event data"}' 'tag' ''' if timeout is None: timeout = 60000 else: timeout = timeout...
Fire an event on the local minion event bus. Data must be formed as a dict. CLI Example: .. code-block:: bash salt '*' event.fire '{"data":"my event data"}' 'tag'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L101-L128
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
# -*- coding: utf-8 -*- ''' Use the :ref:`Salt Event System <events>` to fire events from the master to the minion and vice-versa. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import collections import logging import os import sys import traceback # Import salt lib...
saltstack/salt
salt/modules/event.py
send
python
def send(tag, data=None, preload=None, with_env=False, with_grains=False, with_pillar=False, with_env_opts=False, timeout=60, **kwargs): ''' Send an event to the Salt Master .. versionadded:: 2014.7.0 :param tag: A tag to give the event. ...
Send an event to the Salt Master .. versionadded:: 2014.7.0 :param tag: A tag to give the event. Use slashes to create a namespace for related events. E.g., ``myco/build/buildserver1/start``, ``myco/build/buildserver1/success``, ``myco/build/buildserver1/failure``. :param data: A ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/event.py#L131-L247
[ "def fire(data, tag, timeout=None):\n '''\n Fire an event on the local minion event bus. Data must be formed as a dict.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' event.fire '{\"data\":\"my event data\"}' 'tag'\n '''\n if timeout is None:\n timeout = 60000\n else:\n ...
# -*- coding: utf-8 -*- ''' Use the :ref:`Salt Event System <events>` to fire events from the master to the minion and vice-versa. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import collections import logging import os import sys import traceback # Import salt lib...
saltstack/salt
salt/states/postgres_cluster.py
present
python
def present(version, name, port=None, encoding=None, locale=None, datadir=None, allow_group_access=None, data_checksums=None, wal_segsize=None ): ''' Ensure that the named cluster is present with the spec...
Ensure that the named cluster is present with the specified properties. For more information about all of these options see man pg_createcluster(1) version Version of the postgresql cluster name The name of the cluster port Cluster port encoding The character enco...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_cluster.py#L28-L114
null
# -*- coding: utf-8 -*- ''' Management of PostgreSQL clusters ================================= The postgres_cluster state module is used to manage PostgreSQL clusters. Clusters can be set as either absent or present .. code-block:: yaml create cluster 9.3 main: postgres_cluster.present: - name: ...
saltstack/salt
salt/states/postgres_cluster.py
absent
python
def absent(version, name): ''' Ensure that the named cluster is absent version Version of the postgresql server of the cluster to remove name The name of the cluster to remove .. versionadded:: 2015.XX ''' ret = {'name': name, 'changes': {}, ...
Ensure that the named cluster is absent version Version of the postgresql server of the cluster to remove name The name of the cluster to remove .. versionadded:: 2015.XX
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_cluster.py#L117-L151
null
# -*- coding: utf-8 -*- ''' Management of PostgreSQL clusters ================================= The postgres_cluster state module is used to manage PostgreSQL clusters. Clusters can be set as either absent or present .. code-block:: yaml create cluster 9.3 main: postgres_cluster.present: - name: ...
saltstack/salt
salt/returners/splunk.py
_send_splunk
python
def _send_splunk(event, index_override=None, sourcetype_override=None): ''' Send the results to Splunk. Requires the Splunk HTTP Event Collector running on port 8088. This is available on Splunk Enterprise version 6.3 or higher. ''' # Get Splunk Options opts = _get_options() log.info(st...
Send the results to Splunk. Requires the Splunk HTTP Event Collector running on port 8088. This is available on Splunk Enterprise version 6.3 or higher.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/splunk.py#L70-L104
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Send json response data to Splunk via the HTTP Event Collector Requires the following config values to be specified in config or pillar: .. code-block:: yaml splunk_http_forwarder: token: <splunk_http_forwarder_token> indexer: <hostname/IP of Splunk indexer> sourcety...
saltstack/salt
salt/output/dson.py
output
python
def output(data, **kwargs): # pylint: disable=unused-argument ''' Print the output data in JSON ''' try: dump_opts = {'indent': 4, 'default': repr} if 'output_indent' in __opts__: indent = __opts__.get('output_indent') sort_keys = False if indent =...
Print the output data in JSON
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/dson.py#L37-L74
null
# -*- coding: utf-8 -*- ''' Display return data in DSON format ================================== This outputter is intended for demonstration purposes. Information on the DSON spec can be found `here`__. .. __: http://vpzomtrrfrt.github.io/DSON/ This outputter requires `Dogeon`__ (installable via pip) .. __: https...
saltstack/salt
salt/states/serverdensity_device.py
_get_salt_params
python
def _get_salt_params(): ''' Try to get all sort of parameters for Server Density server info. NOTE: Missing publicDNS and publicIPs parameters. There might be way of getting them with salt-cloud. ''' all_stats = __salt__['status.all_status']() all_grains = __salt__['grains.items']() par...
Try to get all sort of parameters for Server Density server info. NOTE: Missing publicDNS and publicIPs parameters. There might be way of getting them with salt-cloud.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/serverdensity_device.py#L69-L95
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Monitor Server with Server Density ================================== .. versionadded:: 2014.7.0 `Server Density <https://www.serverdensity.com/>`_ Is a hosted monitoring service. .. warning:: This state module is beta. It might be changed later to include more or less automation...
saltstack/salt
salt/states/serverdensity_device.py
monitored
python
def monitored(name, group=None, salt_name=True, salt_params=True, agent_version=1, **params): ''' Device is monitored with Server Density. name Device name in Server Density. salt_name If ``True`` (default), takes the name from the ``id`` grain. If ``False``, the provided name ...
Device is monitored with Server Density. name Device name in Server Density. salt_name If ``True`` (default), takes the name from the ``id`` grain. If ``False``, the provided name is used. group Group name under with device will appear in Server Density dashboard. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/serverdensity_device.py#L98-L215
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _get_salt_params():\n '''\n Try to get all sort of parameters for Server Density server info.\n\n NOTE: Missing publicDNS and publicIPs parameters. There might be way of\n getting them with salt-cloud.\n '''\n all_stats = __salt__['...
# -*- coding: utf-8 -*- ''' Monitor Server with Server Density ================================== .. versionadded:: 2014.7.0 `Server Density <https://www.serverdensity.com/>`_ Is a hosted monitoring service. .. warning:: This state module is beta. It might be changed later to include more or less automation...
saltstack/salt
salt/queues/sqlite_queue.py
_conn
python
def _conn(queue): ''' Return an sqlite connection ''' queue_dir = __opts__['sqlite_queue_dir'] db = os.path.join(queue_dir, '{0}.db'.format(queue)) log.debug('Connecting to: %s', db) con = sqlite3.connect(db) tables = _list_tables(con) if queue not in tables: _create_table(c...
Return an sqlite connection
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L40-L52
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
_list_items
python
def _list_items(queue): ''' Private function to list contents of a queue ''' con = _conn(queue) with con: cur = con.cursor() cmd = 'SELECT name FROM {0}'.format(queue) log.debug('SQL Query: %s', cmd) cur.execute(cmd) contents = cur.fetchall() return conten...
Private function to list contents of a queue
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L75-L86
[ "def _conn(queue):\n '''\n Return an sqlite connection\n '''\n queue_dir = __opts__['sqlite_queue_dir']\n db = os.path.join(queue_dir, '{0}.db'.format(queue))\n log.debug('Connecting to: %s', db)\n\n con = sqlite3.connect(db)\n tables = _list_tables(con)\n if queue not in tables:\n ...
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
_list_queues
python
def _list_queues(): ''' Return a list of sqlite databases in the queue_dir ''' queue_dir = __opts__['sqlite_queue_dir'] files = os.path.join(queue_dir, '*.db') paths = glob.glob(files) queues = [os.path.splitext(os.path.basename(item))[0] for item in paths] return queues
Return a list of sqlite databases in the queue_dir
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L89-L98
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
list_items
python
def list_items(queue): ''' List contents of a queue ''' itemstuple = _list_items(queue) items = [item[0] for item in itemstuple] return items
List contents of a queue
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L109-L115
[ "def _list_items(queue):\n '''\n Private function to list contents of a queue\n '''\n con = _conn(queue)\n with con:\n cur = con.cursor()\n cmd = 'SELECT name FROM {0}'.format(queue)\n log.debug('SQL Query: %s', cmd)\n cur.execute(cmd)\n contents = cur.fetchall()\n ...
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
_quote_escape
python
def _quote_escape(item): ''' Make sure single quotes are escaped properly in sqlite3 fashion. e.g.: ' becomes '' ''' rex_sqlquote = re.compile("'", re.M) return rex_sqlquote.sub("''", item)
Make sure single quotes are escaped properly in sqlite3 fashion. e.g.: ' becomes ''
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L126-L134
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
delete
python
def delete(queue, items): ''' Delete an item or items from a queue ''' con = _conn(queue) with con: cur = con.cursor() if isinstance(items, six.string_types): items = _quote_escape(items) cmd = """DELETE FROM {0} WHERE name = '{1}'""".format(queue, items) ...
Delete an item or items from a queue
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L179-L208
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/queues/sqlite_queue.py
pop
python
def pop(queue, quantity=1, is_runner=False): ''' Pop one or more or all items from the queue return them. ''' cmd = 'SELECT name FROM {0}'.format(queue) if quantity != 'all': try: quantity = int(quantity) except ValueError as exc: error_txt = ('Quantity must b...
Pop one or more or all items from the queue return them.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/sqlite_queue.py#L211-L244
[ "def _conn(queue):\n '''\n Return an sqlite connection\n '''\n queue_dir = __opts__['sqlite_queue_dir']\n db = os.path.join(queue_dir, '{0}.db'.format(queue))\n log.debug('Connecting to: %s', db)\n\n con = sqlite3.connect(db)\n tables = _list_tables(con)\n if queue not in tables:\n ...
# -*- coding: utf-8 -*- ''' .. versionadded:: 2014.7.0 This is the default local master event queue built on sqlite. By default, an sqlite3 database file is created in the `sqlite_queue_dir` which is found at:: /var/cache/salt/master/queues It's possible to store the sqlite3 database files by setting `sqlite_qu...
saltstack/salt
salt/modules/boto_sns.py
get_all_topics
python
def get_all_topics(region=None, key=None, keyid=None, profile=None): ''' Returns a list of the all topics.. CLI example:: salt myminion boto_sns.get_all_topics ''' cache_key = _cache_get_key() try: return __context__[cache_key] except KeyError: pass conn = _get...
Returns a list of the all topics.. CLI example:: salt myminion boto_sns.get_all_topics
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L78-L99
[ "def _cache_get_key():\n return 'boto_sns.topics_cache'\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
exists
python
def exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if an SNS topic exists. CLI example:: salt myminion boto_sns.exists mytopic region=us-east-1 ''' topics = get_all_topics(region=region, key=key, keyid=keyid, profile=profile) ...
Check to see if an SNS topic exists. CLI example:: salt myminion boto_sns.exists mytopic region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L102-L115
[ "def get_all_topics(region=None, key=None, keyid=None, profile=None):\n '''\n Returns a list of the all topics..\n\n CLI example::\n\n salt myminion boto_sns.get_all_topics\n '''\n cache_key = _cache_get_key()\n try:\n return __context__[cache_key]\n except KeyError:\n pass...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
create
python
def create(name, region=None, key=None, keyid=None, profile=None): ''' Create an SNS topic. CLI example to create a topic:: salt myminion boto_sns.create mytopic region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) conn.create_topic(name) log....
Create an SNS topic. CLI example to create a topic:: salt myminion boto_sns.create mytopic region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L118-L130
[ "def _invalidate_cache():\n try:\n del __context__[_cache_get_key()]\n except KeyError:\n pass\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
delete
python
def delete(name, region=None, key=None, keyid=None, profile=None): ''' Delete an SNS topic. CLI example to delete a topic:: salt myminion boto_sns.delete mytopic region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) conn.delete_topic(get_arn(name, ...
Delete an SNS topic. CLI example to delete a topic:: salt myminion boto_sns.delete mytopic region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L133-L145
[ "def _invalidate_cache():\n try:\n del __context__[_cache_get_key()]\n except KeyError:\n pass\n", "def get_arn(name, region=None, key=None, keyid=None, profile=None):\n '''\n Returns the full ARN for a given topic name.\n\n CLI example::\n\n salt myminion boto_sns.get_arn myto...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
get_all_subscriptions_by_topic
python
def get_all_subscriptions_by_topic(name, region=None, key=None, keyid=None, profile=None): ''' Get list of all subscriptions to a specific topic. CLI example to delete a topic:: salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1 ''' cache_key = _subscriptions_ca...
Get list of all subscriptions to a specific topic. CLI example to delete a topic:: salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L148-L165
[ "def get_arn(name, region=None, key=None, keyid=None, profile=None):\n '''\n Returns the full ARN for a given topic name.\n\n CLI example::\n\n salt myminion boto_sns.get_arn mytopic\n '''\n if name.startswith('arn:aws:sns:'):\n return name\n\n account_id = __salt__['boto_iam.get_acc...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
subscribe
python
def subscribe(topic, protocol, endpoint, region=None, key=None, keyid=None, profile=None): ''' Subscribe to a Topic. CLI example to delete a topic:: salt myminion boto_sns.subscribe mytopic https https://www.example.com/sns-endpoint region=us-east-1 ''' conn = _get_conn(region=region, key=...
Subscribe to a Topic. CLI example to delete a topic:: salt myminion boto_sns.subscribe mytopic https https://www.example.com/sns-endpoint region=us-east-1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L168-L183
[ "def get_arn(name, region=None, key=None, keyid=None, profile=None):\n '''\n Returns the full ARN for a given topic name.\n\n CLI example::\n\n salt myminion boto_sns.get_arn mytopic\n '''\n if name.startswith('arn:aws:sns:'):\n return name\n\n account_id = __salt__['boto_iam.get_acc...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
unsubscribe
python
def unsubscribe(topic, subscription_arn, region=None, key=None, keyid=None, profile=None): ''' Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto_sns.unsubscribe my_topic my_subscription_arn region=us-east-1 .. versionadded:: 2016.11.0...
Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto_sns.unsubscribe my_topic my_subscription_arn region=us-east-1 .. versionadded:: 2016.11.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L186-L211
[ "def _subscriptions_cache_key(name):\n return '{0}_{1}_subscriptions'.format(_cache_get_key(), name)\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/modules/boto_sns.py
get_arn
python
def get_arn(name, region=None, key=None, keyid=None, profile=None): ''' Returns the full ARN for a given topic name. CLI example:: salt myminion boto_sns.get_arn mytopic ''' if name.startswith('arn:aws:sns:'): return name account_id = __salt__['boto_iam.get_account_id']( ...
Returns the full ARN for a given topic name. CLI example:: salt myminion boto_sns.get_arn mytopic
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_sns.py#L214-L229
[ "def _get_region(region=None, profile=None):\n if profile and 'region' in profile:\n return profile['region']\n if not region and __salt__['config.option'](profile):\n _profile = __salt__['config.option'](profile)\n region = _profile.get('region', None)\n if not region and __salt__['co...
# -*- coding: utf-8 -*- ''' Connection module for Amazon SNS :configuration: This module accepts explicit sns 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 further configuration is neces...
saltstack/salt
salt/utils/asynchronous.py
current_ioloop
python
def current_ioloop(io_loop): ''' A context manager that will set the current ioloop to io_loop for the context ''' orig_loop = tornado.ioloop.IOLoop.current() io_loop.make_current() try: yield finally: orig_loop.make_current()
A context manager that will set the current ioloop to io_loop for the context
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/asynchronous.py#L15-L24
null
# -*- coding: utf-8 -*- ''' Helpers/utils for working with tornado asynchronous stuff ''' from __future__ import absolute_import, print_function, unicode_literals import tornado.ioloop import tornado.concurrent import contextlib from salt.utils import zeromq @contextlib.contextmanager class SyncWrapper(object): ...
saltstack/salt
salt/modules/saltutil.py
_get_top_file_envs
python
def _get_top_file_envs(): ''' Get all environments from the top file ''' try: return __context__['saltutil._top_file_envs'] except KeyError: try: st_ = salt.state.HighState(__opts__, initial_pillar=__pillar__) top = st_.g...
Get all environments from the top file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L78-L98
null
# -*- coding: utf-8 -*- ''' The Saltutil module is used to manage the state of the salt minion itself. It is used to manage minion modules as well as automate updates to the salt minion. :depends: - esky Python module for update functionality ''' from __future__ import absolute_import, print_function, unicode_litera...