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/states/boto_apigateway.py | _Swagger.paths | python | def paths(self):
'''
returns an iterator for the relative resource paths specified in the swagger file
'''
paths = self._cfg.get('paths')
if not paths:
raise ValueError('Paths Object has no values, You need to define them in your swagger file')
for path in pat... | returns an iterator for the relative resource paths specified in the swagger file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L910-L920 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.deployment_label | python | def deployment_label(self):
'''
this property returns the deployment label dictionary (mainly used by
stage description)
'''
label = dict()
label['swagger_info_object'] = self.info
label['api_name'] = self.rest_api_name
label['swagger_file'] = os.path.bas... | this property returns the deployment label dictionary (mainly used by
stage description) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L953-L965 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._one_or_more_stages_remain | python | def _one_or_more_stages_remain(self, deploymentId):
'''
Helper function to find whether there are other stages still associated with a deployment
'''
stages = __salt__['boto_apigateway.describe_api_stages'](restApiId=self.restApiId,
... | Helper function to find whether there are other stages still associated with a deployment | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L968-L975 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.no_more_deployments_remain | python | def no_more_deployments_remain(self):
'''
Helper function to find whether there are deployments left with stages associated
'''
no_more_deployments = True
deployments = __salt__['boto_apigateway.describe_api_deployments'](restApiId=self.restApiId,
... | Helper function to find whether there are deployments left with stages associated | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L977-L994 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._get_current_deployment_id | python | def _get_current_deployment_id(self):
'''
Helper method to find the deployment id that the stage name is currently assocaited with.
'''
deploymentId = ''
stage = __salt__['boto_apigateway.describe_api_stage'](restApiId=self.restApiId,
... | Helper method to find the deployment id that the stage name is currently assocaited with. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L996-L1006 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._get_current_deployment_label | python | def _get_current_deployment_label(self):
'''
Helper method to find the deployment label that the stage_name is currently associated with.
'''
deploymentId = self._get_current_deployment_id()
deployment = __salt__['boto_apigateway.describe_api_deployment'](restApiId=self.restApiId... | Helper method to find the deployment label that the stage_name is currently associated with. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1008-L1018 | [
"def _get_current_deployment_id(self):\n '''\n Helper method to find the deployment id that the stage name is currently assocaited with.\n '''\n deploymentId = ''\n stage = __salt__['boto_apigateway.describe_api_stage'](restApiId=self.restApiId,\n ... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._get_desired_deployment_id | python | def _get_desired_deployment_id(self):
'''
Helper method to return the deployment id matching the desired deployment label for
this Swagger object based on the given api_name, swagger_file
'''
deployments = __salt__['boto_apigateway.describe_api_deployments'](restApiId=self.restAp... | Helper method to return the deployment id matching the desired deployment label for
this Swagger object based on the given api_name, swagger_file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1020-L1031 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.overwrite_stage_variables | python | def overwrite_stage_variables(self, ret, stage_variables):
'''
overwrite the given stage_name's stage variables with the given stage_variables
'''
res = __salt__['boto_apigateway.overwrite_api_stage_variables'](restApiId=self.restApiId,
... | overwrite the given stage_name's stage variables with the given stage_variables | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1033-L1050 | [
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete operations to AWS ApiGateway\n '''\n cl = ret['changes'].get('new', [])\n cl.append({changekey: _object_reducer(changevalue)})\n ret['changes']['new'] = cl\n return ret\n"
] | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._set_current_deployment | python | def _set_current_deployment(self, stage_desc_json, stage_variables):
'''
Helper method to associate the stage_name to the given deploymentId and make this current
'''
stage = __salt__['boto_apigateway.describe_api_stage'](restApiId=self.restApiId,
... | Helper method to associate the stage_name to the given deploymentId and make this current | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1052-L1080 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._resolve_api_id | python | def _resolve_api_id(self):
'''
returns an Api Id that matches the given api_name and the hardcoded _Swagger.AWS_API_DESCRIPTION
as the api description
'''
apis = __salt__['boto_apigateway.describe_apis'](name=self.rest_api_name,
... | returns an Api Id that matches the given api_name and the hardcoded _Swagger.AWS_API_DESCRIPTION
as the api description | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1082-L1095 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.delete_stage | python | def delete_stage(self, ret):
'''
Method to delete the given stage_name. If the current deployment tied to the given
stage_name has no other stages associated with it, the deployment will be removed
as well
'''
deploymentId = self._get_current_deployment_id()
if d... | Method to delete the given stage_name. If the current deployment tied to the given
stage_name has no other stages associated with it, the deployment will be removed
as well | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1097-L1128 | [
"def _one_or_more_stages_remain(self, deploymentId):\n '''\n Helper function to find whether there are other stages still associated with a deployment\n '''\n stages = __salt__['boto_apigateway.describe_api_stages'](restApiId=self.restApiId,\n ... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.verify_api | python | def verify_api(self, ret):
'''
this method helps determine if the given stage_name is already on a deployment
label matching the input api_name, swagger_file.
If yes, returns abort with comment indicating already at desired state.
If not and there is previous deployment labels i... | this method helps determine if the given stage_name is already on a deployment
label matching the input api_name, swagger_file.
If yes, returns abort with comment indicating already at desired state.
If not and there is previous deployment labels in AWS matching the given input api_name and
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1130-L1152 | [
"def _get_current_deployment_label(self):\n '''\n Helper method to find the deployment label that the stage_name is currently associated with.\n '''\n deploymentId = self._get_current_deployment_id()\n deployment = __salt__['boto_apigateway.describe_api_deployment'](restApiId=self.restApiId,\n ... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.publish_api | python | def publish_api(self, ret, stage_variables):
'''
this method tie the given stage_name to a deployment matching the given swagger_file
'''
stage_desc = dict()
stage_desc['current_deployment_label'] = self.deployment_label
stage_desc_json = _dict_to_json_pretty(stage_desc)
... | this method tie the given stage_name to a deployment matching the given swagger_file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1154-L1187 | [
"def _dict_to_json_pretty(d, sort_keys=True):\n '''\n helper function to generate pretty printed json output\n '''\n return salt.utils.json.dumps(d, indent=4, separators=(',', ': '), sort_keys=sort_keys)\n",
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._cleanup_api | python | def _cleanup_api(self):
'''
Helper method to clean up resources and models if we detected a change in the swagger file
for a stage
'''
resources = __salt__['boto_apigateway.describe_api_resources'](restApiId=self.restApiId,
... | Helper method to clean up resources and models if we detected a change in the swagger file
for a stage | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1189-L1215 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.deploy_api | python | def deploy_api(self, ret):
'''
this method create the top level rest api in AWS apigateway
'''
if self.restApiId:
res = self._cleanup_api()
if not res.get('deleted'):
ret['comment'] = 'Failed to cleanup restAreId {0}'.format(self.restApiId)
... | this method create the top level rest api in AWS apigateway | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1217-L1243 | [
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete operations to AWS ApiGateway\n '''\n cl = ret['changes'].get('new', [])\n cl.append({changekey: _object_reducer(changevalue)})\n ret['changes']['new'] = cl\n return ret\n",
"def _cleanup_api(self):\n '... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.delete_api | python | def delete_api(self, ret):
'''
Method to delete a Rest Api named defined in the swagger file's Info Object's title value.
ret
a dictionary for returning status to Saltstack
'''
exists_response = __salt__['boto_apigateway.api_exists'](name=self.rest_api_name,
... | Method to delete a Rest Api named defined in the swagger file's Info Object's title value.
ret
a dictionary for returning status to Saltstack | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1245-L1278 | [
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete operations to AWS ApiGateway\n '''\n cl = ret['changes'].get('new', [])\n cl.append({changekey: _object_reducer(changevalue)})\n ret['changes']['new'] = cl\n return ret\n"
] | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._aws_model_ref_from_swagger_ref | python | def _aws_model_ref_from_swagger_ref(self, r):
'''
Helper function to reference models created on aws apigw
'''
model_name = r.split('/')[-1]
return 'https://apigateway.amazonaws.com/restapis/{0}/models/{1}'.format(self.restApiId, model_name) | Helper function to reference models created on aws apigw | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1280-L1285 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._update_schema_to_aws_notation | python | def _update_schema_to_aws_notation(self, schema):
'''
Helper function to map model schema to aws notation
'''
result = {}
for k, v in schema.items():
if k == '$ref':
v = self._aws_model_ref_from_swagger_ref(v)
if isinstance(v, dict):
... | Helper function to map model schema to aws notation | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1287-L1298 | [
"def _aws_model_ref_from_swagger_ref(self, r):\n '''\n Helper function to reference models created on aws apigw\n '''\n model_name = r.split('/')[-1]\n return 'https://apigateway.amazonaws.com/restapis/{0}/models/{1}'.format(self.restApiId, model_name)\n",
"def _update_schema_to_aws_notation(self, ... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._build_dependent_model_list | python | def _build_dependent_model_list(self, obj_schema):
'''
Helper function to build the list of models the given object schema is referencing.
'''
dep_models_list = []
if obj_schema:
obj_schema['type'] = obj_schema.get('type', 'object')
if obj_schema['type'] == '... | Helper function to build the list of models the given object schema is referencing. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1300-L1323 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _models(self):\n '''\n returns an iterator for the models specified in the swagger file\n '''\n models = self._cfg.get('definitions')\n if not models:\n raise ValueError('Definitions Object has no values, You need to define them... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._build_all_dependencies | python | def _build_all_dependencies(self):
'''
Helper function to build a map of model to their list of model reference dependencies
'''
ret = {}
for model, schema in six.iteritems(self._models()):
dep_list = self._build_dependent_model_list(schema)
ret[model] = d... | Helper function to build a map of model to their list of model reference dependencies | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1325-L1333 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _models(self):\n '''\n returns an iterator for the models specified in the swagger file\n '''\n models = self._cfg.get('definitions')\n if not models:\n raise ValueError('Definitions Object has no values, You need to define them... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._get_model_without_dependencies | python | def _get_model_without_dependencies(self, models_dict):
'''
Helper function to find the next model that should be created
'''
next_model = None
if not models_dict:
return next_model
for model, dependencies in six.iteritems(models_dict):
if depende... | Helper function to find the next model that should be created | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1335-L1358 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.deploy_models | python | def deploy_models(self, ret):
'''
Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models
ret
a dictionary for returning status to Saltstack
'''
for model, schema in self.models():
# add in a few attributes in... | Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models
ret
a dictionary for returning status to Saltstack | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1360-L1416 | [
"def _dict_to_json_pretty(d, sort_keys=True):\n '''\n helper function to generate pretty printed json output\n '''\n return salt.utils.json.dumps(d, indent=4, separators=(',', ': '), sort_keys=sort_keys)\n",
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._lambda_name | python | def _lambda_name(self, resourcePath, httpMethod):
'''
Helper method to construct lambda name based on the rule specified in doc string of
boto_apigateway.api_present function
'''
lambda_name = self._lambda_funcname_format.format(stage=self._stage_name,
... | Helper method to construct lambda name based on the rule specified in doc string of
boto_apigateway.api_present function | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1418-L1430 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._lambda_uri | python | def _lambda_uri(self, lambda_name, lambda_region):
'''
Helper Method to construct the lambda uri for use in method integration
'''
profile = self._common_aws_args.get('profile')
region = self._common_aws_args.get('region')
lambda_region = __utils__['boto3.get_region']('l... | Helper Method to construct the lambda uri for use in method integration | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1432-L1456 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._parse_method_data | python | def _parse_method_data(self, method_name, method_data):
'''
Helper function to construct the method request params, models, request_templates and
integration_type values needed to configure method request integration/mappings.
'''
method_params = {}
method_models = {}
... | Helper function to construct the method request params, models, request_templates and
integration_type values needed to configure method request integration/mappings. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1458-L1479 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._get_pattern_for_schema | python | def _get_pattern_for_schema(self, schema_name, httpStatus):
'''
returns the pattern specified in a response schema
'''
defaultPattern = '.+' if self._is_http_error_rescode(httpStatus) else '.*'
model = self._models().get(schema_name)
patterns = self._find_patterns(model)
... | returns the pattern specified in a response schema | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1492-L1499 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._parse_method_response | python | def _parse_method_response(self, method_name, method_response, httpStatus):
'''
Helper function to construct the method response params, models, and integration_params
values needed to configure method response integration/mappings.
'''
method_response_models = {}
method_... | Helper function to construct the method response params, models, and integration_params
values needed to configure method response integration/mappings. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1510-L1536 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._deploy_method | python | def _deploy_method(self, ret, resource_path, method_name, method_data, api_key_required,
lambda_integration_role, lambda_region, authorization_type):
'''
Method to create a method for the given resource path, along with its associated
request and response integrations.
... | Method to create a method for the given resource path, along with its associated
request and response integrations.
ret
a dictionary for returning status to Saltstack
resource_path
the full resource path where the named method_name will be associated with.
meth... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1538-L1650 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete operations to AWS ApiGateway\n '''\n cl = ret['changes'].get('new', [])\n cl.append({changekey: _object_reducer(changevalue)})\n ret['changes']['new... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.deploy_resources | python | def deploy_resources(self, ret, api_key_required, lambda_integration_role, lambda_region, authorization_type):
'''
Method to deploy resources defined in the swagger file.
ret
a dictionary for returning status to Saltstack
api_key_required
True or False, whether ... | Method to deploy resources defined in the swagger file.
ret
a dictionary for returning status to Saltstack
api_key_required
True or False, whether api key is required to access this method.
lambda_integration_role
name of the IAM role or IAM role arn that A... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1652-L1685 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def _log_changes(ret, changekey, changevalue):\n '''\n For logging create/update/delete operations to AWS ApiGateway\n '''\n cl = ret['changes'].get('new', [])\n cl.append({changekey: _object_reducer(changevalue)})\n ret['changes']['new... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/pagerduty.py | create_event | python | def create_event(name, details, service_key, profile):
'''
Create an event on the PagerDuty service
.. code-block:: yaml
server-warning-message:
pagerduty.create_event:
- name: 'This is a server warning message'
- details: 'This is a much more detailed message'
... | Create an event on the PagerDuty service
.. code-block:: yaml
server-warning-message:
pagerduty.create_event:
- name: 'This is a server warning message'
- details: 'This is a much more detailed message'
- service_key: 9abcd123456789efabcde362783cdbaf
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty.py#L32-L75 | null | # -*- coding: utf-8 -*-
'''
Create an Event in PagerDuty
============================
.. versionadded:: 2014.1.0
This state is useful for creating events on the PagerDuty service during state
runs.
.. code-block:: yaml
server-warning-message:
pagerduty.create_event:
- name: 'This is a server warni... |
saltstack/salt | salt/states/mysql_query.py | run_file | python | def run_file(name,
database,
query_file=None,
output=None,
grain=None,
key=None,
overwrite=True,
saltenv=None,
check_db_exists=True,
**connection_args):
'''
Execute an arbitrary query on the specified database
.. versionadded:: 2017.7.... | Execute an arbitrary query on the specified database
.. versionadded:: 2017.7.0
name
Used only as an ID
database
The name of the database to execute the query_file on
query_file
The file of mysql commands to run
output
grain: output in a grain
other: the ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_query.py#L53-L222 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"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 ... | # -*- coding: utf-8 -*-
'''
Execution of MySQL queries
==========================
.. versionadded:: 2014.7.0
:depends: - MySQLdb Python module
:configuration: See :py:mod:`salt.modules.mysql` for setup instructions.
The mysql_query module is used to execute queries on MySQL databases.
Its output may be stored in a... |
saltstack/salt | salt/states/mysql_query.py | run | python | def run(name,
database,
query,
output=None,
grain=None,
key=None,
overwrite=True,
check_db_exists=True,
**connection_args):
'''
Execute an arbitrary query on the specified database
name
Used only as an ID
database
The name... | Execute an arbitrary query on the specified database
name
Used only as an ID
database
The name of the database to execute the query on
query
The query to execute
output
grain: output in a grain
other: the file to store results
None: output to the resu... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_query.py#L225-L381 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"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 ... | # -*- coding: utf-8 -*-
'''
Execution of MySQL queries
==========================
.. versionadded:: 2014.7.0
:depends: - MySQLdb Python module
:configuration: See :py:mod:`salt.modules.mysql` for setup instructions.
The mysql_query module is used to execute queries on MySQL databases.
Its output may be stored in a... |
saltstack/salt | salt/utils/s3.py | query | python | def query(key, keyid, method='GET', params=None, headers=None,
requesturl=None, return_url=False, bucket=None, service_url=None,
path='', return_bin=False, action=None, local_file=None,
verify_ssl=True, full_headers=False, kms_keyid=None,
location=None, role_arn=None, chunk_size=... | Perform a query against an S3-like API. This function requires that a
secret key and the id for that key are passed in. For instance:
s3.keyid: GKTADJGHEIQSXMKKRBJ08H
s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
If keyid or key is not specified, an attempt to fetch them from EC2 IAM
m... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/s3.py#L32-L279 | [
"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 -*-
'''
Connection library for Amazon S3
:depends: requests
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging
# Import 3rd-party libs
try:
import requests
HAS_REQUESTS = True # pylint: disable=W0612
except ImportError:
HA... |
saltstack/salt | salt/utils/atomicfile.py | atomic_open | python | def atomic_open(filename, mode='w'):
'''
Works like a regular `open()` but writes updates into a temporary
file instead of the given file and moves it over when the file is
closed. The file returned behaves as if it was a regular Python
'''
if mode in ('r', 'rb', 'r+', 'rb+', 'a', 'ab'):
... | Works like a regular `open()` but writes updates into a temporary
file instead of the given file and moves it over when the file is
closed. The file returned behaves as if it was a regular Python | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/atomicfile.py#L153-L169 | null | # -*- coding: utf-8 -*-
'''
A module written originally by Armin Ronacher to manage file transfers in an
atomic way
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import tempfile
import sys
import errno
import time
import random
import shutil
from salt.ext i... |
saltstack/salt | salt/pillar/nodegroups.py | ext_pillar | python | def ext_pillar(minion_id, pillar, pillar_name=None):
'''
A salt external pillar which provides the list of nodegroups of which the minion is a member.
:param minion_id: used for compound matching nodegroups
:param pillar: provided by salt, but not used by nodegroups ext_pillar
:param pillar_name: o... | A salt external pillar which provides the list of nodegroups of which the minion is a member.
:param minion_id: used for compound matching nodegroups
:param pillar: provided by salt, but not used by nodegroups ext_pillar
:param pillar_name: optional name to use for the pillar, defaults to 'nodegroups'
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nodegroups.py#L49-L73 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Nodegroups Pillar
=================
Introspection: to which nodegroups does my minion belong?
Provides a pillar with the default name of `nodegroups`
which contains a list of nodegroups which match for a given minion.
.. versionadded:: 2016.11.0
Command Line
------------
.. code-block:: ... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | _compute_signature | python | def _compute_signature(parameters, access_key_secret, method, path):
'''
Generate an API request signature. Detailed document can be found at:
https://docs.qingcloud.com/api/common/signature.html
'''
parameters['signature_method'] = 'HmacSHA256'
string_to_sign = '{0}\n{1}\n'.format(method.uppe... | Generate an API request signature. Detailed document can be found at:
https://docs.qingcloud.com/api/common/signature.html | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L105-L128 | null | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | query | python | def query(params=None):
'''
Make a web call to QingCloud IaaS API.
'''
path = 'https://api.qingcloud.com/iaas/'
access_key_id = config.get_cloud_config_value(
'access_key_id', get_configured_provider(), __opts__, search_global=False
)
access_key_secret = config.get_cloud_config_valu... | Make a web call to QingCloud IaaS API. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L131-L201 | [
"def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | avail_locations | python | def avail_locations(call=None):
'''
Return a dict of all available locations on the provider with
relevant data.
CLI Examples:
.. code-block:: bash
salt-cloud --list-locations my-qingcloud
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations... | Return a dict of all available locations on the provider with
relevant data.
CLI Examples:
.. code-block:: bash
salt-cloud --list-locations my-qingcloud | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L204-L232 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | avail_images | python | def avail_images(kwargs=None, call=None):
'''
Return a list of the images that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud --list-images my-qingcloud
salt-cloud -f avail_images my-qingcloud zone=gd1
'''
if call == 'action':
raise SaltCloudSystemE... | Return a list of the images that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud --list-images my-qingcloud
salt-cloud -f avail_images my-qingcloud zone=gd1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L271-L304 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | show_image | python | def show_image(kwargs, call=None):
'''
Show the details from QingCloud concerning an image.
CLI Examples:
.. code-block:: bash
salt-cloud -f show_image my-qingcloud image=trustysrvx64c
salt-cloud -f show_image my-qingcloud image=trustysrvx64c,coreos4
salt-cloud -f show_image m... | Show the details from QingCloud concerning an image.
CLI Examples:
.. code-block:: bash
salt-cloud -f show_image my-qingcloud image=trustysrvx64c
salt-cloud -f show_image my-qingcloud image=trustysrvx64c,coreos4
salt-cloud -f show_image my-qingcloud image=trustysrvx64c zone=ap1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L327-L368 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | avail_sizes | python | def avail_sizes(kwargs=None, call=None):
'''
Return a list of the instance sizes that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud --list-sizes my-qingcloud
salt-cloud -f avail_sizes my-qingcloud zone=pek2
'''
if call == 'action':
raise SaltCloudS... | Return a list of the instance sizes that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud --list-sizes my-qingcloud
salt-cloud -f avail_sizes my-qingcloud zone=pek2 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L399-L424 | [
"def get_configured_provider():\n '''\n Return the first configured instance.\n '''\n return config.is_provider_configured(\n __opts__,\n __active_provider_name__ or __virtualname__,\n ('access_key_id', 'secret_access_key', 'zone', 'key_filename')\n )\n",
"def _get_specified_zo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | _show_normalized_node | python | def _show_normalized_node(full_node):
'''
Normalize the QingCloud instance data. Used by list_nodes()-related
functions.
'''
public_ips = full_node.get('eip', [])
if public_ips:
public_ip = public_ips['eip_addr']
public_ips = [public_ip, ]
private_ips = []
for vxnet in f... | Normalize the QingCloud instance data. Used by list_nodes()-related
functions. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L448-L473 | null | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | list_nodes_full | python | def list_nodes_full(call=None):
'''
Return a list of the instances that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud -F my-qingcloud
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --... | Return a list of the instances that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud -F my-qingcloud | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L476-L521 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | list_nodes | python | def list_nodes(call=None):
'''
Return a list of the instances that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud -Q my-qingcloud
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'... | Return a list of the instances that are on the provider.
CLI Examples:
.. code-block:: bash
salt-cloud -Q my-qingcloud | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L524-L552 | [
"def list_nodes_full(call=None):\n '''\n Return a list of the instances that are on the provider.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-cloud -F my-qingcloud\n '''\n if call == 'action':\n raise SaltCloudSystemExit(\n 'The list_nodes_full function must be cal... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | list_nodes_min | python | def list_nodes_min(call=None):
'''
Return a list of the instances that are on the provider. Only a list of
instances names, and their state, is returned.
CLI Examples:
.. code-block:: bash
salt-cloud -f list_nodes_min my-qingcloud
'''
if call != 'function':
raise SaltCloud... | Return a list of the instances that are on the provider. Only a list of
instances names, and their state, is returned.
CLI Examples:
.. code-block:: bash
salt-cloud -f list_nodes_min my-qingcloud | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L555-L580 | [
"def list_nodes_full(call=None):\n '''\n Return a list of the instances that are on the provider.\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt-cloud -F my-qingcloud\n '''\n if call == 'action':\n raise SaltCloudSystemExit(\n 'The list_nodes_full function must be cal... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | show_instance | python | def show_instance(instance_id, call=None, kwargs=None):
'''
Show the details from QingCloud concerning an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a show_instance i-2f733r5n
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance acti... | Show the details from QingCloud concerning an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a show_instance i-2f733r5n | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L601-L634 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | create | python | def create(vm_):
'''
Create a single instance from a data dict.
CLI Examples:
.. code-block:: bash
salt-cloud -p qingcloud-ubuntu-c1m1 hostname1
salt-cloud -m /path/to/mymap.sls -P
'''
try:
# Check for required profile parameters before sending any API calls.
i... | Create a single instance from a data dict.
CLI Examples:
.. code-block:: bash
salt-cloud -p qingcloud-ubuntu-c1m1 hostname1
salt-cloud -m /path/to/mymap.sls -P | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L647-L747 | [
"def destroy(instance_id, call=None):\n '''\n Destroy an instance.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-cloud -a destroy i-2f733r5n\n salt-cloud -d i-2f733r5n\n '''\n if call == 'function':\n raise SaltCloudSystemExit(\n 'The destroy action must be cal... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | start | python | def start(instance_id, call=None):
'''
Start an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a start i-2f733r5n
'''
if call != 'action':
raise SaltCloudSystemExit(
'The stop action must be called with -a or --action.'
)
log.info('Starting i... | Start an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a start i-2f733r5n | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L766-L790 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | stop | python | def stop(instance_id, force=False, call=None):
'''
Stop an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a stop i-2f733r5n
salt-cloud -a stop i-2f733r5n force=True
'''
if call != 'action':
raise SaltCloudSystemExit(
'The stop action must be calle... | Stop an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a stop i-2f733r5n
salt-cloud -a stop i-2f733r5n force=True | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L793-L819 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/cloud/clouds/qingcloud.py | destroy | python | def destroy(instance_id, call=None):
'''
Destroy an instance.
CLI Example:
.. code-block:: bash
salt-cloud -a destroy i-2f733r5n
salt-cloud -d i-2f733r5n
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --des... | Destroy an instance.
CLI Example:
.. code-block:: bash
salt-cloud -a destroy i-2f733r5n
salt-cloud -d i-2f733r5n | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L849-L894 | [
"def query(params=None):\n '''\n Make a web call to QingCloud IaaS API.\n '''\n path = 'https://api.qingcloud.com/iaas/'\n\n access_key_id = config.get_cloud_config_value(\n 'access_key_id', get_configured_provider(), __opts__, search_global=False\n )\n access_key_secret = config.get_clo... | # -*- coding: utf-8 -*-
'''
QingCloud Cloud Module
======================
.. versionadded:: 2015.8.0
The QingCloud cloud module is used to control access to the QingCloud.
http://www.qingcloud.com/
Use of this module requires the ``access_key_id``, ``secret_access_key``,
``zone`` and ``key_filename`` parameter to be... |
saltstack/salt | salt/states/grafana4_org.py | present | python | def present(name,
users=None,
theme=None,
home_dashboard_id=None,
timezone=None,
address1=None,
address2=None,
city=None,
zip_code=None,
address_state=None,
country=None,
profile='grafana'... | Ensure that an organization is present.
name
Name of the org.
users
Optional - Dict of user/role associated with the org. Example:
.. code-block:: yaml
users:
foo: Viewer
bar: Editor
theme
Optional - Selected theme for the org.
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_org.py#L60-L217 | [
"def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe... | # -*- coding: utf-8 -*-
'''
Manage Grafana v4.0 orgs
.. versionadded:: 2017.7.0
:configuration: This state requires a configuration profile to be configured
in the minion config, minion pillar, or master config. The module will use
the 'grafana' key by default, if defined.
Example configuration using bas... |
saltstack/salt | salt/states/grafana4_org.py | absent | python | def absent(name, profile='grafana'):
'''
Ensure that a org is present.
name
Name of the org to remove.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
'''
if isinstance(profile, string_types):
profile = __salt__['conf... | Ensure that a org is present.
name
Name of the org to remove.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_org.py#L220-L251 | null | # -*- coding: utf-8 -*-
'''
Manage Grafana v4.0 orgs
.. versionadded:: 2017.7.0
:configuration: This state requires a configuration profile to be configured
in the minion config, minion pillar, or master config. The module will use
the 'grafana' key by default, if defined.
Example configuration using bas... |
saltstack/salt | salt/states/ansiblegate.py | _changes | python | def _changes(plays):
'''
Find changes in ansible return data
'''
changes = {}
for play in plays['plays']:
task_changes = {}
for task in play['tasks']:
host_changes = {}
for host, data in six.iteritems(task['hosts']):
if data['changed'] is True:... | Find changes in ansible return data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ansiblegate.py#L114-L130 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
#
# Author: Bo Maryniuk <bo@suse.de>
#
# Copyright 2017 SUSE LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
saltstack/salt | salt/states/ansiblegate.py | playbooks | python | def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=None):
'''
Run Ansible Playbooks
:param name: path to playbook. This can be relative to rundir or the git repo
:param rundir: location to run ansible-playbook from.
:param git_repo: git repository to clone for ansible p... | Run Ansible Playbooks
:param name: path to playbook. This can be relative to rundir or the git repo
:param rundir: location to run ansible-playbook from.
:param git_repo: git repository to clone for ansible playbooks. This is cloned
using the `git.latest` state, and is cloned to the `... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ansiblegate.py#L134-L196 | [
"def itervalues(d, **kw):\n return d.itervalues(**kw)\n",
"def _client():\n '''\n Get a fileclient\n '''\n return salt.fileclient.get_file_client(__opts__)\n",
"def _changes(plays):\n '''\n Find changes in ansible return data\n '''\n changes = {}\n for play in plays['plays']:\n ... | # -*- coding: utf-8 -*-
#
# Author: Bo Maryniuk <bo@suse.de>
#
# Copyright 2017 SUSE LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
saltstack/salt | salt/states/netsnmp.py | _clear_community_details | python | def _clear_community_details(community_details):
'''
Clears community details.
'''
for key in ['acl', 'mode']:
_str_elem(community_details, key)
_mode = community_details.get['mode'] = community_details.get('mode').lower()
if _mode in _COMMUNITY_MODE_MAP.keys():
community_det... | Clears community details. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L113-L130 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _str_elem | python | def _str_elem(config, key):
'''
Re-adds the value of a specific key in the dict, only in case of valid str value.
'''
_value = config.pop(key, '')
if _valid_str(_value):
config[key] = _value | Re-adds the value of a specific key in the dict, only in case of valid str value. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L133-L141 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _check_config | python | def _check_config(config):
'''
Checks the desired config and clears interesting details.
'''
if not _valid_dict(config):
return True, ''
_community = config.get('community')
_community_tmp = {}
if not _community:
return False, 'Must specify at least a community.'
if _v... | Checks the desired config and clears interesting details. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L144-L189 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _create_diff_action | python | def _create_diff_action(diff, diff_key, key, value):
'''
DRY to build diff parts (added, removed, updated).
'''
if diff_key not in diff.keys():
diff[diff_key] = {}
diff[diff_key][key] = value | DRY to build diff parts (added, removed, updated). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L201-L209 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _create_diff | python | def _create_diff(diff, fun, key, prev, curr):
'''
Builds the diff dictionary.
'''
if not fun(prev):
_create_diff_action(diff, 'added', key, curr)
elif fun(prev) and not fun(curr):
_create_diff_action(diff, 'removed', key, prev)
elif not fun(curr):
_create_diff_action(di... | Builds the diff dictionary. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L212-L223 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _compute_diff | python | def _compute_diff(existing, expected):
'''
Computes the differences between the existing and the expected SNMP config.
'''
diff = {}
for key in ['location', 'contact', 'chassis_id']:
if existing.get(key) != expected.get(key):
_create_diff(diff,
_valid_... | Computes the differences between the existing and the expected SNMP config. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L226-L250 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | _configure | python | def _configure(changes):
'''
Calls the configuration template to apply the configuration changes on the device.
'''
cfgred = True
reasons = []
fun = 'update_config'
for key in ['added', 'updated', 'removed']:
_updated_changes = changes.get(key, {})
if not _updated_changes:... | Calls the configuration template to apply the configuration changes on the device. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L253-L285 | null | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/netsnmp.py | managed | python | def managed(name, config=None, defaults=None):
'''
Configures the SNMP on the device as specified in the SLS file.
SLS Example:
.. code-block:: yaml
snmp_example:
netsnmp.managed:
- config:
location: Honolulu, HI, US
- default... | Configures the SNMP on the device as specified in the SLS file.
SLS Example:
.. code-block:: yaml
snmp_example:
netsnmp.managed:
- config:
location: Honolulu, HI, US
- defaults:
contact: noc@cloudflare.com
Outp... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L292-L426 | [
"def _ordered_dict_to_dict(config):\n\n '''\n Forced the datatype to dict, in case OrderedDict is used.\n '''\n\n return loads(dumps(config))\n",
"def _expand_config(config, defaults):\n\n '''\n Completed the values of the expected config for the edge cases with the default values.\n '''\n\n ... | # -*- coding: utf-8 -*-
'''
Network SNMP
============
Manage the SNMP configuration on network devices.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm snmp management module (salt.modules.napalm_snmp) <salt.modules.n... |
saltstack/salt | salt/states/pip_state.py | _fulfills_version_spec | python | def _fulfills_version_spec(version, version_spec):
'''
Check version number against version specification info and return a
boolean value based on whether or not the version number meets the
specified version.
'''
for oper, spec in version_spec:
if oper is None:
continue
... | Check version number against version specification info and return a
boolean value based on whether or not the version number meets the
specified version. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L92-L103 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | _check_pkg_version_format | python | def _check_pkg_version_format(pkg):
'''
Takes a package name and version specification (if any) and checks it using
the pip library.
'''
ret = {'result': False, 'comment': None,
'prefix': None, 'version_spec': None}
if not HAS_PIP:
ret['comment'] = (
'An importab... | Takes a package name and version specification (if any) and checks it using
the pip library. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L106-L181 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | _check_if_installed | python | def _check_if_installed(prefix,
state_pkg_name,
version_spec,
ignore_installed,
force_reinstall,
upgrade,
user,
cwd,
bin_env,
... | Takes a package name and version specification (if any) and checks it is
installed
Keyword arguments include:
pip_list: optional dict of installed pip packages, and their versions,
to search through to check if the package is installed. If not
provided, one will be generated in ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L184-L273 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | _pep440_version_cmp | python | def _pep440_version_cmp(pkg1, pkg2, ignore_epoch=False):
'''
Compares two version strings using pkg_resources.parse_version.
Return -1 if version1 < version2, 0 if version1 ==version2,
and 1 if version1 > version2. Return None if there was a problem
making the comparison.
'''
normalize = lam... | Compares two version strings using pkg_resources.parse_version.
Return -1 if version1 < version2, 0 if version1 ==version2,
and 1 if version1 > version2. Return None if there was a problem
making the comparison. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L276-L297 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | installed | python | def installed(name,
pkgs=None,
pip_bin=None,
requirements=None,
bin_env=None,
use_wheel=False,
no_use_wheel=False,
log=None,
proxy=None,
timeout=None,
repo=None,
edit... | Make sure the package is installed
name
The name of the python package to install. You can also specify version
numbers here using the standard operators ``==, >=, <=``. If
``requirements`` is given, this parameter will be ignored.
Example:
.. code-block:: yaml
django:
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L300-L961 | [
"def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):\n '''\n Compares two version numbers. Accepts a custom function to perform the\n cmp-style version comparison, otherwise uses version_cmp().\n '''\n cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),\n '>=': (0... | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | removed | python | def removed(name,
requirements=None,
bin_env=None,
log=None,
proxy=None,
timeout=None,
user=None,
cwd=None,
use_vt=False):
'''
Make sure that a package is not installed.
name
The name of the package to u... | Make sure that a package is not installed.
name
The name of the package to uninstall
user
The user under which to run pip
bin_env : None
the pip executable or virtualenenv to use
use_vt
Use VT terminal emulation (see output while installing) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L964-L1019 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | uptodate | python | def uptodate(name,
bin_env=None,
user=None,
cwd=None,
use_vt=False):
'''
.. versionadded:: 2015.5.0
Verify that the system is completely up to date.
name
The name has no functional value and is only used as a tracking
reference
us... | .. versionadded:: 2015.5.0
Verify that the system is completely up to date.
name
The name has no functional value and is only used as a tracking
reference
user
The user under which to run pip
bin_env
the pip executable or virtualenenv to use
use_vt
Use VT te... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L1022-L1073 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/pip_state.py | mod_aggregate | python | def mod_aggregate(low, chunks, running):
'''
The mod_aggregate function which looks up all packages in the available
low chunks and merges them into a single pkgs ref in the present low data
'''
pkgs = []
pkg_type = None
agg_enabled = [
'installed',
'removed',
]
if lo... | The mod_aggregate function which looks up all packages in the available
low chunks and merges them into a single pkgs ref in the present low data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L1076-L1121 | null | # -*- coding: utf-8 -*-
'''
Installation of Python Packages Using pip
=========================================
These states manage system installed python packages. Note that pip must be
installed for these states to be available, so pip states should include a
requisite to a pkg.installed state for the package which... |
saltstack/salt | salt/states/cloud.py | present | python | def present(name, cloud_provider, onlyif=None, unless=None, opts=None, **kwargs):
'''
Spin up a single instance on a cloud provider, using salt-cloud. This state
does not take a profile argument; rather, it takes the arguments that would
normally be configured as part of the state.
Note that while ... | Spin up a single instance on a cloud provider, using salt-cloud. This state
does not take a profile argument; rather, it takes the arguments that would
normally be configured as part of the state.
Note that while this function does take any configuration argument that
would normally be used to create a... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L67-L150 | [
"def _valid(name, comment='', changes=None):\n if not changes:\n changes = {}\n return {'name': name,\n 'result': True,\n 'changes': changes,\n 'comment': comment}\n"
] | # -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
# Import python libs
from __future... |
saltstack/salt | salt/states/cloud.py | absent | python | def absent(name, onlyif=None, unless=None):
'''
Ensure that no instances with the specified names exist.
CAUTION: This is a destructive state, which will search all
configured cloud providers for the named instance,
and destroy it.
name
The name of the instance to destroy
onlyif
... | Ensure that no instances with the specified names exist.
CAUTION: This is a destructive state, which will search all
configured cloud providers for the named instance,
and destroy it.
name
The name of the instance to destroy
onlyif
Do run the state only if is unless succeed
u... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L153-L215 | [
"def _valid(name, comment='', changes=None):\n if not changes:\n changes = {}\n return {'name': name,\n 'result': True,\n 'changes': changes,\n 'comment': comment}\n"
] | # -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
# Import python libs
from __future... |
saltstack/salt | salt/states/cloud.py | profile | python | def profile(name, profile, onlyif=None, unless=None, opts=None, **kwargs):
'''
Create a single instance on a cloud provider, using a salt-cloud profile.
Note that while profiles used this function do take any configuration
argument that would normally be used to create an instance using a profile,
... | Create a single instance on a cloud provider, using a salt-cloud profile.
Note that while profiles used this function do take any configuration
argument that would normally be used to create an instance using a profile,
this state will not verify the state of any of those arguments on an
existing insta... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L218-L313 | [
"def _valid(name, comment='', changes=None):\n if not changes:\n changes = {}\n return {'name': name,\n 'result': True,\n 'changes': changes,\n 'comment': comment}\n",
"def _get_instance(names):\n # for some reason loader overwrites __opts__['test'] with default\n ... | # -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
# Import python libs
from __future... |
saltstack/salt | salt/states/cloud.py | volume_present | python | def volume_present(name, provider=None, **kwargs):
'''
Check that a block volume exists.
'''
ret = _check_name(name)
if not ret['result']:
return ret
volumes = __salt__['cloud.volume_list'](provider=provider)
if name in volumes:
ret['comment'] = 'Volume exists: {0}'.format(... | Check that a block volume exists. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L316-L347 | [
"def _check_name(name):\n ret = {'name': name,\n 'changes': {},\n 'result': None,\n 'comment': ''}\n if suc.check_name(name, 'a-zA-Z0-9._-'):\n ret['comment'] = 'Invalid characters in name.'\n ret['result'] = False\n return ret\n else:\n ret['result... | # -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
# Import python libs
from __future... |
saltstack/salt | salt/states/cloud.py | volume_attached | python | def volume_attached(name, server_name, provider=None, **kwargs):
'''
Check if a block volume is attached.
'''
ret = _check_name(name)
if not ret['result']:
return ret
ret = _check_name(server_name)
if not ret['result']:
return ret
volumes = __salt__['cloud.volume_list']... | Check if a block volume is attached. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L384-L439 | [
"def _check_name(name):\n ret = {'name': name,\n 'changes': {},\n 'result': None,\n 'comment': ''}\n if suc.check_name(name, 'a-zA-Z0-9._-'):\n ret['comment'] = 'Invalid characters in name.'\n ret['result'] = False\n return ret\n else:\n ret['result... | # -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
# Import python libs
from __future... |
saltstack/salt | salt/states/schedule.py | present | python | def present(name,
**kwargs):
'''
Ensure a job is present in the schedule
name
The unique name that is given to the scheduled job.
seconds
The scheduled job will be executed after the specified
number of seconds have passed.
minutes
The scheduled job wil... | Ensure a job is present in the schedule
name
The unique name that is given to the scheduled job.
seconds
The scheduled job will be executed after the specified
number of seconds have passed.
minutes
The scheduled job will be executed after the specified
number of m... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/schedule.py#L103-L266 | null | # -*- coding: utf-8 -*-
'''
Management of the Salt scheduler
==============================================
.. code-block:: yaml
job3:
schedule.present:
- function: test.ping
- seconds: 3600
- splay: 10
This will schedule the command: test.ping every 3600 seconds
(every hour... |
saltstack/salt | salt/states/schedule.py | disabled | python | def disabled(name, **kwargs):
'''
Ensure a job is disabled in the schedule
name
The unique name that is given to the scheduled job.
persist
Whether the job should persist between minion restarts, defaults to True.
'''
ret = {'name': name,
'result': True,
... | Ensure a job is disabled in the schedule
name
The unique name that is given to the scheduled job.
persist
Whether the job should persist between minion restarts, defaults to True. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/schedule.py#L344-L379 | null | # -*- coding: utf-8 -*-
'''
Management of the Salt scheduler
==============================================
.. code-block:: yaml
job3:
schedule.present:
- function: test.ping
- seconds: 3600
- splay: 10
This will schedule the command: test.ping every 3600 seconds
(every hour... |
saltstack/salt | salt/modules/arista_pyeapi.py | _prepare_connection | python | def _prepare_connection(**kwargs):
'''
Prepare the connection with the remote network device, and clean up the key
value pairs, removing the args used for the connection init.
'''
pyeapi_kwargs = __salt__['config.get']('pyeapi', {})
pyeapi_kwargs.update(kwargs) # merge the CLI args with the opt... | Prepare the connection with the remote network device, and clean up the key
value pairs, removing the args used for the connection init. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L158-L170 | null | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/arista_pyeapi.py | get_connection | python | def get_connection(**kwargs):
'''
Return the connection object to the pyeapi Node.
.. warning::
This function returns an unserializable object, hence it is not meant
to be used on the CLI. This should mainly be used when invoked from
other modules for the low level connection with ... | Return the connection object to the pyeapi Node.
.. warning::
This function returns an unserializable object, hence it is not meant
to be used on the CLI. This should mainly be used when invoked from
other modules for the low level connection with the network device.
kwargs
Ke... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L177-L203 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/arista_pyeapi.py | call | python | def call(method, *args, **kwargs):
'''
Invoke an arbitrary pyeapi method.
method
The name of the pyeapi method to invoke.
args
A list of arguments to send to the method invoked.
kwargs
Key-value dictionary to send to the method invoked.
transport: ``https``
Sp... | Invoke an arbitrary pyeapi method.
method
The name of the pyeapi method to invoke.
args
A list of arguments to send to the method invoked.
kwargs
Key-value dictionary to send to the method invoked.
transport: ``https``
Specifies the type of connection transport to use... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L206-L281 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/arista_pyeapi.py | run_commands | python | def run_commands(*commands, **kwargs):
'''
Sends the commands over the transport to the device.
This function sends the commands to the device using the nodes
transport. This is a lower layer function that shouldn't normally
need to be used, preferring instead to use ``config()`` or ``enable()``.
... | Sends the commands over the transport to the device.
This function sends the commands to the device using the nodes
transport. This is a lower layer function that shouldn't normally
need to be used, preferring instead to use ``config()`` or ``enable()``.
transport: ``https``
Specifies the typ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L284-L393 | [
"def call(method, *args, **kwargs):\n '''\n Invoke an arbitrary pyeapi method.\n\n method\n The name of the pyeapi method to invoke.\n\n args\n A list of arguments to send to the method invoked.\n\n kwargs\n Key-value dictionary to send to the method invoked.\n\n transport: ``... | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/arista_pyeapi.py | config | python | def config(commands=None,
config_file=None,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
**kwargs):
'''
Configures the node with the specified commands.
This method is used to send configuration commands to the node.... | Configures the node with the specified commands.
This method is used to send configuration commands to the node. It
will take either a string or a list and prepend the necessary commands
to put the session into config mode.
Returns the diff after the configuration commands are loaded.
config_fil... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L396-L534 | [
"def call(method, *args, **kwargs):\n '''\n Invoke an arbitrary pyeapi method.\n\n method\n The name of the pyeapi method to invoke.\n\n args\n A list of arguments to send to the method invoked.\n\n kwargs\n Key-value dictionary to send to the method invoked.\n\n transport: ``... | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/arista_pyeapi.py | get_config | python | def get_config(config='running-config',
params=None,
as_string=False,
**kwargs):
'''
Retrieves the config from the device.
This method will retrieve the config from the node as either a string
or a list object. The config to retrieve can be specified as eit... | Retrieves the config from the device.
This method will retrieve the config from the node as either a string
or a list object. The config to retrieve can be specified as either
the startup-config or the running-config.
config: ``running-config``
Specifies to return either the nodes ``startup-c... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L537-L623 | [
"def call(method, *args, **kwargs):\n '''\n Invoke an arbitrary pyeapi method.\n\n method\n The name of the pyeapi method to invoke.\n\n args\n A list of arguments to send to the method invoked.\n\n kwargs\n Key-value dictionary to send to the method invoked.\n\n transport: ``... | # -*- coding: utf-8 -*-
'''
Arista pyeapi
=============
.. versionadded:: 2019.2.0
Execution module to interface the connection with Arista switches, connecting to
the remote network device using the
`pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is
flexible enough to execute the commands b... |
saltstack/salt | salt/modules/openscap.py | xccdf | python | def xccdf(params):
'''
Run ``oscap xccdf`` commands on minions.
It uses cp.push_dir to upload the generated files to the salt master
in the master's minion files cachedir
(defaults to ``/var/cache/salt/master/minions/minion-id/files``)
It needs ``file_recv`` set to ``True`` in the master config... | Run ``oscap xccdf`` commands on minions.
It uses cp.push_dir to upload the generated files to the salt master
in the master's minion files cachedir
(defaults to ``/var/cache/salt/master/minions/minion-id/files``)
It needs ``file_recv`` set to ``True`` in the master configuration file.
CLI Example:... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openscap.py#L66-L115 | null | # -*- coding: utf-8 -*-
'''
Module for OpenSCAP Management
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import tempfile
import shlex
import shutil
from subprocess import Popen, PIPE
# Import Salt libs
from salt.ext import six
ArgumentParser = object
try:
im... |
saltstack/salt | salt/modules/tuned.py | list_ | python | def list_():
'''
List the profiles available
CLI Example:
.. code-block:: bash
salt '*' tuned.list
'''
result = __salt__['cmd.run']('tuned-adm list').splitlines()
# Remove "Available profiles:"
result.pop(0)
# Remove "Current active profile:.*"
result.pop()
# Outp... | List the profiles available
CLI Example:
.. code-block:: bash
salt '*' tuned.list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L36-L55 | null | # -*- coding: utf-8 -*-
'''
Interface to Red Hat tuned-adm module
:maintainer: Syed Ali <alicsyed@gmail.com>
:maturity: new
:depends: tuned-adm
:platform: Linux
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import re
# Import Salt libs
import sal... |
saltstack/salt | salt/modules/tuned.py | active | python | def active():
'''
Return current active profile
CLI Example:
.. code-block:: bash
salt '*' tuned.active
'''
# turn off all profiles
result = __salt__['cmd.run']('tuned-adm active')
pattern = re.compile(r'''(?P<stmt>Current active profile:) (?P<profile>\w+.*)''')
match = r... | Return current active profile
CLI Example:
.. code-block:: bash
salt '*' tuned.active | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L58-L73 | null | # -*- coding: utf-8 -*-
'''
Interface to Red Hat tuned-adm module
:maintainer: Syed Ali <alicsyed@gmail.com>
:maturity: new
:depends: tuned-adm
:platform: Linux
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import re
# Import Salt libs
import sal... |
saltstack/salt | salt/modules/tuned.py | profile | python | def profile(profile_name):
'''
Activate specified profile
CLI Example:
.. code-block:: bash
salt '*' tuned.profile virtual-guest
'''
# run tuned-adm with the profile specified
result = __salt__['cmd.retcode']('tuned-adm profile {0}'.format(profile_name))
if int(result) != 0:
... | Activate specified profile
CLI Example:
.. code-block:: bash
salt '*' tuned.profile virtual-guest | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L94-L109 | null | # -*- coding: utf-8 -*-
'''
Interface to Red Hat tuned-adm module
:maintainer: Syed Ali <alicsyed@gmail.com>
:maturity: new
:depends: tuned-adm
:platform: Linux
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import re
# Import Salt libs
import sal... |
saltstack/salt | salt/returners/slack_returner.py | _post_message | python | def _post_message(channel,
message,
username,
as_user,
api_key=None):
'''
Send a message to a Slack room.
:param channel: The room name.
:param message: The message to send to the Slack room.
:param username: Specify ... | Send a message to a Slack room.
:param channel: The room name.
:param message: The message to send to the Slack room.
:param username: Specify who the message is from.
:param as_user: Sets the profile picture which have been added through Slack itself.
:param api_key: The Slack ap... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_returner.py#L145-L178 | null | # -*- coding: utf-8 -*-
'''
Return salt data via slack
.. versionadded:: 2015.5.0
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack.channel (required)
slack.api_key (required)
slack.username (required)
slack.as_user (required to see the profile picture of your bot)... |
saltstack/salt | salt/returners/slack_returner.py | returner | python | def returner(ret):
'''
Send an slack message with the data
'''
_options = _get_options(ret)
channel = _options.get('channel')
username = _options.get('username')
as_user = _options.get('as_user')
api_key = _options.get('api_key')
changes = _options.get('changes')
only_show_fail... | Send an slack message with the data | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_returner.py#L181-L244 | [
"def safe_dump(data, stream=None, **kwargs):\n '''\n Use a custom dumper to ensure that defaultdict and OrderedDict are\n represented properly. Ensure that unicode strings are encoded unless\n explicitly told not to.\n '''\n if 'allow_unicode' not in kwargs:\n kwargs['allow_unicode'] = True... | # -*- coding: utf-8 -*-
'''
Return salt data via slack
.. versionadded:: 2015.5.0
The following fields can be set in the minion conf file:
.. code-block:: yaml
slack.channel (required)
slack.api_key (required)
slack.username (required)
slack.as_user (required to see the profile picture of your bot)... |
saltstack/salt | salt/metaproxy/proxy.py | handle_decoded_payload | python | def handle_decoded_payload(self, data):
'''
Override this method if you wish to handle the decoded data
differently.
'''
# Ensure payload is unicode. Disregard failure to decode binary blobs.
if six.PY2:
data = salt.utils.data.decode(data, keep=True)
if 'user' in data:
log.in... | Override this method if you wish to handle the decoded data
differently. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/metaproxy/proxy.py#L693-L777 | [
"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 -*-
#
# Proxy minion metaproxy modules
#
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import os
import signal
import sys
import types
import logging
import threading
import traceback
# Import Salt Libs
# pylint: disable=3rd-party-module-not-gated
import s... |
saltstack/salt | salt/modules/win_system.py | _convert_date_time_string | python | def _convert_date_time_string(dt_string):
'''
convert string to date time object
'''
dt_string = dt_string.split('.')[0]
dt_obj = datetime.strptime(dt_string, '%Y%m%d%H%M%S')
return dt_obj.strftime('%Y-%m-%d %H:%M:%S') | convert string to date time object | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L70-L76 | null | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | _to_unicode | python | def _to_unicode(instr):
'''
Converts from current users character encoding to unicode.
When instr has a value of None, the return value of the function
will also be None.
'''
if instr is None or isinstance(instr, six.text_type):
return instr
else:
return six.text_type(instr, ... | Converts from current users character encoding to unicode.
When instr has a value of None, the return value of the function
will also be None. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L79-L88 | null | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | reboot | python | def reboot(timeout=5, in_seconds=False, wait_for_reboot=False, # pylint: disable=redefined-outer-name
only_on_pending_reboot=False):
'''
Reboot a running system.
Args:
timeout (int):
The number of minutes/seconds before rebooting the system. Use of
minutes or se... | Reboot a running system.
Args:
timeout (int):
The number of minutes/seconds before rebooting the system. Use of
minutes or seconds depends on the value of ``in_seconds``. Default
is 5 minutes.
in_seconds (bool):
``True`` will cause the ``timeout`` p... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L165-L225 | [
"def shutdown(message=None, timeout=5, force_close=True, reboot=False, # pylint: disable=redefined-outer-name\n in_seconds=False, only_on_pending_reboot=False):\n '''\n Shutdown a running system.\n\n Args:\n\n message (str):\n The message to display to the user before shuttin... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | shutdown | python | def shutdown(message=None, timeout=5, force_close=True, reboot=False, # pylint: disable=redefined-outer-name
in_seconds=False, only_on_pending_reboot=False):
'''
Shutdown a running system.
Args:
message (str):
The message to display to the user before shutting down.
... | Shutdown a running system.
Args:
message (str):
The message to display to the user before shutting down.
timeout (int):
The length of time (in seconds) that the shutdown dialog box should
be displayed. While this dialog box is displayed, the shutdown can
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L228-L312 | [
"def _to_unicode(instr):\n '''\n Converts from current users character encoding to unicode.\n When instr has a value of None, the return value of the function\n will also be None.\n '''\n if instr is None or isinstance(instr, six.text_type):\n return instr\n else:\n return six.tex... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | shutdown_abort | python | def shutdown_abort():
'''
Abort a shutdown. Only available while the dialog box is being
displayed to the user. Once the shutdown has initiated, it cannot be
aborted.
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion... | Abort a shutdown. Only available while the dialog box is being
displayed to the user. Once the shutdown has initiated, it cannot be
aborted.
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion-id' system.shutdown_abort | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L331-L355 | null | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | set_computer_name | python | def set_computer_name(name):
'''
Set the Windows computer name
Args:
name (str):
The new name to give the computer. Requires a reboot to take effect.
Returns:
dict:
Returns a dictionary containing the old and new names if successful.
``False`` if no... | Set the Windows computer name
Args:
name (str):
The new name to give the computer. Requires a reboot to take effect.
Returns:
dict:
Returns a dictionary containing the old and new names if successful.
``False`` if not.
CLI Example:
.. code-block::... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L374-L405 | [
"def get_computer_name():\n '''\n Get the Windows computer name\n\n Returns:\n str: Returns the computer name if found. Otherwise returns ``False``.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt 'minion-id' system.get_computer_name\n '''\n name = win32api.GetComputerNameEx(wi... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | get_pending_computer_name | python | def get_pending_computer_name():
'''
Get a pending computer name. If the computer name has been changed, and the
change is pending a system reboot, this function will return the pending
computer name. Otherwise, ``None`` will be returned. If there was an error
retrieving the pending computer name, `... | Get a pending computer name. If the computer name has been changed, and the
change is pending a system reboot, this function will return the pending
computer name. Otherwise, ``None`` will be returned. If there was an error
retrieving the pending computer name, ``False`` will be returned, and an
error m... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L408-L434 | [
"def get_computer_name():\n '''\n Get the Windows computer name\n\n Returns:\n str: Returns the computer name if found. Otherwise returns ``False``.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt 'minion-id' system.get_computer_name\n '''\n name = win32api.GetComputerNameEx(wi... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | set_computer_desc | python | def set_computer_desc(desc=None):
'''
Set the Windows computer description
Args:
desc (str):
The computer description
Returns:
str: Description if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion-id' system.set_computer_desc... | Set the Windows computer description
Args:
desc (str):
The computer description
Returns:
str: Description if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion-id' system.set_computer_desc 'This computer belongs to Dave!' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L454-L496 | [
"def _to_unicode(instr):\n '''\n Converts from current users character encoding to unicode.\n When instr has a value of None, the return value of the function\n will also be None.\n '''\n if instr is None or isinstance(instr, six.text_type):\n return instr\n else:\n return six.tex... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | get_system_info | python | def get_system_info():
'''
Get system information.
Returns:
dict: Dictionary containing information about the system to include
name, description, version, etc...
CLI Example:
.. code-block:: bash
salt 'minion-id' system.get_system_info
'''
def byte_calc(val):
... | Get system information.
Returns:
dict: Dictionary containing information about the system to include
name, description, version, etc...
CLI Example:
.. code-block:: bash
salt 'minion-id' system.get_system_info | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L502-L632 | [
"def get_computer_name():\n '''\n Get the Windows computer name\n\n Returns:\n str: Returns the computer name if found. Otherwise returns ``False``.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt 'minion-id' system.get_computer_name\n '''\n name = win32api.GetComputerNameEx(wi... | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
saltstack/salt | salt/modules/win_system.py | set_hostname | python | def set_hostname(hostname):
'''
Set the hostname of the windows minion, requires a restart before this will
be updated.
.. versionadded:: 2016.3.0
Args:
hostname (str): The hostname to set
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. cod... | Set the hostname of the windows minion, requires a restart before this will
be updated.
.. versionadded:: 2016.3.0
Args:
hostname (str): The hostname to set
Returns:
bool: ``True`` if successful, otherwise ``False``
CLI Example:
.. code-block:: bash
salt 'minion-id'... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L676-L698 | null | # -*- coding: utf-8 -*-
'''
Module for managing windows systems.
:depends:
- pywintypes
- win32api
- win32con
- win32net
- wmi
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import Python libs
import ctypes
import logging
import ti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.