Search is not available for this dataset
text
stringlengths
75
104k
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: log.warning('Unable to parse target "%s"', target_expression) ret = { 'engine':...
def get_minion_data(minion, opts): ''' 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 ''' grains = None pillar = None if opts.get('minion_data_c...
def nodegroup_comp(nodegroup, nodegroups, skip=None, first_call=True): ''' 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 r...
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 = {} serial = salt.payload.Serial(opts) checker = CkMinions(opts) _res = checker.check_minions( tgt, ...
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_TARGET_DELIM, greedy)
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(',') if m] minions = self._pki_minions() ...
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() if reg.match(m)], 'missing': []}
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') try: os.makedirs(os.path.dirname(pki_cache_fn)) exce...
def _check_cache_minions(self, expr, delimiter, greedy, search_type, regex_match=False, exact_match=False): ''' Helper function to...
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')
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, greedy, ...
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')
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, greedy, ...
def _check_pillar_exact_minions(self, expr, delimiter, greedy): ''' Return the minions found by looking via pillar ''' return self._check_cache_minions(expr, delimiter, greedy, ...
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_enabled: minions = self.cache.list(...
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 seco.range, ' 'module most likely not ins...
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._check_compound_minions(expr, delimiter, ...
def _check_compound_minions(self, expr, delimiter, greedy, pillar_exact=False): # pylint: disable=unused-argument ''' Return the minions found by looking via compound matcher ...
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: salt.utils.versions.warn_until( 'Sodium', ...
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_.startswith('.') and os.path.isfile(os.path.join(self....
def check_minions(self, expr, tgt_type='glob', delimiter=DEFAULT_TARGET_DELIM, greedy=True): ''' Check the passed regex against the available minions' public keys stored for authentication. This should return...
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 expression ''' v_minions = set(self.check_minions(valid, 'compound').get('minions', [])) if mi...
def match_check(self, regex, fun): ''' 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 ''' vals = [] if isinstance(fun, six.string_types): fun = [fun] ...
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 also # deprecated and will be removed in Neon. salt.uti...
def auth_check(self, auth_list, funs, args, tgt, tgt_type='glob', groups=None, publish_validate=False, minions=None, whitelist=None): ''' ...
def fill_auth_list_from_groups(self, auth_provider, user_groups, auth_list): ''' 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. ''' group_nam...
def fill_auth_list(self, auth_provider, name, groups, auth_list=None, permissive=None): ''' 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 wheel_check(self, auth_list, fun, args): ''' Check special API permissions ''' return self.spec_check(auth_list, fun, args, 'wheel')
def runner_check(self, auth_list, fun, args): ''' Check special API permissions ''' return self.spec_check(auth_list, fun, args, 'runner')
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 syntax error when command is passe...
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 = [valid] for cond in valid: # Function name match ...
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 cond in valid: if not isinstance(cond, dict): # I...
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.' ) creds = get_creds() clc.v1.SetCredentials(...
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( 'The list_nodes_full function must be...
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 = value creds = get_creds() clc.v2.SetCredentials(cred...
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" ''' for key, value in kwargs.items(): group = "" location = "" if key == "group": ...
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"]}) return templates
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
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_id=(req_id)) if queue["PercentComplete"] == 100: ...
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',) ) group = config.get...
def present(name, protocol=None, service_address=None, scheduler='wlc', ): ''' Ensure that the named service is present. name The LVS service name protocol The service protocol service_address The LVS service address sche...
def absent(name, protocol=None, service_address=None): ''' Ensure the LVS service is absent. name The name of the LVS service protocol The service protocol service_address The LVS service address ''' ret = {'name': name, 'changes': {}, 'result...
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)
def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' cmd = 'sysctl' ret = {} out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace') for line in out.splitlines(): if no...
def assign(name, value): ''' Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.inet.ip.forwarding 1 ''' ret = {} cmd = 'sysctl {0}="{1}"'.format(name, value) data = __salt__['cmd.run_all'](cmd) # Certain values c...
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: try: for asam_server, service_config in six.iteritems(asam_config)...
def remove_platform(name, server_url): ''' 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 ''' config = _get_asam_configuration(server_url) if not config: return Fa...
def list_platforms(server_url): ''' 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 ''' config = _get_asam_configuration(server_url) if not config: return False url = confi...
def list_platform_sets(server_url): ''' 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 ''' config = _get_asam_configuration(server_url) if not config: return False ...
def add_platform(name, platform_set, server_url): ''' 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 ''' config = _get_asam_config...
def _split_module_dicts(): ''' 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') }} ''' if not isinstance(__salt__, dict): return __salt__ mod_dict = d...
def render(template_file, saltenv='base', sls='', argline='', context=None, tmplpath=None, **kws): ''' Render the template_file, passing the functions and grains into the Jinja rendering system. :rtype: string ''' from_str = argline == '-s' if not from_str and argl...
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): if not os.path.exists(dir_): o...
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_files: if member.isdir(): ...
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_node_type')) out_path = conn['formula...
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)
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 hashobj.hexdigest()
def set_(name, setting=None, policy_class=None, computer_policy=None, user_policy=None, cumulative_rights_assignments=True, adml_language='en-US'): ''' Ensure the specified policy is set name the name of a single policy to configure setting...
def xor(*variables): ''' XOR definition for multiple variables ''' sum_ = False for value in variables: sum_ = sum_ ^ bool(value) return sum_
def usage(): ''' Return usage information for volumes mounted on this minion CLI Example: .. code-block:: bash salt '*' disk.usage ''' drives = [] ret = {} drive_bitmask = ctypes.windll.kernel32.GetLogicalDrives() for letter in UPPERCASE: if drive_bitmask & 1: ...
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.iteritems(response)]) return None
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' ''' ret = function(*args, **kwargs) position = ret.get('position') while position: more = function(*ar...
def _find_apis_by_name(name, description=None, region=None, key=None, keyid=None, profile=None): ''' 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. ''' try: c...
def describe_apis(name=None, description=None, region=None, key=None, keyid=None, profile=None): ''' 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 ...
def api_exists(name, description=None, region=None, key=None, keyid=None, profile=None): ''' 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 ''' apis = _find_apis_by_name(name...
def create_api(name, description, cloneFrom=None, region=None, key=None, keyid=None, profile=None): ''' 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: ...
def delete_api(name, description=None, region=None, key=None, keyid=None, profile=None): ''' 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 E...
def describe_api_resources(restApiId, region=None, key=None, keyid=None, profile=None): ''' Given rest api id, return all resources for this api. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_resources myapi_id ''' try: conn = _get_conn(region=r...
def describe_api_resource(restApiId, path, region=None, key=None, keyid=None, profile=None): ''' 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...
def create_api_resources(restApiId, path, region=None, key=None, keyid=None, profile=None): ''' 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:: b...
def delete_api_resources(restApiId, path, region=None, key=None, keyid=None, profile=None): ''' 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....
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 salt myminion boto_apigateway.describe_api_key apigw_api_key ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, p...
def describe_api_keys(region=None, key=None, keyid=None, profile=None): ''' Gets information about the defined API Keys. Return list of apiKeys. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_keys ''' try: conn = _get_conn(region=region, key=key...
def create_api_key(name, description, enabled=True, stageKeys=None, region=None, key=None, keyid=None, profile=None): ''' 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...
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_apigateway.delete_api_key apikeystring ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
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': value}]) return response
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, patchOperations=_api_key_patchops('add', pvlist)) return response
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, patchOperations=_api_key_patchops('remove', pvlist)) return response
def update_api_key_description(apiKey, description, region=None, key=None, keyid=None, profile=None): ''' update the given apiKey with the given description. CLI Example: .. code-block:: bash salt myminion boto_apigateway.update_api_key_description api_key description ''' try: ...
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_apigateway.enable_api_key api_key ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
def associate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None): ''' associate the given stagekeyslist to the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_apigateway.associate_stagekeys_api_key \\ api_key '["restapi...
def disassociate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None): ''' disassociate the given stagekeyslist to the given apiKey. CLI Example: .. code-block:: bash salt myminion boto_apigateway.disassociate_stagekeys_api_key \\ api_key '...
def describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None): ''' 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 ''' tr...
def describe_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Get API deployment for a given restApiId and deploymentId. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployent restApiId deploymentId ''' try:...
def activate_api_deployment(restApiId, stageName, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Activates previously deployed deployment for a given stage CLI Example: .. code-block:: bash salt myminion boto_apigateway.activate_api_deployent r...
def create_api_deployment(restApiId, stageName, stageDescription='', description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None): ''' Creates a new API deployment. CLI Example: ....
def delete_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Deletes API deployment for a given restApiId and deploymentID CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_deployent restApiId deploymentId ''' try: ...
def overwrite_api_stage_variables(restApiId, stageName, variables, region=None, key=None, keyid=None, profile=None): ''' 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 existin...
def describe_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' Get API stage for a given apiID and stage name CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_stage restApiId stageName ''' try: conn = _get_conn(r...
def describe_api_stages(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None): ''' Get all API stages for a given apiID and deploymentID CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_stages restApiId deploymentId ''' try: con...
def create_api_stage(restApiId, stageName, deploymentId, description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None): ''' Creates a new API stage for a given restApiId and deploymentId. CLI Exa...
def delete_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' Deletes stage identified by stageName from API identified by restApiId CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_stage restApiId stageName ''' try: ...
def flush_api_stage_cache(restApiId, stageName, region=None, key=None, keyid=None, profile=None): ''' 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 create_api_method(restApiId, resourcePath, httpMethod, authorizationType, apiKeyRequired=False, requestParameters=None, requestModels=None, region=None, key=None, keyid=None, profile=None): ''' Creates API method for a resource in the given API CLI Example: ...
def describe_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None): ''' 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 delete_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None): ''' 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 ''' t...
def create_api_method_response(restApiId, resourcePath, httpMethod, statusCode, responseParameters=None, responseModels=None, region=None, key=None, keyid=None, profile=None): ''' Create API method response for a method on a given resource in the given API CLI Example: ....
def delete_api_method_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None): ''' Delete API method response for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.delet...
def describe_api_method_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None): ''' Get API method response for a resource in the given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.desc...
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 salt myminion boto_apigateway.describe_api_models restApiId ''' try: conn = _get_conn(region=region, key=key, keyid=keyid,...