text
stringlengths
81
112k
Parse `target_expressing` splitting it into `engine`, `delimiter`, `pattern` - returns a dict def parse_target(target_expression): '''Parse `target_expressing` splitting it into `engine`, `delimiter`, `pattern` - returns a dict''' match = TARGET_REX.match(target_expression) if not match: ...
Get the grains/pillar for a specific minion. If minion is None, it will return the grains/pillar for the first minion it finds. Return value is a tuple of the minion ID, grains, and pillar def get_minion_data(minion, opts): ''' Get the grains/pillar for a specific minion. If minion is None, it w...
Recursively expand ``nodegroup`` from ``nodegroups``; ignore nodegroups in ``skip`` If a top-level (non-recursive) call finds no nodegroups, return the original nodegroup definition (for backwards compatibility). Keep track of recursive calls via `first_call` argument def nodegroup_comp(nodegroup, nodegro...
Gathers the data from the specified minions' mine, pass in the target, function to look up and the target type def mine_get(tgt, fun, tgt_type='glob', opts=None): ''' Gathers the data from the specified minions' mine, pass in the target, function to look up and the target type ''' ret = {} ...
Return minions found by looking at nodegroups def _check_nodegroup_minions(self, expr, greedy): # pylint: disable=unused-argument ''' Return minions found by looking at nodegroups ''' return self._check_compound_minions(nodegroup_comp(expr, self.opts['nodegroups']), DEFAULT...
Return the minions found by looking via a list def _check_list_minions(self, expr, greedy, ignore_missing=False): # pylint: disable=unused-argument ''' Return the minions found by looking via a list ''' if isinstance(expr, six.string_types): expr = [m for m in expr.split(',...
Return the minions found by looking via regular expressions def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument ''' Return the minions found by looking via regular expressions ''' reg = re.compile(expr) return {'minions': [m for m in self._pki_minions...
Retreive complete minion list from PKI dir. Respects cache if configured def _pki_minions(self): ''' Retreive complete minion list from PKI dir. Respects cache if configured ''' minions = [] pki_cache_fn = os.path.join(self.opts['pki_dir'], self.acc, '.key_cache'...
Helper function to search for minions in master caches If 'greedy', then return accepted minions matched by the condition or those absent from the cache. If not 'greedy' return the only minions have cache data and matched by the condition. def _check_cache_minions(self, ...
Return the minions found by looking via grains def _check_grain_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via grains ''' return self._check_cache_minions(expr, delimiter, greedy, 'grains')
Return the minions found by looking via grains with PCRE def _check_grain_pcre_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via grains with PCRE ''' return self._check_cache_minions(expr, delimiter, ...
Return the minions found by looking via pillar def _check_pillar_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via pillar ''' return self._check_cache_minions(expr, delimiter, greedy, 'pillar')
Return the minions found by looking via pillar with PCRE def _check_pillar_pcre_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via pillar with PCRE ''' return self._check_cache_minions(expr, delimiter, ...
Return the minions found by looking via pillar def _check_pillar_exact_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via pillar ''' return self._check_cache_minions(expr, delimiter, ...
Return the minions found by looking via ipcidr def _check_ipcidr_minions(self, expr, greedy): ''' Return the minions found by looking via ipcidr ''' cache_enabled = self.opts.get('minion_data_cache', False) if greedy: minions = self._pki_minions() elif cache...
Return the minions found by looking via range expression def _check_range_minions(self, expr, greedy): ''' Return the minions found by looking via range expression ''' if not HAS_RANGE: raise CommandExecutionError( 'Range matcher unavailable (unable to import...
Return the minions found by looking via compound matcher Disable pillar glob matching def _check_compound_pillar_exact_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via compound matcher Disable pillar glob matching ''' return self._che...
Return the minions found by looking via compound matcher def _check_compound_minions(self, expr, delimiter, greedy, pillar_exact=False): # pylint: disable=unused-argument ''' ...
Return a set of all connected minion ids, optionally within a subset def connected_ids(self, subset=None, show_ip=False, show_ipv4=None, include_localhost=None): ''' Return a set of all connected minion ids, optionally within a subset ''' if include_localhost is not None: sa...
Return a list of all minions that have auth'd def _all_minions(self, expr=None): ''' Return a list of all minions that have auth'd ''' mlist = [] for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))): if not fn_.starts...
Check the passed regex against the available minions' public keys stored for authentication. This should return a set of ids which match the regex, this will then be used to parse the returns to make sure everyone has checked back in. def check_minions(self, expr, ...
Return a Bool. This function returns if the expression sent in is within the scope of the valid expression def validate_tgt(self, valid, expr, tgt_type, minions=None, expr_form=None): ''' Return a Bool. This function returns if the expression sent in is within the scope of the valid exp...
Validate a single regex to function comparison, the function argument can be a list of functions. It is all or nothing for a list of functions def match_check(self, regex, fun): ''' Validate a single regex to function comparison, the function argument can be a list of functions....
Read in the form and determine which auth check routine to execute def any_auth(self, form, auth_list, fun, arg, tgt=None, tgt_type='glob'): ''' Read in the form and determine which auth check routine to execute ''' # This function is only called from salt.auth.Authorize(), which is als...
Returns a bool which defines if the requested function is authorized. Used to evaluate the standard structure under external master authentication interfaces, like eauth, peer, peer_run, etc. def auth_check(self, auth_list, funs, args, ...
Returns a list of authorisation matchers that a user is eligible for. This list is a combination of the provided personal matchers plus the matchers of any group the user is in. def fill_auth_list_from_groups(self, auth_provider, user_groups, auth_list): ''' Returns a list of authorisat...
Returns a list of authorisation matchers that a user is eligible for. This list is a combination of the provided personal matchers plus the matchers of any group the user is in. def fill_auth_list(self, auth_provider, name, groups, auth_list=None, permissive=None): ''' Returns a list of...
Check special API permissions def wheel_check(self, auth_list, fun, args): ''' Check special API permissions ''' return self.spec_check(auth_list, fun, args, 'wheel')
Check special API permissions def runner_check(self, auth_list, fun, args): ''' Check special API permissions ''' return self.spec_check(auth_list, fun, args, 'runner')
Check special API permissions def spec_check(self, auth_list, fun, args, form): ''' Check special API permissions ''' if not auth_list: return False if form != 'cloud': comps = fun.split('.') if len(comps) != 2: # Hint at a syn...
Check the given function name (fun) and its arguments (args) against the list of conditions. def __fun_check(self, valid, fun, args=None, kwargs=None): ''' Check the given function name (fun) and its arguments (args) against the list of conditions. ''' if not isinstance(valid, list): ...
valid is a dicts: {'args': [...], 'kwargs': {...}} or a list of such dicts. def __args_check(self, valid, args=None, kwargs=None): ''' valid is a dicts: {'args': [...], 'kwargs': {...}} or a list of such dicts. ''' if not isinstance(valid, list): valid = [valid] for ...
Return a list of the VMs that are on the provider def list_nodes_full(call=None, for_output=True): ''' Return a list of the VMs that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes_full function must be called with -f or --function.' )...
Return a list of the VMs that are on the provider def get_monthly_estimate(call=None, for_output=True): ''' Return a list of the VMs that are on the provider ''' creds = get_creds() clc.v1.SetCredentials(creds["token"], creds["token_pass"]) if call == 'action': raise SaltCloudSystemExit...
Return a list of alerts from CLC as reported by their infra def get_server_alerts(call=None, for_output=True, **kwargs): ''' Return a list of alerts from CLC as reported by their infra ''' for key, value in kwargs.items(): servername = "" if key == "servername": servername =...
Return a list of the VMs that are on the provider usage: "salt-cloud -f get_group_estimate clc group=Dev location=VA1" def get_group_estimate(call=None, for_output=True, **kwargs): ''' Return a list of the VMs that are on the provider usage: "salt-cloud -f get_group_estimate clc group=Dev location=VA1"...
returns a list of images available to you def avail_images(call=None): ''' returns a list of images available to you ''' all_servers = list_nodes_full() templates = {} for server in all_servers: if server["IsTemplate"]: templates.update({"Template Name": server["Name"]}) ...
returns a list of locations available to you def avail_locations(call=None): ''' returns a list of locations available to you ''' creds = get_creds() clc.v1.SetCredentials(creds["token"], creds["token_pass"]) locations = clc.v1.Account.GetLocations() return locations
get the build status from CLC to make sure we dont return to early def get_build_status(req_id, nodename): ''' get the build status from CLC to make sure we dont return to early ''' counter = 0 req_id = six.text_type(req_id) while counter < 10: queue = clc.v1.Blueprint.GetStatus(request...
get the system build going def create(vm_): ''' get the system build going ''' creds = get_creds() clc.v1.SetCredentials(creds["token"], creds["token_pass"]) cloud_profile = config.is_provider_configured( __opts__, __active_provider_name__ or __virtualname__, ('token',) ...
Ensure that the named service is present. name The LVS service name protocol The service protocol service_address The LVS service address scheduler Algorithm for allocating TCP connections and UDP datagrams to real servers. .. code-block:: yaml lvstest: ...
Ensure the LVS service is absent. name The name of the LVS service protocol The service protocol service_address The LVS service address def absent(name, protocol=None, service_address=None): ''' Ensure the LVS service is absent. name The name of the LVS serv...
Returns true if the passed glob matches the id def match(tgt, opts=None): ''' Returns true if the passed glob matches the id ''' if not opts: opts = __opts__ if not isinstance(tgt, six.string_types): return False return fnmatch.fnmatch(opts['id'], tgt)
Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' cmd = 'sysctl' ...
Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.inet.ip.forwarding 1 def assign(name, value): ''' Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.ine...
Return the configuration read from the master configuration file or directory def _get_asam_configuration(driver_url=''): ''' Return the configuration read from the master configuration file or directory ''' asam_config = __opts__['asam'] if 'asam' in __opts__ else None if asam_config: ...
To remove specified ASAM platform from the Novell Fan-Out Driver CLI Example: .. code-block:: bash salt-run asam.remove_platform my-test-vm prov1.domain.com def remove_platform(name, server_url): ''' To remove specified ASAM platform from the Novell Fan-Out Driver CLI Example: .. c...
To list all ASAM platforms present on the Novell Fan-Out Driver CLI Example: .. code-block:: bash salt-run asam.list_platforms prov1.domain.com def list_platforms(server_url): ''' To list all ASAM platforms present on the Novell Fan-Out Driver CLI Example: .. code-block:: bash ...
To list all ASAM platform sets present on the Novell Fan-Out Driver CLI Example: .. code-block:: bash salt-run asam.list_platform_sets prov1.domain.com def list_platform_sets(server_url): ''' To list all ASAM platform sets present on the Novell Fan-Out Driver CLI Example: .. code-b...
To add an ASAM platform using the specified ASAM platform set on the Novell Fan-Out Driver CLI Example: .. code-block:: bash salt-run asam.add_platform my-test-vm test-platform-set prov1.domain.com def add_platform(name, platform_set, server_url): ''' To add an ASAM platform using the sp...
Create a copy of __salt__ dictionary with module.function and module[function] Takes advantage of Jinja's syntactic sugar lookup: .. code-block:: {{ salt.cmd.run('uptime') }} def _split_module_dicts(): ''' Create a copy of __salt__ dictionary with module.function and module[function] Ta...
Render the template_file, passing the functions and grains into the Jinja rendering system. :rtype: string def render(template_file, saltenv='base', sls='', argline='', context=None, tmplpath=None, **kws): ''' Render the template_file, passing the functions and grains into th...
Initialize the directories for the files def init(**kwargs): ''' Initialize the directories for the files ''' formula_path = __opts__['formula_path'] pillar_path = __opts__['pillar_path'] reactor_path = __opts__['reactor_path'] for dir_ in (formula_path, pillar_path, reactor_path): ...
Check the filesystem for existing files def check_existing(package, pkg_files, formula_def, conn=None): ''' Check the filesystem for existing files ''' if conn is None: conn = init() node_type = six.text_type(__opts__.get('spm_node_type')) existing_files = [] for member in pkg_fil...
Install a single file to the file system def install_file(package, formula_tar, member, formula_def, conn=None): ''' Install a single file to the file system ''' if member.name == package: return False if conn is None: conn = init() node_type = six.text_type(__opts__.get('spm_...
Remove a single file from the file system def remove_file(path, conn=None): ''' Remove a single file from the file system ''' if conn is None: conn = init() log.debug('Removing package file %s', path) os.remove(path)
Get the hexdigest hash value of a file def hash_file(path, hashobj, conn=None): ''' Get the hexdigest hash value of a file ''' if os.path.isdir(path): return '' with salt.utils.files.fopen(path, 'r') as f: hashobj.update(salt.utils.stringutils.to_bytes(f.read())) return has...
Ensure the specified policy is set name the name of a single policy to configure setting the configuration setting for the single named policy if this argument is used the computer_policy/user_policy arguments will be ignored policy_class the policy class of the single nam...
XOR definition for multiple variables def xor(*variables): ''' XOR definition for multiple variables ''' sum_ = False for value in variables: sum_ = sum_ ^ bool(value) return sum_
Return usage information for volumes mounted on this minion CLI Example: .. code-block:: bash salt '*' disk.usage def usage(): ''' Return usage information for volumes mounted on this minion CLI Example: .. code-block:: bash salt '*' disk.usage ''' drives = [] ...
modify any key-value pair where value is a datetime object to a string. def _convert_datetime_str(response): ''' modify any key-value pair where value is a datetime object to a string. ''' if response: return dict([(k, '{0}'.format(v)) if isinstance(v, datetime.date) else (k, v) for k, v in six...
Retrieve full list of values for the contentkey from a boto3 ApiGateway client function that may be paged via 'position' def _multi_call(function, contentkey, *args, **kwargs): ''' Retrieve full list of values for the contentkey from a boto3 ApiGateway client function that may be paged via 'position' ...
get and return list of matching rest api information by the given name and desc. If rest api name evaluates to False, return all apis w/o filtering the name. def _find_apis_by_name(name, description=None, region=None, key=None, keyid=None, profile=None): ''' get and return list of ma...
Returns all rest apis in the defined region. If optional parameter name is included, returns all rest apis matching the name in the defined region. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_apis salt myminion boto_apigateway.describe_apis name='api name' ...
Check to see if the given Rest API Name and optionally description exists. CLI Example: .. code-block:: bash salt myminion boto_apigateway.exists myapi_name def api_exists(name, description=None, region=None, key=None, keyid=None, profile=None): ''' Check to see if the given Rest API Name an...
Create a new REST API Service with the given name Returns {created: True} if the rest api was created and returns {created: False} if the rest api was not created. CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api myapi_name api_description def create_api(name, desc...
Delete all REST API Service with the given name and an optional API description Returns {deleted: True, count: deleted_count} if apis were deleted, and returns {deleted: False} if error or not found. CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api myapi_name ...
Given rest api id, return all resources for this api. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_resources myapi_id def describe_api_resources(restApiId, region=None, key=None, keyid=None, profile=None): ''' Given rest api id, return all resources for this a...
Given rest api id, and an absolute resource path, returns the resource id for the given path. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_resource myapi_id resource_path def describe_api_resource(restApiId, path, region=None, key=None, k...
Given rest api id, and an absolute resource path, create all the resources and return all resources in the resourcepath, returns False on failure. CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api_resources myapi_id resource_path def create_api_resources(restApiId, path,...
Given restApiId and an absolute resource path, delete the resources starting from the absolute resource path. If resourcepath is the root resource '/', the function will return False. Returns False on failure. CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_resource...
Gets info about the given api key CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_key apigw_api_key def describe_api_key(apiKey, region=None, key=None, keyid=None, profile=None): ''' Gets info about the given api key CLI Example: .. code-block:: bash ...
Gets information about the defined API Keys. Return list of apiKeys. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_keys def describe_api_keys(region=None, key=None, keyid=None, profile=None): ''' Gets information about the defined API Keys. Return list of api...
Create an API key given name and description. An optional enabled argument can be provided. If provided, the valid values are True|False. This argument defaults to True. An optional stageKeys argument can be provided in the form of list of dictionary with 'restApiId' and 'stageName' as keys. CL...
Deletes a given apiKey CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_key apikeystring def delete_api_key(apiKey, region=None, key=None, keyid=None, profile=None): ''' Deletes a given apiKey CLI Example: .. code-block:: bash salt myminion boto_a...
the replace patch operation on an ApiKey resource def _api_key_patch_replace(conn, apiKey, path, value): ''' the replace patch operation on an ApiKey resource ''' response = conn.update_api_key(apiKey=apiKey, patchOperations=[{'op': 'replace', 'path': path, 'value': v...
the add patch operation for a list of (path, value) tuples on an ApiKey resource list path def _api_key_patch_add(conn, apiKey, pvlist): ''' the add patch operation for a list of (path, value) tuples on an ApiKey resource list path ''' response = conn.update_api_key(apiKey=apiKey, ...
the remove patch operation for a list of (path, value) tuples on an ApiKey resource list path def _api_key_patch_remove(conn, apiKey, pvlist): ''' the remove patch operation for a list of (path, value) tuples on an ApiKey resource list path ''' response = conn.update_api_key(apiKey=apiKey, ...
update the given apiKey with the given description. CLI Example: .. code-block:: bash salt myminion boto_apigateway.update_api_key_description api_key description def update_api_key_description(apiKey, description, region=None, key=None, keyid=None, profile=None): ''' update the given apiKey...
enable the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_apigateway.enable_api_key api_key def enable_api_key(apiKey, region=None, key=None, keyid=None, profile=None): ''' enable the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_ap...
associate the given stagekeyslist to the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_apigateway.associate_stagekeys_api_key \\ api_key '["restapi id/stage name", ...]' def associate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=None, pro...
disassociate the given stagekeyslist to the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_apigateway.disassociate_stagekeys_api_key \\ api_key '["restapi id/stage name", ...]' def disassociate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=...
Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId def describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None): ''' Gets informati...
Get API deployment for a given restApiId and deploymentId. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployent restApiId deploymentId def describe_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Get API deployme...
Activates previously deployed deployment for a given stage CLI Example: .. code-block:: bash salt myminion boto_apigateway.activate_api_deployent restApiId stagename deploymentId def activate_api_deployment(restApiId, stageName, deploymentId, region=None, key=None, keyid=...
Creates a new API deployment. CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api_deployent restApiId stagename stageDescription='' \\ description='' cacheClusterEnabled=True|False cacheClusterSize=0.5 variables='{"name": "value"}' def create_api_deployment(restApiId, ...
Deletes API deployment for a given restApiId and deploymentID CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_deployent restApiId deploymentId def delete_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Deletes API deplo...
Overwrite the stage variables for the given restApiId and stage name with the given variables, variables must be in the form of a dictionary. Overwrite will always remove all the existing stage variables associated with the given restApiId and stage name, follow by the adding of all the variables specified...
Get API stage for a given apiID and stage name CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_stage restApiId stageName def describe_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' Get API stage for a given apiID and stage n...
Get all API stages for a given apiID and deploymentID CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_stages restApiId deploymentId def describe_api_stages(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Get all API stages for a giv...
Creates a new API stage for a given restApiId and deploymentId. CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api_stage restApiId stagename deploymentId \\ description='' cacheClusterEnabled=True|False cacheClusterSize='0.5' variables='{"name": "value"}' def crea...
Deletes stage identified by stageName from API identified by restApiId CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_stage restApiId stageName def delete_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' Deletes stage identifie...
Flushes cache for the stage identified by stageName from API identified by restApiId CLI Example: .. code-block:: bash salt myminion boto_apigateway.flush_api_stage_cache restApiId stageName def flush_api_stage_cache(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' ...
Creates API method for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api_method restApiId resourcePath, httpMethod, authorizationType, \\ apiKeyRequired=False, requestParameters='{"name", "value"}', requestModels='{"content-type", "valu...
Get API method for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_method restApiId resourcePath httpMethod def describe_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None): ''' Get API meth...
Delete API method for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_method restApiId resourcePath httpMethod def delete_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None): ''' Delete API me...
Create API method response for a method on a given resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.create_api_method_response restApiId resourcePath httpMethod \\ statusCode responseParameters='{"name", "True|False"}' responseModels='{"content-...
Delete API method response for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_method_response restApiId resourcePath httpMethod statusCode def delete_api_method_response(restApiId, resourcePath, httpMethod, statusCode, ...
Get API method response for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_method_response restApiId resourcePath httpMethod statusCode def describe_api_method_response(restApiId, resourcePath, httpMethod, statusCode, ...
Get all models for a given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_models restApiId def describe_api_models(restApiId, region=None, key=None, keyid=None, profile=None): ''' Get all models for a given API CLI Example: .. code-block:: bash ...