INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Get an EC2 instance attribute.
def get_attribute(attribute, instance_name=None, instance_id=None, region=None, key=None, keyid=None, profile=None, filters=None): ''' Get an EC2 instance attribute. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_attribute sourceDestCheck instance_name=my_insta...
Set an EC2 instance attribute. Returns whether the operation succeeded or not.
def set_attribute(attribute, attribute_value, instance_name=None, instance_id=None, region=None, key=None, keyid=None, profile=None, filters=None): ''' Set an EC2 instance attribute. Returns whether the operation succeeded or not. CLI Example: .. code-block:: bash salt m...
Get an Elastic Network Interface id from its name tag.
def get_network_interface_id(name, region=None, key=None, keyid=None, profile=None): ''' Get an Elastic Network Interface id from its name tag. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_ec2.get_network_interface_id name=m...
Get an Elastic Network Interface.
def get_network_interface(name=None, network_interface_id=None, region=None, key=None, keyid=None, profile=None): ''' Get an Elastic Network Interface. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_ec2.get_network_interface name...
Create an Elastic Network Interface.
def create_network_interface(name, subnet_id=None, subnet_name=None, private_ip_address=None, description=None, groups=None, region=None, key=None, keyid=None, profile=None): ''' Create an Elastic Network Interface. .. v...
Create an Elastic Network Interface.
def delete_network_interface( name=None, network_interface_id=None, region=None, key=None, keyid=None, profile=None): ''' Create an Elastic Network Interface. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt myminion boto_ec2.create_network_interface my_e...
Attach an Elastic Network Interface.
def attach_network_interface(device_index, name=None, network_interface_id=None, instance_name=None, instance_id=None, region=None, key=None, keyid=None, profile=None): ''' Attach an Elastic Network Interface. .. versionadded:: 2016.3.0 CLI Exa...
Modify an attribute of an Elastic Network Interface.
def modify_network_interface_attribute( name=None, network_interface_id=None, attr=None, value=None, region=None, key=None, keyid=None, profile=None): ''' Modify an attribute of an Elastic Network Interface. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash sal...
Get a list of all EBS volumes optionally filtered by provided filters param
def get_all_volumes(volume_ids=None, filters=None, return_objs=False, region=None, key=None, keyid=None, profile=None): ''' Get a list of all EBS volumes, optionally filtered by provided 'filters' param .. versionadded:: 2016.11.0 volume_ids (list) - Optional list of volume...
.. versionadded:: 2016. 11. 0
def set_volumes_tags(tag_maps, authoritative=False, dry_run=False, region=None, key=None, keyid=None, profile=None): ''' .. versionadded:: 2016.11.0 tag_maps (list) List of dicts of filters and tags, where 'filters' is a dict suitable for passing to the 'filters' argumen...
Describe all tags matching the filter criteria or all tags in the account otherwise.
def get_all_tags(filters=None, region=None, key=None, keyid=None, profile=None): ''' Describe all tags matching the filter criteria, or all tags in the account otherwise. .. versionadded:: 2018.3.0 filters (dict) - Additional constraints on which volumes to return. Note that valid filters var...
Create new metadata tags for the specified resource ids.
def create_tags(resource_ids, tags, region=None, key=None, keyid=None, profile=None): ''' Create new metadata tags for the specified resource ids. .. versionadded:: 2016.11.0 resource_ids (string) or (list) – List of resource IDs. A plain string will be converted to a list of one element. ...
Detach an EBS volume from an EC2 instance.
def detach_volume(volume_id, instance_id=None, device=None, force=False, wait_for_detachement=False, region=None, key=None, keyid=None, profile=None): ''' Detach an EBS volume from an EC2 instance. .. versionadded:: 2016.11.0 volume_id (string) – The ID of the EBS volume to b...
Detach an EBS volume from an EC2 instance.
def delete_volume(volume_id, instance_id=None, device=None, force=False, region=None, key=None, keyid=None, profile=None): ''' Detach an EBS volume from an EC2 instance. .. versionadded:: 2016.11.0 volume_id (string) – The ID of the EBS volume to be deleted. force ...
Attach an EBS volume to an EC2 instance...
def attach_volume(volume_id, instance_id, device, region=None, key=None, keyid=None, profile=None): ''' Attach an EBS volume to an EC2 instance. .. volume_id (string) – The ID of the EBS volume to be attached. instance_id (string) – The ID of the EC2 instance to at...
Create an EBS volume to an availability zone.
def create_volume(zone_name, size=None, snapshot_id=None, volume_type=None, iops=None, encrypted=False, kms_key_id=None, wait_for_creation=False, region=None, key=None, keyid=None, profile=None): ''' Create an EBS volume to an availability zone. .. zone_name ...
Returns the long hash of a given identifier ( hash branch tag HEAD etc )
def revision(cwd, rev='tip', short=False, user=None): ''' Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc) cwd The path to the Mercurial repository rev: tip The revision short: False Return an abbreviated commit hash user : None Run h...
Mimic git describe and return an identifier for the given revision
def describe(cwd, rev='tip', user=None): ''' Mimic git describe and return an identifier for the given revision cwd The path to the Mercurial repository rev: tip The path to the archive tarball user : None Run hg as a user other than what the minion runs as CLI Exampl...
Export a tarball from the repository
def archive(cwd, output, rev='tip', fmt=None, prefix=None, user=None): ''' Export a tarball from the repository cwd The path to the Mercurial repository output The path to the archive tarball rev: tip The revision to create an archive from fmt: None Format of ...
Perform a pull on the given repository
def pull(cwd, opts=None, user=None, identity=None, repository=None): ''' Perform a pull on the given repository cwd The path to the Mercurial repository repository : None Perform pull from the repository different from .hg/hgrc:[paths]:default opts : None Any additional op...
Update to a given revision
def update(cwd, rev, force=False, user=None): ''' Update to a given revision cwd The path to the Mercurial repository rev The revision to update to force : False Force an update user : None Run hg as a user other than what the minion runs as CLI Example: ...
Show changed files of the given repository
def status(cwd, opts=None, user=None): ''' Show changed files of the given repository cwd The path to the Mercurial repository opts : None Any additional options to add to the command line user : None Run hg as a user other than what the minion runs as CLI Example: ...
Validate the beacon configuration
def validate(config): ''' Validate the beacon configuration ''' if not isinstance(config, list): return False, ('Configuration for network_settings ' 'beacon must be a list.') else: _config = {} list(map(_config.update, config)) interfaces = _c...
Return a dictionary with a copy of each interface attributes in ATTRS
def _copy_interfaces_info(interfaces): ''' Return a dictionary with a copy of each interface attributes in ATTRS ''' ret = {} for interface in interfaces: _interface_attrs_cpy = set() for attr in ATTRS: if attr in interfaces[interface]: attr_dict = Hashab...
Watch for changes on network settings
def beacon(config): ''' Watch for changes on network settings By default, the beacon will emit when there is a value change on one of the settings on watch. The config also support the onvalue parameter for each setting, which instruct the beacon to only emit if the setting changed to the value...
Set a key/ value pair in memcached
def set_(key, value, profile=None): ''' Set a key/value pair in memcached ''' conn = salt.utils.memcached.get_conn(profile) time = profile.get('expire', DEFAULT_EXPIRATION) return salt.utils.memcached.set_(conn, key, value, time=time)
Get a value from memcached
def get(key, profile=None): ''' Get a value from memcached ''' conn = salt.utils.memcached.get_conn(profile) return salt.utils.memcached.get(conn, key)
Manages proxy settings for this mininon
def managed(name, port, services=None, user=None, password=None, bypass_domains=None, network_service='Ethernet'): ''' Manages proxy settings for this mininon name The proxy server to use port The port used by the proxy server services A list of the services that should us...
Create default archive name.
def _get_archive_name(self, archname=None): ''' Create default archive name. :return: ''' archname = re.sub('[^a-z0-9]', '', (archname or '').lower()) or 'support' for grain in ['fqdn', 'host', 'localhost', 'nodename']: host = __grains__.get(grain) ...
Get list of existing archives.: return:
def archives(self): ''' Get list of existing archives. :return: ''' arc_files = [] tmpdir = tempfile.gettempdir() for filename in os.listdir(tmpdir): mtc = re.match(r'\w+-\w+-\d+-\d+\.bz2', filename) if mtc and len(filename) == mtc.span()[-...
Get the last available archive: return:
def last_archive(self): ''' Get the last available archive :return: ''' archives = {} for archive in self.archives(): archives[int(archive.split('.')[0].split('-')[-1])] = archive return archives and archives[max(archives)] or None
Delete archives: return:
def delete_archives(self, *archives): ''' Delete archives :return: ''' # Remove paths _archives = [] for archive in archives: _archives.append(os.path.basename(archive)) archives = _archives[:] ret = {'files': {}, 'errors': {}} ...
Format stats of the sync output.
def format_sync_stats(self, cnt): ''' Format stats of the sync output. :param cnt: :return: ''' stats = salt.utils.odict.OrderedDict() if cnt.get('retcode') == salt.defaults.exitcodes.EX_OK: for line in cnt.get('stdout', '').split(os.linesep): ...
Sync the latest archive to the host on given location.
def sync(self, group, name=None, host=None, location=None, move=False, all=False): ''' Sync the latest archive to the host on given location. CLI Example: .. code-block:: bash salt '*' support.sync group=test salt '*' support.sync group=test name=/tmp/myspecial...
Run Salt Support on the minion.
def run(self, profile='default', pillar=None, archive=None, output='nested'): ''' Run Salt Support on the minion. profile Set available profile name. Default is "default". pillar Set available profile from the pillars. archive Override archi...
Return the next iteration by popping chunk_size from the left and appending chunk_size to the right if there s info on the file left to be read.
def next(self): ''' Return the next iteration by popping `chunk_size` from the left and appending `chunk_size` to the right if there's info on the file left to be read. ''' if self.__buffered is None: # Use floor division to force multiplier to an integer ...
Check vmware/ vcenter for all data
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 **kwargs): ''' Check vmware/vcenter for all data ''' vmware_pillar = {} host = None username = None password = None property_types = [] property_name = 'name' protocol = None port = None ...
helper function to recurse through a vim object and attempt to return all child objects
def _recurse_config_to_dict(t_data): ''' helper function to recurse through a vim object and attempt to return all child objects ''' if not isinstance(t_data, type(None)): if isinstance(t_data, list): t_list = [] for i in t_data: t_list.append(_recurse_con...
helper function to crawl an attribute specified for retrieval
def _crawl_attribute(this_data, this_attr): ''' helper function to crawl an attribute specified for retrieval ''' if isinstance(this_data, list): t_list = [] for d in this_data: t_list.append(_crawl_attribute(d, this_attr)) return t_list else: if isinstanc...
helper function to serialize some objects for prettier return
def _serializer(obj): ''' helper function to serialize some objects for prettier return ''' import datetime if isinstance(obj, datetime.datetime): if obj.utcoffset() is not None: obj = obj - obj.utcoffset() return obj.__str__() return obj
Issue an SQL query to sqlite3 ( with no return data ) usually used to modify the database in some way ( insert delete create etc )
def modify(db=None, sql=None): ''' Issue an SQL query to sqlite3 (with no return data), usually used to modify the database in some way (insert, delete, create, etc) CLI Example: .. code-block:: bash salt '*' sqlite3.modify /root/test.db 'CREATE TABLE test(id INT, testdata TEXT);' '''...
Retrieve data from an sqlite3 db ( returns all rows be careful! )
def fetch(db=None, sql=None): ''' Retrieve data from an sqlite3 db (returns all rows, be careful!) CLI Example: .. code-block:: bash salt '*' sqlite3.fetch /root/test.db 'SELECT * FROM test;' ''' cur = _connect(db) if not cur: return False cur.execute(sql) rows =...
Show all tables in the database
def tables(db=None): ''' Show all tables in the database CLI Example: .. code-block:: bash salt '*' sqlite3.tables /root/test.db ''' cur = _connect(db) if not cur: return False cur.execute( "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;" ...
Show all indices in the database
def indices(db=None): ''' Show all indices in the database CLI Example: .. code-block:: bash salt '*' sqlite3.indices /root/test.db ''' cur = _connect(db) if not cur: return False cur.execute( "SELECT name FROM sqlite_master WHERE type='index' ORDER BY name;"...
Return the targets from the Salt Masters minion cache. All targets and matchers are supported.
def targets(tgt, tgt_type='glob', **kwargs): # pylint: disable=W0613 ''' Return the targets from the Salt Masters' minion cache. All targets and matchers are supported. The resulting roster can be configured using ``roster_order`` and ``roster_default``. ''' minions = salt.utils.minions.CkMini...
return the location of the GPG key directory
def _get_key_dir(): ''' return the location of the GPG key directory ''' gpg_keydir = None if 'config.get' in __salt__: gpg_keydir = __salt__['config.get']('gpg_keydir') if not gpg_keydir: gpg_keydir = __opts__.get( 'gpg_keydir', os.path.join( ...
Given a block of ciphertext as a string and a gpg object try to decrypt the cipher and return the decrypted string. If the cipher cannot be decrypted log the error and return the ciphertext back out.
def _decrypt_ciphertext(cipher): ''' Given a block of ciphertext as a string, and a gpg object, try to decrypt the cipher and return the decrypted string. If the cipher cannot be decrypted, log the error, and return the ciphertext back out. ''' try: cipher = salt.utils.stringutils.to_uni...
Recursively try to decrypt any object. If the object is a six. string_types ( string or unicode ) and it contains a valid GPG header decrypt it otherwise keep going until a string is found.
def _decrypt_object(obj, translate_newlines=False): ''' Recursively try to decrypt any object. If the object is a six.string_types (string or unicode), and it contains a valid GPG header, decrypt it, otherwise keep going until a string is found. ''' if salt.utils.stringio.is_readable(obj): ...
Create a gpg object given a gpg_keydir and then use it to try to decrypt the data to be rendered.
def render(gpg_data, saltenv='base', sls='', argline='', **kwargs): ''' Create a gpg object given a gpg_keydir, and then use it to try to decrypt the data to be rendered. ''' if not _get_gpg_exec(): raise SaltRenderError('GPG unavailable') log.debug('Reading GPG keys from: %s', _get_key_...
Validate the beacon configuration
def validate(config): ''' Validate the beacon configuration ''' if not isinstance(config, list): return False, ('Configuration for telegram_bot_msg ' 'beacon must be a list.') _config = {} list(map(_config.update, config)) if not all(_config.get(required_conf...
Emit a dict with a key msgs whose value is a list of messages sent to the configured bot by one of the allowed usernames.
def beacon(config): ''' Emit a dict with a key "msgs" whose value is a list of messages sent to the configured bot by one of the allowed usernames. .. code-block:: yaml beacons: telegram_bot_msg: - token: "<bot access token>" - accept_from: - "<v...
Look up top data in Cobbler for a minion.
def top(**kwargs): ''' Look up top data in Cobbler for a minion. ''' url = __opts__['cobbler.url'] user = __opts__['cobbler.user'] password = __opts__['cobbler.password'] minion_id = kwargs['opts']['id'] log.info("Querying cobbler for information for %r", minion_id) try: se...
Returns statistics about the locate database
def stats(): ''' Returns statistics about the locate database CLI Example: .. code-block:: bash salt '*' locate.stats ''' ret = {} cmd = 'locate -S' out = __salt__['cmd.run'](cmd).splitlines() for line in out: comps = line.strip().split() if line.startswith...
Performs a file lookup. Valid options ( and their defaults ) are::
def locate(pattern, database='', limit=0, **kwargs): ''' Performs a file lookup. Valid options (and their defaults) are:: basename=False count=False existing=False follow=True ignore=False nofollow=False wholename=True regex=False database...
Initalizes the LXD Daemon as LXD doesn t tell if its initialized we touch the the done_file and check if it exist.
def init(name, storage_backend='dir', trust_password=None, network_address=None, network_port=None, storage_create_device=None, storage_create_loop=None, storage_pool=None, done_file='%SALT_CONFIG_DIR%/lxd_initialized'): ''' Initalizes the LXD Daemon, as LXD doesn't tell if its initia...
Manage a LXD Server config setting.
def config_managed(name, value, force_password=False): ''' Manage a LXD Server config setting. name : The name of the config key. value : Its value. force_password : False Set this to True if you want to set the password on every run. As we can't retrieve the pass...
Authenticate with a remote peer.
def authenticate(name, remote_addr, password, cert, key, verify_cert=True): ''' Authenticate with a remote peer. .. notes: This function makes every time you run this a connection to remote_addr, you better call this only once. remote_addr : An URL to a remote Server, you also...
Request power state change
def boot_device(name='default', **kwargs): ''' Request power state change name = ``default`` * network -- Request network boot * hd -- Boot from hard drive * safe -- Boot from hard drive, requesting 'safe mode' * optical -- boot from CD/DVD/BD drive * setup -- Boot i...
Request power state change
def power(name='power_on', wait=300, **kwargs): ''' Request power state change name Ensure power state one of: * power_on -- system turn on * power_off -- system turn off (without waiting for OS) * shutdown -- request OS proper shutdown * reset -- res...
Ensure IPMI user and user privileges.
def user_present(name, uid, password, channel=14, callback=False, link_auth=True, ipmi_msg=True, privilege_level='administrator', **kwargs): ''' Ensure IPMI user and user privileges. name name of user (limit 16 bytes) uid user id number (1 to 7) password us...
Remove user Delete all user ( uid ) records having the matching name.
def user_absent(name, channel=14, **kwargs): ''' Remove user Delete all user (uid) records having the matching name. name string name of user to delete channel channel to remove user access from defaults to 14 for auto. kwargs - api_host=localhost - api_user=ad...
Helper function to search for minions in master caches If greedy return accepted minions that matched by the condition or absent in the cache. If not greedy return the only minions have cache data and matched by the condition.
def mmatch(expr, delimiter, greedy, search_type, regex_match=False, exact_match=False, opts=None): ''' Helper function to search for minions in master caches If 'greedy' return accepted minions that matched by the condition or absent in the c...
Ensure the launch configuration exists.
def present( name, image_id, key_name=None, vpc_id=None, vpc_name=None, security_groups=None, user_data=None, cloud_init=None, instance_type='m1.small', kernel_id=None, ramdisk_id=None, block_device_mappings=None, de...
Return the configuration read from the master configuration file or directory
def _get_spacewalk_configuration(spacewalk_url=''): ''' Return the configuration read from the master configuration file or directory ''' spacewalk_config = __opts__['spacewalk'] if 'spacewalk' in __opts__ else None if spacewalk_config: try: for spacewalk_server, service_con...
Return the client object and session key for the client
def _get_client_and_key(url, user, password, verbose=0): ''' Return the client object and session key for the client ''' session = {} session['client'] = six.moves.xmlrpc_client.Server(url, verbose=verbose, use_datetime=True) session['key'] = session['client'].auth.login(user, password) ret...
Get session and key
def _get_session(server): ''' Get session and key ''' if server in _sessions: return _sessions[server] config = _get_spacewalk_configuration(server) if not config: raise Exception('No config for \'{0}\' found on master'.format(server)) session = _get_client_and_key(config['...
Call the Spacewalk xmlrpc api.
def api(server, command, *args, **kwargs): ''' Call the Spacewalk xmlrpc api. CLI Example: .. code-block:: bash salt-run spacewalk.api spacewalk01.domain.com systemgroup.create MyGroup Description salt-run spacewalk.api spacewalk01.domain.com systemgroup.create arguments='["MyGroup", ...
Add server groups to a activation key
def addGroupsToKey(server, activation_key, groups): ''' Add server groups to a activation key CLI Example: .. code-block:: bash salt-run spacewalk.addGroupsToKey spacewalk01.domain.com 1-my-key '[group1, group2]' ''' try: client, key = _get_session(server) except Exceptio...
Delete all server groups from Spacewalk
def deleteAllGroups(server): ''' Delete all server groups from Spacewalk ''' try: client, key = _get_session(server) except Exception as exc: err_msg = 'Exception raised when connecting to spacewalk server ({0}): {1}'.format(server, exc) log.error(err_msg) return {'E...
Delete all systems from Spacewalk
def deleteAllSystems(server): ''' Delete all systems from Spacewalk CLI Example: .. code-block:: bash salt-run spacewalk.deleteAllSystems spacewalk01.domain.com ''' try: client, key = _get_session(server) except Exception as exc: err_msg = 'Exception raised when c...
Delete all activation keys from Spacewalk
def deleteAllActivationKeys(server): ''' Delete all activation keys from Spacewalk CLI Example: .. code-block:: bash salt-run spacewalk.deleteAllActivationKeys spacewalk01.domain.com ''' try: client, key = _get_session(server) except Exception as exc: err_msg = 'E...
Unregister specified server from Spacewalk
def unregister(name, server_url): ''' Unregister specified server from Spacewalk CLI Example: .. code-block:: bash salt-run spacewalk.unregister my-test-vm spacewalk01.domain.com ''' try: client, key = _get_session(server_url) except Exception as exc: err_msg = 'E...
If you need to enhance what modify_cache_cluster () considers when deciding what is to be ( or can be ) updated add it to modifiable below. It s a dict mapping the param as used in modify_cache_cluster () to that in describe_cache_clusters (). Any data fiddlery that needs to be done to make the mappings meaningful shou...
def _diff_cache_cluster(current, desired): ''' If you need to enhance what modify_cache_cluster() considers when deciding what is to be (or can be) updated, add it to 'modifiable' below. It's a dict mapping the param as used in modify_cache_cluster() to that in describe_cache_clusters(). Any data fidd...
Ensure a given cache cluster exists.
def cache_cluster_present(name, wait=900, security_groups=None, region=None, key=None, keyid=None, profile=None, **args): ''' Ensure a given cache cluster exists. name Name of the cache cluster (cache cluster id). wait Integer describing how long, in seconds, ...
If you need to enhance what modify_replication_group () considers when deciding what is to be ( or can be ) updated add it to modifiable below. It s a dict mapping the param as used in modify_replication_group () to that in describe_replication_groups (). Any data fiddlery that needs to be done to make the mappings mea...
def _diff_replication_group(current, desired): ''' If you need to enhance what modify_replication_group() considers when deciding what is to be (or can be) updated, add it to 'modifiable' below. It's a dict mapping the param as used in modify_replication_group() to that in describe_replication_groups()...
If you need to enhance what modify_cache_subnet_group () considers when deciding what is to be ( or can be ) updated add it to modifiable below. It s a dict mapping the param as used in modify_cache_subnet_group () to that in describe_cache_subnet_group (). Any data fiddlery that needs to be done to make the mappings m...
def _diff_cache_subnet_group(current, desired): ''' If you need to enhance what modify_cache_subnet_group() considers when deciding what is to be (or can be) updated, add it to 'modifiable' below. It's a dict mapping the param as used in modify_cache_subnet_group() to that in describe_cache_subnet_grou...
Ensure cache subnet group exists.
def cache_subnet_group_present(name, subnets=None, region=None, key=None, keyid=None, profile=None, **args): ''' Ensure cache subnet group exists. name A name for the cache subnet group. This value is stored as a lowercase string. Constraints: Must contain no...
Ensure a given cache subnet group is deleted.
def cache_subnet_group_absent(name, region=None, key=None, keyid=None, profile=None, **args): ''' Ensure a given cache subnet group is deleted. name Name of the cache subnet group. CacheSubnetGroupName A name for the cache subnet group. Note: In general this parameter is not n...
Ensure cache parameter group exists.
def cache_parameter_group_present(name, region=None, key=None, keyid=None, profile=None, **args): ''' Ensure cache parameter group exists. name A name for the cache parameter group. CacheParameterGroupName A name for the cache parameter group. Note: In general this parameter i...
Given identity pool name ( or optionally a pool_id and name will be ignored ) find and return list of matching identity pool id s.
def _find_identity_pool_ids(name, pool_id, conn): ''' Given identity pool name (or optionally a pool_id and name will be ignored), find and return list of matching identity pool id's. ''' ids = [] if pool_id is None: for pools in __utils__['boto3.paged_call'](conn.list_identity_pools, ...
Given an identity pool name ( optionally if an identity pool id is given the given name will be ignored )
def describe_identity_pools(IdentityPoolName, IdentityPoolId=None, region=None, key=None, keyid=None, profile=None): ''' Given an identity pool name, (optionally if an identity pool id is given, the given name will be ignored) Returns a list of matched identity pool name's pool properti...
Creates a new identity pool. All parameters except for IdentityPoolName is optional. SupportedLoginProviders should be a dictionary mapping provider names to provider app IDs. OpenIdConnectProviderARNs should be a list of OpenID Connect provider ARNs.
def create_identity_pool(IdentityPoolName, AllowUnauthenticatedIdentities=False, SupportedLoginProviders=None, DeveloperProviderName=None, OpenIdConnectProviderARNs=None, region=None, key=None, k...
Given an identity pool name ( optionally if an identity pool id is given the given name will be ignored )
def delete_identity_pools(IdentityPoolName, IdentityPoolId=None, region=None, key=None, keyid=None, profile=None): ''' Given an identity pool name, (optionally if an identity pool id is given, the given name will be ignored) Deletes all identity pools matching the given name, or the spec...
Helper function to turn a name into an arn string returns None if not able to resolve
def _get_role_arn(name, **conn_params): ''' Helper function to turn a name into an arn string, returns None if not able to resolve ''' if name.startswith('arn:aws:iam'): return name role = __salt__['boto_iam.describe_role'](name, **conn_params) rolearn = role.get('arn') if role else ...
Given an identity pool id set the given AuthenticatedRole and UnauthenticatedRole ( the Role can be an iam arn or a role name ) If AuthenticatedRole or UnauthenticatedRole is not given the authenticated and/ or the unauthenticated role associated previously with the pool will be cleared.
def set_identity_pool_roles(IdentityPoolId, AuthenticatedRole=None, UnauthenticatedRole=None, region=None, key=None, keyid=None, profile=None): ''' Given an identity pool id, set the given AuthenticatedRole and UnauthenticatedRole (the Role can be an iam arn, or a role name) If AuthenticatedRole or...
Updates the given IdentityPoolId s properties. All parameters except for IdentityPoolId is optional. SupportedLoginProviders should be a dictionary mapping provider names to provider app IDs. OpenIdConnectProviderARNs should be a list of OpenID Connect provider ARNs.
def update_identity_pool(IdentityPoolId, IdentityPoolName=None, AllowUnauthenticatedIdentities=False, SupportedLoginProviders=None, DeveloperProviderName=None, OpenIdConnectProviderARNs=None, ...
Filter out the result: True + no changes data
def _filter_running(runnings): ''' Filter out the result: True + no changes data ''' ret = dict((tag, value) for tag, value in six.iteritems(runnings) if not value['result'] or value['changes']) return ret
Set the return code based on the data back from the state system
def _set_retcode(ret, highstate=None): ''' Set the return code based on the data back from the state system ''' # Set default retcode to 0 __context__['retcode'] = salt.defaults.exitcodes.EX_OK if isinstance(ret, list): __context__['retcode'] = salt.defaults.exitcodes.EX_STATE_COMPILER...
Create a snapper pre snapshot
def _snapper_pre(opts, jid): ''' Create a snapper pre snapshot ''' snapper_pre = None try: if not opts['test'] and __opts__.get('snapper_states'): # Run the snapper pre snapshot snapper_pre = __salt__['snapper.create_snapshot']( config=__opts__.get...
Create the post states snapshot
def _snapper_post(opts, jid, pre_num): ''' Create the post states snapshot ''' try: if not opts['test'] and __opts__.get('snapper_states') and pre_num: # Run the snapper pre snapshot __salt__['snapper.create_snapshot']( config=__opts__.get('snapper_sta...
Return the pause information for a given jid
def _get_pause(jid, state_id=None): ''' Return the pause information for a given jid ''' pause_dir = os.path.join(__opts__['cachedir'], 'state_pause') pause_path = os.path.join(pause_dir, jid) if not os.path.exists(pause_dir): try: os.makedirs(pause_dir) except OSErro...
Get a report on all of the currently paused state runs and pause run settings. Optionally send in a jid if you only desire to see a single pause data set.
def get_pauses(jid=None): ''' Get a report on all of the currently paused state runs and pause run settings. Optionally send in a jid if you only desire to see a single pause data set. ''' ret = {} active = __salt__['saltutil.is_running']('state.*') pause_dir = os.path.join(__opts__[...
Set up a state run to die before executing the given state id this instructs a running state to safely exit at a given state id. This needs to pass in the jid of the running state. If a state_id is not passed then the jid referenced will be safely exited at the beginning of the next state run.
def soft_kill(jid, state_id=None): ''' Set up a state run to die before executing the given state id, this instructs a running state to safely exit at a given state id. This needs to pass in the jid of the running state. If a state_id is not passed then the jid referenced will be safely exited a...
Set up a state id pause this instructs a running state to pause at a given state id. This needs to pass in the jid of the running state and can optionally pass in a duration in seconds. If a state_id is not passed then the jid referenced will be paused at the beginning of the next state run.
def pause(jid, state_id=None, duration=None): ''' Set up a state id pause, this instructs a running state to pause at a given state id. This needs to pass in the jid of the running state and can optionally pass in a duration in seconds. If a state_id is not passed then the jid referenced will be pau...
Remove a pause from a jid allowing it to continue. If the state_id is not specified then the a general pause will be resumed.
def resume(jid, state_id=None): ''' Remove a pause from a jid, allowing it to continue. If the state_id is not specified then the a general pause will be resumed. The given state_id is the id got a given state execution, so given a state that looks like this: .. code-block:: yaml vim:...
.. versionadded:: 2016. 11. 0
def orchestrate(mods, saltenv='base', test=None, exclude=None, pillar=None, pillarenv=None): ''' .. versionadded:: 2016.11.0 Execute the orchestrate runner from a masterless minion. .. seealso:: More Orchestrate documentat...
Utility function to queue the state run if requested and to check for conflicts in currently running states
def _check_queue(queue, kwargs): ''' Utility function to queue the state run if requested and to check for conflicts in currently running states ''' if queue: _wait(kwargs.get('__pub_jid')) else: conflict = running(concurrent=kwargs.get('concurrent', False)) if conflict: ...
Execute a single low data call
def low(data, queue=False, **kwargs): ''' Execute a single low data call This function is mostly intended for testing the state system and is not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.low '{"state": "pkg", "fun": "installed", "name": ...
Execute the compound calls stored in a single set of high data
def high(data, test=None, queue=False, **kwargs): ''' Execute the compound calls stored in a single set of high data This function is mostly intended for testing the state system and is not likely to be needed in everyday usage. CLI Example: .. code-block:: bash salt '*' state.high '...
Execute the information stored in a template file on the minion.
def template(tem, queue=False, **kwargs): ''' Execute the information stored in a template file on the minion. This function does not ask a master for a SLS file to render but instead directly processes the file at the provided path on the minion. CLI Example: .. code-block:: bash sa...