repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.verify_api
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...
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...
[ "def", "verify_api", "(", "self", ",", "ret", ")", ":", "if", "self", ".", "restApiId", ":", "deployed_label_json", "=", "self", ".", "_get_current_deployment_label", "(", ")", "if", "deployed_label_json", "==", "self", ".", "deployment_label_json", ":", "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 in AWS matching the given input api_name and ...
[ "this", "method", "helps", "determine", "if", "the", "given", "stage_name", "is", "already", "on", "a", "deployment", "label", "matching", "the", "input", "api_name", "swagger_file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1130-L1152
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.publish_api
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) ...
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) ...
[ "def", "publish_api", "(", "self", ",", "ret", ",", "stage_variables", ")", ":", "stage_desc", "=", "dict", "(", ")", "stage_desc", "[", "'current_deployment_label'", "]", "=", "self", ".", "deployment_label", "stage_desc_json", "=", "_dict_to_json_pretty", "(", ...
this method tie the given stage_name to a deployment matching the given swagger_file
[ "this", "method", "tie", "the", "given", "stage_name", "to", "a", "deployment", "matching", "the", "given", "swagger_file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1154-L1187
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._cleanup_api
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, ...
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, ...
[ "def", "_cleanup_api", "(", "self", ")", ":", "resources", "=", "__salt__", "[", "'boto_apigateway.describe_api_resources'", "]", "(", "restApiId", "=", "self", ".", "restApiId", ",", "*", "*", "self", ".", "_common_aws_args", ")", "if", "resources", ".", "get...
Helper method to clean up resources and models if we detected a change in the swagger file for a stage
[ "Helper", "method", "to", "clean", "up", "resources", "and", "models", "if", "we", "detected", "a", "change", "in", "the", "swagger", "file", "for", "a", "stage" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1189-L1215
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.deploy_api
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) ...
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) ...
[ "def", "deploy_api", "(", "self", ",", "ret", ")", ":", "if", "self", ".", "restApiId", ":", "res", "=", "self", ".", "_cleanup_api", "(", ")", "if", "not", "res", ".", "get", "(", "'deleted'", ")", ":", "ret", "[", "'comment'", "]", "=", "'Failed ...
this method create the top level rest api in AWS apigateway
[ "this", "method", "create", "the", "top", "level", "rest", "api", "in", "AWS", "apigateway" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1217-L1243
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.delete_api
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, ...
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, ...
[ "def", "delete_api", "(", "self", ",", "ret", ")", ":", "exists_response", "=", "__salt__", "[", "'boto_apigateway.api_exists'", "]", "(", "name", "=", "self", ".", "rest_api_name", ",", "description", "=", "_Swagger", ".", "AWS_API_DESCRIPTION", ",", "*", "*"...
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
[ "Method", "to", "delete", "a", "Rest", "Api", "named", "defined", "in", "the", "swagger", "file", "s", "Info", "Object", "s", "title", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1245-L1278
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._aws_model_ref_from_swagger_ref
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)
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)
[ "def", "_aws_model_ref_from_swagger_ref", "(", "self", ",", "r", ")", ":", "model_name", "=", "r", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "return", "'https://apigateway.amazonaws.com/restapis/{0}/models/{1}'", ".", "format", "(", "self", ".", "restAp...
Helper function to reference models created on aws apigw
[ "Helper", "function", "to", "reference", "models", "created", "on", "aws", "apigw" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1280-L1285
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._update_schema_to_aws_notation
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): ...
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): ...
[ "def", "_update_schema_to_aws_notation", "(", "self", ",", "schema", ")", ":", "result", "=", "{", "}", "for", "k", ",", "v", "in", "schema", ".", "items", "(", ")", ":", "if", "k", "==", "'$ref'", ":", "v", "=", "self", ".", "_aws_model_ref_from_swagg...
Helper function to map model schema to aws notation
[ "Helper", "function", "to", "map", "model", "schema", "to", "aws", "notation" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1287-L1298
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._build_dependent_model_list
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'] == '...
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'] == '...
[ "def", "_build_dependent_model_list", "(", "self", ",", "obj_schema", ")", ":", "dep_models_list", "=", "[", "]", "if", "obj_schema", ":", "obj_schema", "[", "'type'", "]", "=", "obj_schema", ".", "get", "(", "'type'", ",", "'object'", ")", "if", "obj_schema...
Helper function to build the list of models the given object schema is referencing.
[ "Helper", "function", "to", "build", "the", "list", "of", "models", "the", "given", "object", "schema", "is", "referencing", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1300-L1323
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._build_all_dependencies
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...
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...
[ "def", "_build_all_dependencies", "(", "self", ")", ":", "ret", "=", "{", "}", "for", "model", ",", "schema", "in", "six", ".", "iteritems", "(", "self", ".", "_models", "(", ")", ")", ":", "dep_list", "=", "self", ".", "_build_dependent_model_list", "("...
Helper function to build a map of model to their list of model reference dependencies
[ "Helper", "function", "to", "build", "a", "map", "of", "model", "to", "their", "list", "of", "model", "reference", "dependencies" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1325-L1333
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._get_model_without_dependencies
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...
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...
[ "def", "_get_model_without_dependencies", "(", "self", ",", "models_dict", ")", ":", "next_model", "=", "None", "if", "not", "models_dict", ":", "return", "next_model", "for", "model", ",", "dependencies", "in", "six", ".", "iteritems", "(", "models_dict", ")", ...
Helper function to find the next model that should be created
[ "Helper", "function", "to", "find", "the", "next", "model", "that", "should", "be", "created" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1335-L1358
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.deploy_models
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...
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...
[ "def", "deploy_models", "(", "self", ",", "ret", ")", ":", "for", "model", ",", "schema", "in", "self", ".", "models", "(", ")", ":", "# add in a few attributes into the model schema that AWS expects", "# _schema = schema.copy()", "_schema", "=", "self", ".", "_upda...
Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models ret a dictionary for returning status to Saltstack
[ "Method", "to", "deploy", "swagger", "file", "s", "definition", "objects", "and", "associated", "schema", "to", "AWS", "Apigateway", "as", "Models" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1360-L1416
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._lambda_name
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, ...
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, ...
[ "def", "_lambda_name", "(", "self", ",", "resourcePath", ",", "httpMethod", ")", ":", "lambda_name", "=", "self", ".", "_lambda_funcname_format", ".", "format", "(", "stage", "=", "self", ".", "_stage_name", ",", "api", "=", "self", ".", "rest_api_name", ","...
Helper method to construct lambda name based on the rule specified in doc string of boto_apigateway.api_present function
[ "Helper", "method", "to", "construct", "lambda", "name", "based", "on", "the", "rule", "specified", "in", "doc", "string", "of", "boto_apigateway", ".", "api_present", "function" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1418-L1430
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._lambda_uri
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...
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...
[ "def", "_lambda_uri", "(", "self", ",", "lambda_name", ",", "lambda_region", ")", ":", "profile", "=", "self", ".", "_common_aws_args", ".", "get", "(", "'profile'", ")", "region", "=", "self", ".", "_common_aws_args", ".", "get", "(", "'region'", ")", "la...
Helper Method to construct the lambda uri for use in method integration
[ "Helper", "Method", "to", "construct", "the", "lambda", "uri", "for", "use", "in", "method", "integration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1432-L1456
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._parse_method_data
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 = {} ...
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 = {} ...
[ "def", "_parse_method_data", "(", "self", ",", "method_name", ",", "method_data", ")", ":", "method_params", "=", "{", "}", "method_models", "=", "{", "}", "if", "'parameters'", "in", "method_data", ":", "for", "param", "in", "method_data", "[", "'parameters'"...
Helper function to construct the method request params, models, request_templates and integration_type values needed to configure method request integration/mappings.
[ "Helper", "function", "to", "construct", "the", "method", "request", "params", "models", "request_templates", "and", "integration_type", "values", "needed", "to", "configure", "method", "request", "integration", "/", "mappings", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1458-L1479
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._get_pattern_for_schema
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) ...
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) ...
[ "def", "_get_pattern_for_schema", "(", "self", ",", "schema_name", ",", "httpStatus", ")", ":", "defaultPattern", "=", "'.+'", "if", "self", ".", "_is_http_error_rescode", "(", "httpStatus", ")", "else", "'.*'", "model", "=", "self", ".", "_models", "(", ")", ...
returns the pattern specified in a response schema
[ "returns", "the", "pattern", "specified", "in", "a", "response", "schema" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1492-L1499
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._parse_method_response
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_...
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_...
[ "def", "_parse_method_response", "(", "self", ",", "method_name", ",", "method_response", ",", "httpStatus", ")", ":", "method_response_models", "=", "{", "}", "method_response_pattern", "=", "'.*'", "if", "method_response", ".", "schema", ":", "method_response_models...
Helper function to construct the method response params, models, and integration_params values needed to configure method response integration/mappings.
[ "Helper", "function", "to", "construct", "the", "method", "response", "params", "models", "and", "integration_params", "values", "needed", "to", "configure", "method", "response", "integration", "/", "mappings", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1510-L1536
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger._deploy_method
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. ...
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. ...
[ "def", "_deploy_method", "(", "self", ",", "ret", ",", "resource_path", ",", "method_name", ",", "method_data", ",", "api_key_required", ",", "lambda_integration_role", ",", "lambda_region", ",", "authorization_type", ")", ":", "method", "=", "self", ".", "_parse_...
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...
[ "Method", "to", "create", "a", "method", "for", "the", "given", "resource", "path", "along", "with", "its", "associated", "request", "and", "response", "integrations", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1538-L1650
train
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.deploy_resources
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 ...
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 ...
[ "def", "deploy_resources", "(", "self", ",", "ret", ",", "api_key_required", ",", "lambda_integration_role", ",", "lambda_region", ",", "authorization_type", ")", ":", "for", "path", ",", "pathData", "in", "self", ".", "paths", ":", "resource", "=", "__salt__", ...
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...
[ "Method", "to", "deploy", "resources", "defined", "in", "the", "swagger", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1652-L1685
train
saltstack/salt
salt/states/pagerduty.py
create_event
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' ...
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' ...
[ "def", "create_event", "(", "name", ",", "details", ",", "service_key", ",", "profile", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "__opts__...
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 ...
[ "Create", "an", "event", "on", "the", "PagerDuty", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pagerduty.py#L32-L75
train
saltstack/salt
salt/states/mysql_query.py
run_file
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....
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....
[ "def", "run_file", "(", "name", ",", "database", ",", "query_file", "=", "None", ",", "output", "=", "None", ",", "grain", "=", "None", ",", "key", "=", "None", ",", "overwrite", "=", "True", ",", "saltenv", "=", "None", ",", "check_db_exists", "=", ...
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 ...
[ "Execute", "an", "arbitrary", "query", "on", "the", "specified", "database" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_query.py#L53-L222
train
saltstack/salt
salt/states/mysql_query.py
run
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...
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...
[ "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 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...
[ "Execute", "an", "arbitrary", "query", "on", "the", "specified", "database" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_query.py#L225-L381
train
saltstack/salt
salt/utils/s3.py
query
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=...
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=...
[ "def", "query", "(", "key", ",", "keyid", ",", "method", "=", "'GET'", ",", "params", "=", "None", ",", "headers", "=", "None", ",", "requesturl", "=", "None", ",", "return_url", "=", "False", ",", "bucket", "=", "None", ",", "service_url", "=", "Non...
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...
[ "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", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/s3.py#L32-L279
train
saltstack/salt
salt/utils/atomicfile.py
atomic_open
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'): ...
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'): ...
[ "def", "atomic_open", "(", "filename", ",", "mode", "=", "'w'", ")", ":", "if", "mode", "in", "(", "'r'", ",", "'rb'", ",", "'r+'", ",", "'rb+'", ",", "'a'", ",", "'ab'", ")", ":", "raise", "TypeError", "(", "'Read or append modes don\\'t work with atomic_...
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
[ "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", "be...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/atomicfile.py#L153-L169
train
saltstack/salt
salt/pillar/nodegroups.py
ext_pillar
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...
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...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "pillar_name", "=", "None", ")", ":", "pillar_name", "=", "pillar_name", "or", "'nodegroups'", "all_nodegroups", "=", "__opts__", "[", "'nodegroups'", "]", "nodegroups_minion_is_in", "=", "[", "]", "ckmi...
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' ...
[ "A", "salt", "external", "pillar", "which", "provides", "the", "list", "of", "nodegroups", "of", "which", "the", "minion", "is", "a", "member", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/nodegroups.py#L49-L73
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
_compute_signature
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...
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...
[ "def", "_compute_signature", "(", "parameters", ",", "access_key_secret", ",", "method", ",", "path", ")", ":", "parameters", "[", "'signature_method'", "]", "=", "'HmacSHA256'", "string_to_sign", "=", "'{0}\\n{1}\\n'", ".", "format", "(", "method", ".", "upper", ...
Generate an API request signature. Detailed document can be found at: https://docs.qingcloud.com/api/common/signature.html
[ "Generate", "an", "API", "request", "signature", ".", "Detailed", "document", "can", "be", "found", "at", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L105-L128
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
query
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...
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...
[ "def", "query", "(", "params", "=", "None", ")", ":", "path", "=", "'https://api.qingcloud.com/iaas/'", "access_key_id", "=", "config", ".", "get_cloud_config_value", "(", "'access_key_id'", ",", "get_configured_provider", "(", ")", ",", "__opts__", ",", "search_glo...
Make a web call to QingCloud IaaS API.
[ "Make", "a", "web", "call", "to", "QingCloud", "IaaS", "API", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L131-L201
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
avail_locations
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...
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...
[ "def", "avail_locations", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The avail_locations function must be called with '", "'-f or --function, or with the --list-locations option'", ")", "params", "=", "{",...
Return a dict of all available locations on the provider with relevant data. CLI Examples: .. code-block:: bash salt-cloud --list-locations my-qingcloud
[ "Return", "a", "dict", "of", "all", "available", "locations", "on", "the", "provider", "with", "relevant", "data", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L204-L232
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
avail_images
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...
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...
[ "def", "avail_images", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The avail_images function must be called with '", "'-f or --function, or with the --list-images option'", ")"...
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
[ "Return", "a", "list", "of", "the", "images", "that", "are", "on", "the", "provider", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L271-L304
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
show_image
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...
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...
[ "def", "show_image", "(", "kwargs", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_images function must be called with '", "'-f or --function'", ")", "if", "not", "isinstance", "(", "kwargs"...
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
[ "Show", "the", "details", "from", "QingCloud", "concerning", "an", "image", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L327-L368
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
avail_sizes
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...
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...
[ "def", "avail_sizes", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The avail_sizes function must be called with '", "'-f or --function, or with the --list-sizes option'", ")", ...
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
[ "Return", "a", "list", "of", "the", "instance", "sizes", "that", "are", "on", "the", "provider", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L399-L424
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
_show_normalized_node
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...
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...
[ "def", "_show_normalized_node", "(", "full_node", ")", ":", "public_ips", "=", "full_node", ".", "get", "(", "'eip'", ",", "[", "]", ")", "if", "public_ips", ":", "public_ip", "=", "public_ips", "[", "'eip_addr'", "]", "public_ips", "=", "[", "public_ip", ...
Normalize the QingCloud instance data. Used by list_nodes()-related functions.
[ "Normalize", "the", "QingCloud", "instance", "data", ".", "Used", "by", "list_nodes", "()", "-", "related", "functions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L448-L473
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
list_nodes_full
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 --...
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 --...
[ "def", "list_nodes_full", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes_full function must be called with -f or --function.'", ")", "zone", "=", "_get_specified_zone", "(", ")", "params", ...
Return a list of the instances that are on the provider. CLI Examples: .. code-block:: bash salt-cloud -F my-qingcloud
[ "Return", "a", "list", "of", "the", "instances", "that", "are", "on", "the", "provider", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L476-L521
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
list_nodes
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.'...
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.'...
[ "def", "list_nodes", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes function must be called with -f or --function.'", ")", "nodes", "=", "list_nodes_full", "(", ")", "ret", "=", "{", "...
Return a list of the instances that are on the provider. CLI Examples: .. code-block:: bash salt-cloud -Q my-qingcloud
[ "Return", "a", "list", "of", "the", "instances", "that", "are", "on", "the", "provider", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L524-L552
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
list_nodes_min
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...
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...
[ "def", "list_nodes_min", "(", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes_min function must be called with -f or --function.'", ")", "nodes", "=", "list_nodes_full", "(", ")", "result", "=...
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
[ "Return", "a", "list", "of", "the", "instances", "that", "are", "on", "the", "provider", ".", "Only", "a", "list", "of", "instances", "names", "and", "their", "state", "is", "returned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L555-L580
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
show_instance
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...
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...
[ "def", "show_instance", "(", "instance_id", ",", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_instance action must be called with -a or --action.'", ")", "params", "="...
Show the details from QingCloud concerning an instance. CLI Examples: .. code-block:: bash salt-cloud -a show_instance i-2f733r5n
[ "Show", "the", "details", "from", "QingCloud", "concerning", "an", "instance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L601-L634
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
create
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...
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...
[ "def", "create", "(", "vm_", ")", ":", "try", ":", "# Check for required profile parameters before sending any API calls.", "if", "vm_", "[", "'profile'", "]", "and", "config", ".", "is_profile_configured", "(", "__opts__", ",", "__active_provider_name__", "or", "'qingc...
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
[ "Create", "a", "single", "instance", "from", "a", "data", "dict", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L647-L747
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
start
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...
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...
[ "def", "start", "(", "instance_id", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The stop action must be called with -a or --action.'", ")", "log", ".", "info", "(", "'Starting instance %s'", ",", ...
Start an instance. CLI Examples: .. code-block:: bash salt-cloud -a start i-2f733r5n
[ "Start", "an", "instance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L766-L790
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
stop
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...
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...
[ "def", "stop", "(", "instance_id", ",", "force", "=", "False", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The stop action must be called with -a or --action.'", ")", "log", ".", "info", "(", ...
Stop an instance. CLI Examples: .. code-block:: bash salt-cloud -a stop i-2f733r5n salt-cloud -a stop i-2f733r5n force=True
[ "Stop", "an", "instance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L793-L819
train
saltstack/salt
salt/cloud/clouds/qingcloud.py
destroy
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...
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...
[ "def", "destroy", "(", "instance_id", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The destroy action must be called with -d, --destroy, '", "'-a or --action.'", ")", "instance_data", "=", "show_instan...
Destroy an instance. CLI Example: .. code-block:: bash salt-cloud -a destroy i-2f733r5n salt-cloud -d i-2f733r5n
[ "Destroy", "an", "instance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/qingcloud.py#L849-L894
train
saltstack/salt
salt/states/grafana4_org.py
present
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'...
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'...
[ "def", "present", "(", "name", ",", "users", "=", "None", ",", "theme", "=", "None", ",", "home_dashboard_id", "=", "None", ",", "timezone", "=", "None", ",", "address1", "=", "None", ",", "address2", "=", "None", ",", "city", "=", "None", ",", "zip_...
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. ...
[ "Ensure", "that", "an", "organization", "is", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_org.py#L60-L217
train
saltstack/salt
salt/states/grafana4_org.py
absent
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...
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...
[ "def", "absent", "(", "name", ",", "profile", "=", "'grafana'", ")", ":", "if", "isinstance", "(", "profile", ",", "string_types", ")", ":", "profile", "=", "__salt__", "[", "'config.option'", "]", "(", "profile", ")", "ret", "=", "{", "'name'", ":", "...
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'.
[ "Ensure", "that", "a", "org", "is", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_org.py#L220-L251
train
saltstack/salt
salt/states/ansiblegate.py
_changes
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:...
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:...
[ "def", "_changes", "(", "plays", ")", ":", "changes", "=", "{", "}", "for", "play", "in", "plays", "[", "'plays'", "]", ":", "task_changes", "=", "{", "}", "for", "task", "in", "play", "[", "'tasks'", "]", ":", "host_changes", "=", "{", "}", "for",...
Find changes in ansible return data
[ "Find", "changes", "in", "ansible", "return", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ansiblegate.py#L114-L130
train
saltstack/salt
salt/states/ansiblegate.py
playbooks
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...
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...
[ "def", "playbooks", "(", "name", ",", "rundir", "=", "None", ",", "git_repo", "=", "None", ",", "git_kwargs", "=", "None", ",", "ansible_kwargs", "=", "None", ")", ":", "ret", "=", "{", "'result'", ":", "False", ",", "'changes'", ":", "{", "}", ",", ...
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 `...
[ "Run", "Ansible", "Playbooks" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ansiblegate.py#L134-L196
train
saltstack/salt
salt/states/netsnmp.py
_clear_community_details
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...
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...
[ "def", "_clear_community_details", "(", "community_details", ")", ":", "for", "key", "in", "[", "'acl'", ",", "'mode'", "]", ":", "_str_elem", "(", "community_details", ",", "key", ")", "_mode", "=", "community_details", ".", "get", "[", "'mode'", "]", "=", ...
Clears community details.
[ "Clears", "community", "details", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L113-L130
train
saltstack/salt
salt/states/netsnmp.py
_str_elem
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
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
[ "def", "_str_elem", "(", "config", ",", "key", ")", ":", "_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.
[ "Re", "-", "adds", "the", "value", "of", "a", "specific", "key", "in", "the", "dict", "only", "in", "case", "of", "valid", "str", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L133-L141
train
saltstack/salt
salt/states/netsnmp.py
_check_config
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...
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...
[ "def", "_check_config", "(", "config", ")", ":", "if", "not", "_valid_dict", "(", "config", ")", ":", "return", "True", ",", "''", "_community", "=", "config", ".", "get", "(", "'community'", ")", "_community_tmp", "=", "{", "}", "if", "not", "_community...
Checks the desired config and clears interesting details.
[ "Checks", "the", "desired", "config", "and", "clears", "interesting", "details", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L144-L189
train
saltstack/salt
salt/states/netsnmp.py
_create_diff_action
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
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
[ "def", "_create_diff_action", "(", "diff", ",", "diff_key", ",", "key", ",", "value", ")", ":", "if", "diff_key", "not", "in", "diff", ".", "keys", "(", ")", ":", "diff", "[", "diff_key", "]", "=", "{", "}", "diff", "[", "diff_key", "]", "[", "key"...
DRY to build diff parts (added, removed, updated).
[ "DRY", "to", "build", "diff", "parts", "(", "added", "removed", "updated", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L201-L209
train
saltstack/salt
salt/states/netsnmp.py
_create_diff
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...
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...
[ "def", "_create_diff", "(", "diff", ",", "fun", ",", "key", ",", "prev", ",", "curr", ")", ":", "if", "not", "fun", "(", "prev", ")", ":", "_create_diff_action", "(", "diff", ",", "'added'", ",", "key", ",", "curr", ")", "elif", "fun", "(", "prev",...
Builds the diff dictionary.
[ "Builds", "the", "diff", "dictionary", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L212-L223
train
saltstack/salt
salt/states/netsnmp.py
_compute_diff
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_...
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_...
[ "def", "_compute_diff", "(", "existing", ",", "expected", ")", ":", "diff", "=", "{", "}", "for", "key", "in", "[", "'location'", ",", "'contact'", ",", "'chassis_id'", "]", ":", "if", "existing", ".", "get", "(", "key", ")", "!=", "expected", ".", "...
Computes the differences between the existing and the expected SNMP config.
[ "Computes", "the", "differences", "between", "the", "existing", "and", "the", "expected", "SNMP", "config", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L226-L250
train
saltstack/salt
salt/states/netsnmp.py
_configure
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:...
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:...
[ "def", "_configure", "(", "changes", ")", ":", "cfgred", "=", "True", "reasons", "=", "[", "]", "fun", "=", "'update_config'", "for", "key", "in", "[", "'added'", ",", "'updated'", ",", "'removed'", "]", ":", "_updated_changes", "=", "changes", ".", "get...
Calls the configuration template to apply the configuration changes on the device.
[ "Calls", "the", "configuration", "template", "to", "apply", "the", "configuration", "changes", "on", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L253-L285
train
saltstack/salt
salt/states/netsnmp.py
managed
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...
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...
[ "def", "managed", "(", "name", ",", "config", "=", "None", ",", "defaults", "=", "None", ")", ":", "result", "=", "False", "comment", "=", "''", "changes", "=", "{", "}", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "changes", ","...
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...
[ "Configures", "the", "SNMP", "on", "the", "device", "as", "specified", "in", "the", "SLS", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netsnmp.py#L292-L426
train
saltstack/salt
salt/states/pip_state.py
_fulfills_version_spec
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 ...
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 ...
[ "def", "_fulfills_version_spec", "(", "version", ",", "version_spec", ")", ":", "for", "oper", ",", "spec", "in", "version_spec", ":", "if", "oper", "is", "None", ":", "continue", "if", "not", "salt", ".", "utils", ".", "versions", ".", "compare", "(", "...
Check version number against version specification info and return a boolean value based on whether or not the version number meets the specified version.
[ "Check", "version", "number", "against", "version", "specification", "info", "and", "return", "a", "boolean", "value", "based", "on", "whether", "or", "not", "the", "version", "number", "meets", "the", "specified", "version", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L92-L103
train
saltstack/salt
salt/states/pip_state.py
_check_pkg_version_format
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...
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...
[ "def", "_check_pkg_version_format", "(", "pkg", ")", ":", "ret", "=", "{", "'result'", ":", "False", ",", "'comment'", ":", "None", ",", "'prefix'", ":", "None", ",", "'version_spec'", ":", "None", "}", "if", "not", "HAS_PIP", ":", "ret", "[", "'comment'...
Takes a package name and version specification (if any) and checks it using the pip library.
[ "Takes", "a", "package", "name", "and", "version", "specification", "(", "if", "any", ")", "and", "checks", "it", "using", "the", "pip", "library", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L106-L181
train
saltstack/salt
salt/states/pip_state.py
_check_if_installed
def _check_if_installed(prefix, state_pkg_name, version_spec, ignore_installed, force_reinstall, upgrade, user, cwd, bin_env, ...
python
def _check_if_installed(prefix, state_pkg_name, version_spec, ignore_installed, force_reinstall, upgrade, user, cwd, bin_env, ...
[ "def", "_check_if_installed", "(", "prefix", ",", "state_pkg_name", ",", "version_spec", ",", "ignore_installed", ",", "force_reinstall", ",", "upgrade", ",", "user", ",", "cwd", ",", "bin_env", ",", "env_vars", ",", "index_url", ",", "extra_index_url", ",", "pi...
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 ...
[ "Takes", "a", "package", "name", "and", "version", "specification", "(", "if", "any", ")", "and", "checks", "it", "is", "installed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L184-L273
train
saltstack/salt
salt/states/pip_state.py
_pep440_version_cmp
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...
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...
[ "def", "_pep440_version_cmp", "(", "pkg1", ",", "pkg2", ",", "ignore_epoch", "=", "False", ")", ":", "normalize", "=", "lambda", "x", ":", "six", ".", "text_type", "(", "x", ")", ".", "split", "(", "'!'", ",", "1", ")", "[", "-", "1", "]", "if", ...
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.
[ "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"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L276-L297
train
saltstack/salt
salt/states/pip_state.py
installed
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...
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...
[ "def", "installed", "(", "name", ",", "pkgs", "=", "None", ",", "pip_bin", "=", "None", ",", "requirements", "=", "None", ",", "bin_env", "=", "None", ",", "use_wheel", "=", "False", ",", "no_use_wheel", "=", "False", ",", "log", "=", "None", ",", "p...
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: ...
[ "Make", "sure", "the", "package", "is", "installed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L300-L961
train
saltstack/salt
salt/states/pip_state.py
removed
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...
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...
[ "def", "removed", "(", "name", ",", "requirements", "=", "None", ",", "bin_env", "=", "None", ",", "log", "=", "None", ",", "proxy", "=", "None", ",", "timeout", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "use_vt", "=", ...
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)
[ "Make", "sure", "that", "a", "package", "is", "not", "installed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L964-L1019
train
saltstack/salt
salt/states/pip_state.py
uptodate
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...
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...
[ "def", "uptodate", "(", "name", ",", "bin_env", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "use_vt", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", ...
.. 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...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L1022-L1073
train
saltstack/salt
salt/states/pip_state.py
mod_aggregate
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...
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...
[ "def", "mod_aggregate", "(", "low", ",", "chunks", ",", "running", ")", ":", "pkgs", "=", "[", "]", "pkg_type", "=", "None", "agg_enabled", "=", "[", "'installed'", ",", "'removed'", ",", "]", "if", "low", ".", "get", "(", "'fun'", ")", "not", "in", ...
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
[ "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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L1076-L1121
train
saltstack/salt
salt/states/cloud.py
present
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 ...
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 ...
[ "def", "present", "(", "name", ",", "cloud_provider", ",", "onlyif", "=", "None", ",", "unless", "=", "None", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",...
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...
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L67-L150
train
saltstack/salt
salt/states/cloud.py
absent
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 ...
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 ...
[ "def", "absent", "(", "name", ",", "onlyif", "=", "None", ",", "unless", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "retcode", "=...
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...
[ "Ensure", "that", "no", "instances", "with", "the", "specified", "names", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L153-L215
train
saltstack/salt
salt/states/cloud.py
profile
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, ...
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, ...
[ "def", "profile", "(", "name", ",", "profile", ",", "onlyif", "=", "None", ",", "unless", "=", "None", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'...
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...
[ "Create", "a", "single", "instance", "on", "a", "cloud", "provider", "using", "a", "salt", "-", "cloud", "profile", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L218-L313
train
saltstack/salt
salt/states/cloud.py
volume_present
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(...
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(...
[ "def", "volume_present", "(", "name", ",", "provider", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "_check_name", "(", "name", ")", "if", "not", "ret", "[", "'result'", "]", ":", "return", "ret", "volumes", "=", "__salt__", "[", "'clo...
Check that a block volume exists.
[ "Check", "that", "a", "block", "volume", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L316-L347
train
saltstack/salt
salt/states/cloud.py
volume_attached
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']...
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']...
[ "def", "volume_attached", "(", "name", ",", "server_name", ",", "provider", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "_check_name", "(", "name", ")", "if", "not", "ret", "[", "'result'", "]", ":", "return", "ret", "ret", "=", "_che...
Check if a block volume is attached.
[ "Check", "if", "a", "block", "volume", "is", "attached", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L384-L439
train
saltstack/salt
salt/states/schedule.py
present
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...
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...
[ "def", "present", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "[", "]", "}", "current_schedule", "=", "__salt__", "[",...
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...
[ "Ensure", "a", "job", "is", "present", "in", "the", "schedule" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/schedule.py#L103-L266
train
saltstack/salt
salt/states/schedule.py
disabled
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, ...
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, ...
[ "def", "disabled", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "[", "]", "}", "current_schedule", "=", "__salt__", "["...
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.
[ "Ensure", "a", "job", "is", "disabled", "in", "the", "schedule" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/schedule.py#L344-L379
train
saltstack/salt
salt/modules/arista_pyeapi.py
_prepare_connection
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...
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...
[ "def", "_prepare_connection", "(", "*", "*", "kwargs", ")", ":", "pyeapi_kwargs", "=", "__salt__", "[", "'config.get'", "]", "(", "'pyeapi'", ",", "{", "}", ")", "pyeapi_kwargs", ".", "update", "(", "kwargs", ")", "# merge the CLI args with the opts/pillar", "in...
Prepare the connection with the remote network device, and clean up the key value pairs, removing the args used for the connection init.
[ "Prepare", "the", "connection", "with", "the", "remote", "network", "device", "and", "clean", "up", "the", "key", "value", "pairs", "removing", "the", "args", "used", "for", "the", "connection", "init", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L158-L170
train
saltstack/salt
salt/modules/arista_pyeapi.py
get_connection
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 ...
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 ...
[ "def", "get_connection", "(", "*", "*", "kwargs", ")", ":", "kwargs", "=", "clean_kwargs", "(", "*", "*", "kwargs", ")", "if", "'pyeapi.conn'", "in", "__proxy__", ":", "return", "__proxy__", "[", "'pyeapi.conn'", "]", "(", ")", "conn", ",", "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 the network device. kwargs Ke...
[ "Return", "the", "connection", "object", "to", "the", "pyeapi", "Node", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L177-L203
train
saltstack/salt
salt/modules/arista_pyeapi.py
call
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...
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...
[ "def", "call", "(", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "clean_kwargs", "(", "*", "*", "kwargs", ")", "if", "'pyeapi.call'", "in", "__proxy__", ":", "return", "__proxy__", "[", "'pyeapi.call'", "]", "(", "metho...
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...
[ "Invoke", "an", "arbitrary", "pyeapi", "method", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L206-L281
train
saltstack/salt
salt/modules/arista_pyeapi.py
run_commands
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()``. ...
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()``. ...
[ "def", "run_commands", "(", "*", "commands", ",", "*", "*", "kwargs", ")", ":", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "'json'", ")", "send_enable", "=", "kwargs", ".", "pop", "(", "'send_enable'", ",", "True", ")", "output", "=...
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...
[ "Sends", "the", "commands", "over", "the", "transport", "to", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L284-L393
train
saltstack/salt
salt/modules/arista_pyeapi.py
config
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....
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....
[ "def", "config", "(", "commands", "=", "None", ",", "config_file", "=", "None", ",", "template_engine", "=", "'jinja'", ",", "context", "=", "None", ",", "defaults", "=", "None", ",", "saltenv", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", "initia...
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...
[ "Configures", "the", "node", "with", "the", "specified", "commands", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L396-L534
train
saltstack/salt
salt/modules/arista_pyeapi.py
get_config
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...
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...
[ "def", "get_config", "(", "config", "=", "'running-config'", ",", "params", "=", "None", ",", "as_string", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "call", "(", "'get_config'", ",", "config", "=", "config", ",", "params", "=", "params",...
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...
[ "Retrieves", "the", "config", "from", "the", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L537-L623
train
saltstack/salt
salt/modules/openscap.py
xccdf
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...
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...
[ "def", "xccdf", "(", "params", ")", ":", "params", "=", "shlex", ".", "split", "(", "params", ")", "policy", "=", "params", "[", "-", "1", "]", "success", "=", "True", "error", "=", "None", "upload_dir", "=", "None", "action", "=", "None", "returncod...
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:...
[ "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", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openscap.py#L66-L115
train
saltstack/salt
salt/modules/tuned.py
list_
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...
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...
[ "def", "list_", "(", ")", ":", "result", "=", "__salt__", "[", "'cmd.run'", "]", "(", "'tuned-adm list'", ")", ".", "splitlines", "(", ")", "# Remove \"Available profiles:\"", "result", ".", "pop", "(", "0", ")", "# Remove \"Current active profile:.*\"", "result",...
List the profiles available CLI Example: .. code-block:: bash salt '*' tuned.list
[ "List", "the", "profiles", "available" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L36-L55
train
saltstack/salt
salt/modules/tuned.py
active
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...
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...
[ "def", "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", "=", ...
Return current active profile CLI Example: .. code-block:: bash salt '*' tuned.active
[ "Return", "current", "active", "profile" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L58-L73
train
saltstack/salt
salt/modules/tuned.py
profile
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: ...
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: ...
[ "def", "profile", "(", "profile_name", ")", ":", "# run tuned-adm with the profile specified", "result", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "'tuned-adm profile {0}'", ".", "format", "(", "profile_name", ")", ")", "if", "int", "(", "result", ")", "!="...
Activate specified profile CLI Example: .. code-block:: bash salt '*' tuned.profile virtual-guest
[ "Activate", "specified", "profile" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L94-L109
train
saltstack/salt
salt/returners/slack_returner.py
_post_message
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 ...
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 ...
[ "def", "_post_message", "(", "channel", ",", "message", ",", "username", ",", "as_user", ",", "api_key", "=", "None", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'channel'", "]", "=", "channel", "parameters", "[", "'username'", "]", ...
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...
[ "Send", "a", "message", "to", "a", "Slack", "room", ".", ":", "param", "channel", ":", "The", "room", "name", ".", ":", "param", "message", ":", "The", "message", "to", "send", "to", "the", "Slack", "room", ".", ":", "param", "username", ":", "Specif...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_returner.py#L145-L178
train
saltstack/salt
salt/returners/slack_returner.py
returner
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...
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...
[ "def", "returner", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "channel", "=", "_options", ".", "get", "(", "'channel'", ")", "username", "=", "_options", ".", "get", "(", "'username'", ")", "as_user", "=", "_options", ".", ...
Send an slack message with the data
[ "Send", "an", "slack", "message", "with", "the", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/slack_returner.py#L181-L244
train
saltstack/salt
salt/metaproxy/proxy.py
handle_decoded_payload
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...
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...
[ "def", "handle_decoded_payload", "(", "self", ",", "data", ")", ":", "# Ensure payload is unicode. Disregard failure to decode binary blobs.", "if", "six", ".", "PY2", ":", "data", "=", "salt", ".", "utils", ".", "data", ".", "decode", "(", "data", ",", "keep", ...
Override this method if you wish to handle the decoded data differently.
[ "Override", "this", "method", "if", "you", "wish", "to", "handle", "the", "decoded", "data", "differently", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/metaproxy/proxy.py#L693-L777
train
saltstack/salt
salt/modules/win_system.py
_convert_date_time_string
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')
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')
[ "def", "_convert_date_time_string", "(", "dt_string", ")", ":", "dt_string", "=", "dt_string", ".", "split", "(", "'.'", ")", "[", "0", "]", "dt_obj", "=", "datetime", ".", "strptime", "(", "dt_string", ",", "'%Y%m%d%H%M%S'", ")", "return", "dt_obj", ".", ...
convert string to date time object
[ "convert", "string", "to", "date", "time", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L70-L76
train
saltstack/salt
salt/modules/win_system.py
_to_unicode
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, ...
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, ...
[ "def", "_to_unicode", "(", "instr", ")", ":", "if", "instr", "is", "None", "or", "isinstance", "(", "instr", ",", "six", ".", "text_type", ")", ":", "return", "instr", "else", ":", "return", "six", ".", "text_type", "(", "instr", ",", "'utf8'", ")" ]
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.
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L79-L88
train
saltstack/salt
salt/modules/win_system.py
reboot
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...
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...
[ "def", "reboot", "(", "timeout", "=", "5", ",", "in_seconds", "=", "False", ",", "wait_for_reboot", "=", "False", ",", "# pylint: disable=redefined-outer-name", "only_on_pending_reboot", "=", "False", ")", ":", "ret", "=", "shutdown", "(", "timeout", "=", "timeo...
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...
[ "Reboot", "a", "running", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L165-L225
train
saltstack/salt
salt/modules/win_system.py
shutdown
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. ...
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. ...
[ "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. 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 ...
[ "Shutdown", "a", "running", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L228-L312
train
saltstack/salt
salt/modules/win_system.py
shutdown_abort
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...
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...
[ "def", "shutdown_abort", "(", ")", ":", "try", ":", "win32api", ".", "AbortSystemShutdown", "(", "'127.0.0.1'", ")", "return", "True", "except", "pywintypes", ".", "error", "as", "exc", ":", "(", "number", ",", "context", ",", "message", ")", "=", "exc", ...
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
[ "Abort", "a", "shutdown", ".", "Only", "available", "while", "the", "dialog", "box", "is", "being", "displayed", "to", "the", "user", ".", "Once", "the", "shutdown", "has", "initiated", "it", "cannot", "be", "aborted", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L331-L355
train
saltstack/salt
salt/modules/win_system.py
set_computer_name
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...
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...
[ "def", "set_computer_name", "(", "name", ")", ":", "if", "six", ".", "PY2", ":", "name", "=", "_to_unicode", "(", "name", ")", "if", "windll", ".", "kernel32", ".", "SetComputerNameExW", "(", "win32con", ".", "ComputerNamePhysicalDnsHostname", ",", "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 not. CLI Example: .. code-block::...
[ "Set", "the", "Windows", "computer", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L374-L405
train
saltstack/salt
salt/modules/win_system.py
get_pending_computer_name
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, `...
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, `...
[ "def", "get_pending_computer_name", "(", ")", ":", "current", "=", "get_computer_name", "(", ")", "pending", "=", "__utils__", "[", "'reg.read_value'", "]", "(", "'HKLM'", ",", "r'SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters'", ",", "'NV Hostname'", ")", "[", ...
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...
[ "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", ".", "O...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L408-L434
train
saltstack/salt
salt/modules/win_system.py
set_computer_desc
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...
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...
[ "def", "set_computer_desc", "(", "desc", "=", "None", ")", ":", "if", "six", ".", "PY2", ":", "desc", "=", "_to_unicode", "(", "desc", ")", "# Make sure the system exists", "# Return an object containing current information array for the computer", "system_info", "=", "...
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!'
[ "Set", "the", "Windows", "computer", "description" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L454-L496
train
saltstack/salt
salt/modules/win_system.py
get_system_info
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): ...
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): ...
[ "def", "get_system_info", "(", ")", ":", "def", "byte_calc", "(", "val", ")", ":", "val", "=", "float", "(", "val", ")", "if", "val", "<", "2", "**", "10", ":", "return", "'{0:.3f}B'", ".", "format", "(", "val", ")", "elif", "val", "<", "2", "**"...
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
[ "Get", "system", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L502-L632
train
saltstack/salt
salt/modules/win_system.py
set_hostname
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...
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...
[ "def", "set_hostname", "(", "hostname", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "conn", "=", "wmi", ".", "WMI", "(", ")", "comp", "=", "conn", ".", "Win32_ComputerSystem", "(", ")", "[", "0", "]", "return",...
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'...
[ "Set", "the", "hostname", "of", "the", "windows", "minion", "requires", "a", "restart", "before", "this", "will", "be", "updated", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L676-L698
train
saltstack/salt
salt/modules/win_system.py
join_domain
def join_domain(domain, username=None, password=None, account_ou=None, account_exists=False, restart=False): ''' Join a computer to an Active Directory domain. Requires a reboot. Args: domain (str): The dom...
python
def join_domain(domain, username=None, password=None, account_ou=None, account_exists=False, restart=False): ''' Join a computer to an Active Directory domain. Requires a reboot. Args: domain (str): The dom...
[ "def", "join_domain", "(", "domain", ",", "username", "=", "None", ",", "password", "=", "None", ",", "account_ou", "=", "None", ",", "account_exists", "=", "False", ",", "restart", "=", "False", ")", ":", "if", "six", ".", "PY2", ":", "domain", "=", ...
Join a computer to an Active Directory domain. Requires a reboot. Args: domain (str): The domain to which the computer should be joined, e.g. ``example.com`` username (str): Username of an account which is authorized to join computers to the specifi...
[ "Join", "a", "computer", "to", "an", "Active", "Directory", "domain", ".", "Requires", "a", "reboot", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L701-L785
train
saltstack/salt
salt/modules/win_system.py
_join_domain
def _join_domain(domain, username=None, password=None, account_ou=None, account_exists=False): ''' Helper function to join the domain. Args: domain (str): The domain to which the computer should be joined, e.g. ``exampl...
python
def _join_domain(domain, username=None, password=None, account_ou=None, account_exists=False): ''' Helper function to join the domain. Args: domain (str): The domain to which the computer should be joined, e.g. ``exampl...
[ "def", "_join_domain", "(", "domain", ",", "username", "=", "None", ",", "password", "=", "None", ",", "account_ou", "=", "None", ",", "account_exists", "=", "False", ")", ":", "NETSETUP_JOIN_DOMAIN", "=", "0x1", "# pylint: disable=invalid-name", "NETSETUP_ACCOUNT...
Helper function to join the domain. Args: domain (str): The domain to which the computer should be joined, e.g. ``example.com`` username (str): Username of an account which is authorized to join computers to the specified domain. Need to be either fully qualified ...
[ "Helper", "function", "to", "join", "the", "domain", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L788-L846
train
saltstack/salt
salt/modules/win_system.py
unjoin_domain
def unjoin_domain(username=None, password=None, domain=None, workgroup='WORKGROUP', disable=False, restart=False): # pylint: disable=anomalous-backslash-in-string ''' Unjoin a computer from an Active Directory Domain. ...
python
def unjoin_domain(username=None, password=None, domain=None, workgroup='WORKGROUP', disable=False, restart=False): # pylint: disable=anomalous-backslash-in-string ''' Unjoin a computer from an Active Directory Domain. ...
[ "def", "unjoin_domain", "(", "username", "=", "None", ",", "password", "=", "None", ",", "domain", "=", "None", ",", "workgroup", "=", "'WORKGROUP'", ",", "disable", "=", "False", ",", "restart", "=", "False", ")", ":", "# pylint: disable=anomalous-backslash-i...
Unjoin a computer from an Active Directory Domain. Requires a restart. Args: username (str): Username of an account which is authorized to manage computer accounts on the domain. Needs to be a fully qualified name like ``user@domain.tld`` or ``domain.tld\\user``. If the...
[ "Unjoin", "a", "computer", "from", "an", "Active", "Directory", "Domain", ".", "Requires", "a", "restart", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L849-L954
train
saltstack/salt
salt/modules/win_system.py
get_domain_workgroup
def get_domain_workgroup(): ''' Get the domain or workgroup the computer belongs to. .. versionadded:: 2015.5.7 .. versionadded:: 2015.8.2 Returns: str: The name of the domain or workgroup CLI Example: .. code-block:: bash salt 'minion-id' system.get_domain_workgroup ...
python
def get_domain_workgroup(): ''' Get the domain or workgroup the computer belongs to. .. versionadded:: 2015.5.7 .. versionadded:: 2015.8.2 Returns: str: The name of the domain or workgroup CLI Example: .. code-block:: bash salt 'minion-id' system.get_domain_workgroup ...
[ "def", "get_domain_workgroup", "(", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "conn", "=", "wmi", ".", "WMI", "(", ")", "for", "computer", "in", "conn", ".", "Win32_ComputerSystem", "(", ")", ":", "if", "comput...
Get the domain or workgroup the computer belongs to. .. versionadded:: 2015.5.7 .. versionadded:: 2015.8.2 Returns: str: The name of the domain or workgroup CLI Example: .. code-block:: bash salt 'minion-id' system.get_domain_workgroup
[ "Get", "the", "domain", "or", "workgroup", "the", "computer", "belongs", "to", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L957-L979
train
saltstack/salt
salt/modules/win_system.py
set_domain_workgroup
def set_domain_workgroup(workgroup): ''' Set the domain or workgroup the computer belongs to. .. versionadded:: 2019.2.0 Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt 'minion-id' system.set_domain_workgroup LOCAL ''' ...
python
def set_domain_workgroup(workgroup): ''' Set the domain or workgroup the computer belongs to. .. versionadded:: 2019.2.0 Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt 'minion-id' system.set_domain_workgroup LOCAL ''' ...
[ "def", "set_domain_workgroup", "(", "workgroup", ")", ":", "if", "six", ".", "PY2", ":", "workgroup", "=", "_to_unicode", "(", "workgroup", ")", "# Initialize COM", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "# Grab the first Win...
Set the domain or workgroup the computer belongs to. .. versionadded:: 2019.2.0 Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt 'minion-id' system.set_domain_workgroup LOCAL
[ "Set", "the", "domain", "or", "workgroup", "the", "computer", "belongs", "to", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L982-L1009
train
saltstack/salt
salt/modules/win_system.py
_try_parse_datetime
def _try_parse_datetime(time_str, fmts): ''' A helper function that attempts to parse the input time_str as a date. Args: time_str (str): A string representing the time fmts (list): A list of date format strings Returns: datetime: Returns a datetime object if parsed properly,...
python
def _try_parse_datetime(time_str, fmts): ''' A helper function that attempts to parse the input time_str as a date. Args: time_str (str): A string representing the time fmts (list): A list of date format strings Returns: datetime: Returns a datetime object if parsed properly,...
[ "def", "_try_parse_datetime", "(", "time_str", ",", "fmts", ")", ":", "result", "=", "None", "for", "fmt", "in", "fmts", ":", "try", ":", "result", "=", "datetime", ".", "strptime", "(", "time_str", ",", "fmt", ")", "break", "except", "ValueError", ":", ...
A helper function that attempts to parse the input time_str as a date. Args: time_str (str): A string representing the time fmts (list): A list of date format strings Returns: datetime: Returns a datetime object if parsed properly, otherwise None
[ "A", "helper", "function", "that", "attempts", "to", "parse", "the", "input", "time_str", "as", "a", "date", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1012-L1032
train
saltstack/salt
salt/modules/win_system.py
get_system_time
def get_system_time(): ''' Get the system time. Returns: str: Returns the system time in HH:MM:SS AM/PM format. CLI Example: .. code-block:: bash salt 'minion-id' system.get_system_time ''' now = win32api.GetLocalTime() meridian = 'AM' hours = int(now[4]) if h...
python
def get_system_time(): ''' Get the system time. Returns: str: Returns the system time in HH:MM:SS AM/PM format. CLI Example: .. code-block:: bash salt 'minion-id' system.get_system_time ''' now = win32api.GetLocalTime() meridian = 'AM' hours = int(now[4]) if h...
[ "def", "get_system_time", "(", ")", ":", "now", "=", "win32api", ".", "GetLocalTime", "(", ")", "meridian", "=", "'AM'", "hours", "=", "int", "(", "now", "[", "4", "]", ")", "if", "hours", "==", "12", ":", "meridian", "=", "'PM'", "elif", "hours", ...
Get the system time. Returns: str: Returns the system time in HH:MM:SS AM/PM format. CLI Example: .. code-block:: bash salt 'minion-id' system.get_system_time
[ "Get", "the", "system", "time", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1035-L1058
train
saltstack/salt
salt/modules/win_system.py
set_system_date_time
def set_system_date_time(years=None, months=None, days=None, hours=None, minutes=None, seconds=None): ''' Set the system date and time. Each argument is an element of the date, but no...
python
def set_system_date_time(years=None, months=None, days=None, hours=None, minutes=None, seconds=None): ''' Set the system date and time. Each argument is an element of the date, but no...
[ "def", "set_system_date_time", "(", "years", "=", "None", ",", "months", "=", "None", ",", "days", "=", "None", ",", "hours", "=", "None", ",", "minutes", "=", "None", ",", "seconds", "=", "None", ")", ":", "# Get the current date/time", "try", ":", "dat...
Set the system date and time. Each argument is an element of the date, but not required. If an element is not passed, the current system value for that element will be used. For example, if you don't pass the year, the current system year will be used. (Used by set_system_date and set_system_time) Args...
[ "Set", "the", "system", "date", "and", "time", ".", "Each", "argument", "is", "an", "element", "of", "the", "date", "but", "not", "required", ".", "If", "an", "element", "is", "not", "passed", "the", "current", "system", "value", "for", "that", "element"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1096-L1179
train
saltstack/salt
salt/modules/win_system.py
set_system_date
def set_system_date(newdate): ''' Set the Windows system date. Use <mm-dd-yy> format for the date. Args: newdate (str): The date to set. Can be any of the following formats - YYYY-MM-DD - MM-DD-YYYY - MM-DD-YY - MM/DD/YYYY - M...
python
def set_system_date(newdate): ''' Set the Windows system date. Use <mm-dd-yy> format for the date. Args: newdate (str): The date to set. Can be any of the following formats - YYYY-MM-DD - MM-DD-YYYY - MM-DD-YY - MM/DD/YYYY - M...
[ "def", "set_system_date", "(", "newdate", ")", ":", "fmts", "=", "[", "'%Y-%m-%d'", ",", "'%m-%d-%Y'", ",", "'%m-%d-%y'", ",", "'%m/%d/%Y'", ",", "'%m/%d/%y'", ",", "'%Y/%m/%d'", "]", "# Get date/time object from newdate", "dt_obj", "=", "_try_parse_datetime", "(", ...
Set the Windows system date. Use <mm-dd-yy> format for the date. Args: newdate (str): The date to set. Can be any of the following formats - YYYY-MM-DD - MM-DD-YYYY - MM-DD-YY - MM/DD/YYYY - MM/DD/YY - YYYY/MM/DD Retu...
[ "Set", "the", "Windows", "system", "date", ".", "Use", "<mm", "-", "dd", "-", "yy", ">", "format", "for", "the", "date", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1199-L1233
train
saltstack/salt
salt/modules/win_system.py
get_pending_component_servicing
def get_pending_component_servicing(): ''' Determine whether there are pending Component Based Servicing tasks that require a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there are pending Component Based Servicing tasks, otherwise ``False`` CLI Example: ...
python
def get_pending_component_servicing(): ''' Determine whether there are pending Component Based Servicing tasks that require a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there are pending Component Based Servicing tasks, otherwise ``False`` CLI Example: ...
[ "def", "get_pending_component_servicing", "(", ")", ":", "key", "=", "r'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending'", "# So long as the registry key exists, a reboot is pending.", "if", "__utils__", "[", "'reg.key_exists'", "]", "(", "'HKLM'"...
Determine whether there are pending Component Based Servicing tasks that require a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there are pending Component Based Servicing tasks, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' system.get_...
[ "Determine", "whether", "there", "are", "pending", "Component", "Based", "Servicing", "tasks", "that", "require", "a", "reboot", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1268-L1294
train
saltstack/salt
salt/modules/win_system.py
get_pending_domain_join
def get_pending_domain_join(): ''' Determine whether there is a pending domain join action that requires a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there is a pending domain join action, otherwise ``False`` CLI Example: .. code-block:: bash ...
python
def get_pending_domain_join(): ''' Determine whether there is a pending domain join action that requires a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there is a pending domain join action, otherwise ``False`` CLI Example: .. code-block:: bash ...
[ "def", "get_pending_domain_join", "(", ")", ":", "base_key", "=", "r'SYSTEM\\CurrentControlSet\\Services\\Netlogon'", "avoid_key", "=", "r'{0}\\AvoidSpnSet'", ".", "format", "(", "base_key", ")", "join_key", "=", "r'{0}\\JoinDomain'", ".", "format", "(", "base_key", ")"...
Determine whether there is a pending domain join action that requires a reboot. .. versionadded:: 2016.11.0 Returns: bool: ``True`` if there is a pending domain join action, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' system.get_pending_domain_join
[ "Determine", "whether", "there", "is", "a", "pending", "domain", "join", "action", "that", "requires", "a", "reboot", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1297-L1332
train