id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,900 | 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 |
33,901 | 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 |
33,902 | 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 |
33,903 | 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 |
33,904 | 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 |
33,905 | 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 |
33,906 | 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 |
33,907 | 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 |
33,908 | 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 |
33,909 | 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 |
33,910 | 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 |
33,911 | 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 |
33,912 | 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 |
33,913 | 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 |
33,914 | 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 |
33,915 | 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 |
33,916 | 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 |
33,917 | 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 |
33,918 | 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 |
33,919 | 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 |
33,920 | 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 |
33,921 | 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 |
33,922 | 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 |
33,923 | 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 |
33,924 | 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 |
33,925 | 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 |
33,926 | 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 |
33,927 | 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 |
33,928 | 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 |
33,929 | 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 |
33,930 | 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 |
33,931 | 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 |
33,932 | 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 |
33,933 | 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 |
33,934 | 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 |
33,935 | 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 |
33,936 | 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 |
33,937 | 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 |
33,938 | 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 |
33,939 | 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 |
33,940 | 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 |
33,941 | 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 |
33,942 | 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 |
33,943 | 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 |
33,944 | 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 |
33,945 | 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 |
33,946 | 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 |
33,947 | 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 |
33,948 | 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 |
33,949 | 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 |
33,950 | 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 |
33,951 | 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 |
33,952 | 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 |
33,953 | 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 |
33,954 | 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 |
33,955 | 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 |
33,956 | 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 |
33,957 | 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 |
33,958 | 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 |
33,959 | 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 |
33,960 | 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 |
33,961 | 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 |
33,962 | 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 |
33,963 | 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 |
33,964 | 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 |
33,965 | 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 |
33,966 | 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 |
33,967 | 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 |
33,968 | 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 |
33,969 | 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 |
33,970 | 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 |
33,971 | 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 |
33,972 | 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 |
33,973 | saltstack/salt | salt/modules/win_system.py | get_pending_file_rename | def get_pending_file_rename():
'''
Determine whether there are pending file rename operations that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending file rename operations, otherwise
``False``
CLI Example:
.. code-block:: bash
... | python | def get_pending_file_rename():
'''
Determine whether there are pending file rename operations that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending file rename operations, otherwise
``False``
CLI Example:
.. code-block:: bash
... | [
"def",
"get_pending_file_rename",
"(",
")",
":",
"vnames",
"=",
"(",
"'PendingFileRenameOperations'",
",",
"'PendingFileRenameOperations2'",
")",
"key",
"=",
"r'SYSTEM\\CurrentControlSet\\Control\\Session Manager'",
"# If any of the value names exist and have value data set,",
"# the... | Determine whether there are pending file rename operations that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending file rename operations, otherwise
``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_file_renam... | [
"Determine",
"whether",
"there",
"are",
"pending",
"file",
"rename",
"operations",
"that",
"require",
"a",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1335-L1368 |
33,974 | saltstack/salt | salt/modules/win_system.py | get_pending_servermanager | def get_pending_servermanager():
'''
Determine whether there are pending Server Manager tasks that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending Server Manager tasks, otherwise
``False``
CLI Example:
.. code-block:: bash
... | python | def get_pending_servermanager():
'''
Determine whether there are pending Server Manager tasks that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending Server Manager tasks, otherwise
``False``
CLI Example:
.. code-block:: bash
... | [
"def",
"get_pending_servermanager",
"(",
")",
":",
"vname",
"=",
"'CurrentRebootAttempts'",
"key",
"=",
"r'SOFTWARE\\Microsoft\\ServerManager'",
"# There are situations where it's possible to have '(value not set)' as",
"# the value data, and since an actual reboot won't be pending in that",... | Determine whether there are pending Server Manager tasks that require a
reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending Server Manager tasks, otherwise
``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_servermanager | [
"Determine",
"whether",
"there",
"are",
"pending",
"Server",
"Manager",
"tasks",
"that",
"require",
"a",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1371-L1407 |
33,975 | saltstack/salt | salt/modules/win_system.py | get_pending_update | def get_pending_update():
'''
Determine whether there are pending updates that require a reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending updates, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_update
'''... | python | def get_pending_update():
'''
Determine whether there are pending updates that require a reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending updates, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_update
'''... | [
"def",
"get_pending_update",
"(",
")",
":",
"key",
"=",
"r'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired'",
"# So long as the registry key exists, a reboot is pending.",
"if",
"__utils__",
"[",
"'reg.key_exists'",
"]",
"(",
"'HKLM'",
",",
... | Determine whether there are pending updates that require a reboot.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if there are pending updates, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_update | [
"Determine",
"whether",
"there",
"are",
"pending",
"updates",
"that",
"require",
"a",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1410-L1434 |
33,976 | saltstack/salt | salt/modules/win_system.py | get_pending_reboot | def get_pending_reboot():
'''
Determine whether there is a reboot pending.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if the system is pending reboot, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_reboot
'''
# Order the c... | python | def get_pending_reboot():
'''
Determine whether there is a reboot pending.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if the system is pending reboot, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_reboot
'''
# Order the c... | [
"def",
"get_pending_reboot",
"(",
")",
":",
"# Order the checks for reboot pending in most to least likely.",
"checks",
"=",
"(",
"get_pending_update",
",",
"get_pending_file_rename",
",",
"get_pending_servermanager",
",",
"get_pending_component_servicing",
",",
"get_reboot_require... | Determine whether there is a reboot pending.
.. versionadded:: 2016.11.0
Returns:
bool: ``True`` if the system is pending reboot, otherwise ``False``
CLI Example:
.. code-block:: bash
salt '*' system.get_pending_reboot | [
"Determine",
"whether",
"there",
"is",
"a",
"reboot",
"pending",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L1508-L1537 |
33,977 | saltstack/salt | salt/states/postgres_extension.py | present | def present(name,
if_not_exists=None,
schema=None,
ext_version=None,
from_version=None,
user=None,
maintenance_db=None,
db_user=None,
db_password=None,
db_host=None,
db_port=None):
'''
Ensure ... | python | def present(name,
if_not_exists=None,
schema=None,
ext_version=None,
from_version=None,
user=None,
maintenance_db=None,
db_user=None,
db_password=None,
db_host=None,
db_port=None):
'''
Ensure ... | [
"def",
"present",
"(",
"name",
",",
"if_not_exists",
"=",
"None",
",",
"schema",
"=",
"None",
",",
"ext_version",
"=",
"None",
",",
"from_version",
"=",
"None",
",",
"user",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"db_user",
"=",
"None",
... | Ensure that the named extension is present.
.. note::
Before you can use the state to load an extension into a database, the
extension's supporting files must be already installed.
For more information about all of these options see ``CREATE EXTENSION`` SQL
command reference in the Postgr... | [
"Ensure",
"that",
"the",
"named",
"extension",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_extension.py#L36-L151 |
33,978 | saltstack/salt | salt/states/postgres_extension.py | absent | def absent(name,
if_exists=None,
restrict=None,
cascade=None,
user=None,
maintenance_db=None,
db_user=None,
db_password=None,
db_host=None,
db_port=None):
'''
Ensure that the named extension is absent.
name
... | python | def absent(name,
if_exists=None,
restrict=None,
cascade=None,
user=None,
maintenance_db=None,
db_user=None,
db_password=None,
db_host=None,
db_port=None):
'''
Ensure that the named extension is absent.
name
... | [
"def",
"absent",
"(",
"name",
",",
"if_exists",
"=",
"None",
",",
"restrict",
"=",
"None",
",",
"cascade",
"=",
"None",
",",
"user",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"... | Ensure that the named extension is absent.
name
Extension name of the extension to remove
if_exists
Add if exist slug
restrict
Add restrict slug
cascade
Drop on cascade
user
System user all operations should be performed on behalf of
maintenance_db
... | [
"Ensure",
"that",
"the",
"named",
"extension",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_extension.py#L154-L232 |
33,979 | saltstack/salt | salt/auth/file.py | _get_file_auth_config | def _get_file_auth_config():
'''
Setup defaults and check configuration variables for auth backends
'''
config = {
'filetype': 'text',
'hashtype': 'plaintext',
'field_separator': ':',
'username_field': 1,
'password_field': 2,
}
for opt in __opts__['exter... | python | def _get_file_auth_config():
'''
Setup defaults and check configuration variables for auth backends
'''
config = {
'filetype': 'text',
'hashtype': 'plaintext',
'field_separator': ':',
'username_field': 1,
'password_field': 2,
}
for opt in __opts__['exter... | [
"def",
"_get_file_auth_config",
"(",
")",
":",
"config",
"=",
"{",
"'filetype'",
":",
"'text'",
",",
"'hashtype'",
":",
"'plaintext'",
",",
"'field_separator'",
":",
"':'",
",",
"'username_field'",
":",
"1",
",",
"'password_field'",
":",
"2",
",",
"}",
"for"... | Setup defaults and check configuration variables for auth backends | [
"Setup",
"defaults",
"and",
"check",
"configuration",
"variables",
"for",
"auth",
"backends"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/file.py#L116-L146 |
33,980 | saltstack/salt | salt/auth/file.py | _htpasswd | def _htpasswd(username, password, **kwargs):
'''
Provide authentication via Apache-style htpasswd files
'''
from passlib.apache import HtpasswdFile
pwfile = HtpasswdFile(kwargs['filename'])
# passlib below version 1.6 uses 'verify' function instead of 'check_password'
if salt.utils.versio... | python | def _htpasswd(username, password, **kwargs):
'''
Provide authentication via Apache-style htpasswd files
'''
from passlib.apache import HtpasswdFile
pwfile = HtpasswdFile(kwargs['filename'])
# passlib below version 1.6 uses 'verify' function instead of 'check_password'
if salt.utils.versio... | [
"def",
"_htpasswd",
"(",
"username",
",",
"password",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"passlib",
".",
"apache",
"import",
"HtpasswdFile",
"pwfile",
"=",
"HtpasswdFile",
"(",
"kwargs",
"[",
"'filename'",
"]",
")",
"# passlib below version 1.6 uses 'ver... | Provide authentication via Apache-style htpasswd files | [
"Provide",
"authentication",
"via",
"Apache",
"-",
"style",
"htpasswd",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/file.py#L193-L206 |
33,981 | saltstack/salt | salt/auth/file.py | _htdigest | def _htdigest(username, password, **kwargs):
'''
Provide authentication via Apache-style htdigest files
'''
realm = kwargs.get('realm', None)
if not realm:
log.error('salt.auth.file: A ^realm must be defined in '
'external_auth:file for htdigest filetype')
return F... | python | def _htdigest(username, password, **kwargs):
'''
Provide authentication via Apache-style htdigest files
'''
realm = kwargs.get('realm', None)
if not realm:
log.error('salt.auth.file: A ^realm must be defined in '
'external_auth:file for htdigest filetype')
return F... | [
"def",
"_htdigest",
"(",
"username",
",",
"password",
",",
"*",
"*",
"kwargs",
")",
":",
"realm",
"=",
"kwargs",
".",
"get",
"(",
"'realm'",
",",
"None",
")",
"if",
"not",
"realm",
":",
"log",
".",
"error",
"(",
"'salt.auth.file: A ^realm must be defined i... | Provide authentication via Apache-style htdigest files | [
"Provide",
"authentication",
"via",
"Apache",
"-",
"style",
"htdigest",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/file.py#L209-L228 |
33,982 | saltstack/salt | salt/auth/file.py | _htfile | def _htfile(username, password, **kwargs):
'''
Gate function for _htpasswd and _htdigest authentication backends
'''
filetype = kwargs.get('filetype', 'htpasswd').lower()
try:
import passlib
kwargs['passlib_version'] = passlib.__version__
except ImportError:
log.error('... | python | def _htfile(username, password, **kwargs):
'''
Gate function for _htpasswd and _htdigest authentication backends
'''
filetype = kwargs.get('filetype', 'htpasswd').lower()
try:
import passlib
kwargs['passlib_version'] = passlib.__version__
except ImportError:
log.error('... | [
"def",
"_htfile",
"(",
"username",
",",
"password",
",",
"*",
"*",
"kwargs",
")",
":",
"filetype",
"=",
"kwargs",
".",
"get",
"(",
"'filetype'",
",",
"'htpasswd'",
")",
".",
"lower",
"(",
")",
"try",
":",
"import",
"passlib",
"kwargs",
"[",
"'passlib_v... | Gate function for _htpasswd and _htdigest authentication backends | [
"Gate",
"function",
"for",
"_htpasswd",
"and",
"_htdigest",
"authentication",
"backends"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/file.py#L231-L249 |
33,983 | saltstack/salt | salt/auth/file.py | auth | def auth(username, password):
'''
File based authentication
^filename
The path to the file to use for authentication.
^filetype
The type of file: ``text``, ``htpasswd``, ``htdigest``.
Default: ``text``
^realm
The realm required by htdigest authentication.
.. ... | python | def auth(username, password):
'''
File based authentication
^filename
The path to the file to use for authentication.
^filetype
The type of file: ``text``, ``htpasswd``, ``htdigest``.
Default: ``text``
^realm
The realm required by htdigest authentication.
.. ... | [
"def",
"auth",
"(",
"username",
",",
"password",
")",
":",
"config",
"=",
"_get_file_auth_config",
"(",
")",
"if",
"not",
"config",
":",
"return",
"False",
"auth_function",
"=",
"FILETYPE_FUNCTION_MAP",
".",
"get",
"(",
"config",
"[",
"'filetype'",
"]",
",",... | File based authentication
^filename
The path to the file to use for authentication.
^filetype
The type of file: ``text``, ``htpasswd``, ``htdigest``.
Default: ``text``
^realm
The realm required by htdigest authentication.
.. note::
The following parameters ar... | [
"File",
"based",
"authentication"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/file.py#L259-L308 |
33,984 | saltstack/salt | salt/states/openvswitch_bridge.py | present | def present(name, parent=None, vlan=None):
'''
Ensures that the named bridge exists, eventually creates it.
Args:
name: The name of the bridge.
parent: The name of the parent bridge (if the bridge shall be created
as a fake bridge). If specified, vlan must also be specified.
... | python | def present(name, parent=None, vlan=None):
'''
Ensures that the named bridge exists, eventually creates it.
Args:
name: The name of the bridge.
parent: The name of the parent bridge (if the bridge shall be created
as a fake bridge). If specified, vlan must also be specified.
... | [
"def",
"present",
"(",
"name",
",",
"parent",
"=",
"None",
",",
"vlan",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"# Comment and ... | Ensures that the named bridge exists, eventually creates it.
Args:
name: The name of the bridge.
parent: The name of the parent bridge (if the bridge shall be created
as a fake bridge). If specified, vlan must also be specified.
vlan: The VLAN ID of the bridge (if the bridge sha... | [
"Ensures",
"that",
"the",
"named",
"bridge",
"exists",
"eventually",
"creates",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_bridge.py#L17-L84 |
33,985 | saltstack/salt | salt/states/openvswitch_bridge.py | absent | def absent(name):
'''
Ensures that the named bridge does not exist, eventually deletes it.
Args:
name: The name of the bridge.
'''
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
# Comment and change messages
comment_bridge_deleted = 'Bridge {0} deleted.'.form... | python | def absent(name):
'''
Ensures that the named bridge does not exist, eventually deletes it.
Args:
name: The name of the bridge.
'''
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
# Comment and change messages
comment_bridge_deleted = 'Bridge {0} deleted.'.form... | [
"def",
"absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"# Comment and change messages",
"comment_bridge_deleted",
"=",
"'Bridge {0} del... | Ensures that the named bridge does not exist, eventually deletes it.
Args:
name: The name of the bridge. | [
"Ensures",
"that",
"the",
"named",
"bridge",
"does",
"not",
"exist",
"eventually",
"deletes",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_bridge.py#L87-L133 |
33,986 | saltstack/salt | salt/pillar/cmd_yamlex.py | ext_pillar | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
command):
'''
Execute a command and read the output as YAMLEX
'''
try:
command = command.replace('%s', minion_id)
return deserialize(__salt__['cmd.run']('{0}'.format(command)... | python | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
command):
'''
Execute a command and read the output as YAMLEX
'''
try:
command = command.replace('%s', minion_id)
return deserialize(__salt__['cmd.run']('{0}'.format(command)... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"command",
")",
":",
"try",
":",
"command",
"=",
"command",
".",
"replace",
"(",
"'%s'",
",",
"minion_id",
")",
"return",
"deserialize",
"(",
"__salt... | Execute a command and read the output as YAMLEX | [
"Execute",
"a",
"command",
"and",
"read",
"the",
"output",
"as",
"YAMLEX"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/cmd_yamlex.py#L19-L30 |
33,987 | saltstack/salt | salt/states/kubernetes.py | deployment_absent | def deployment_absent(name, namespace='default', **kwargs):
'''
Ensures that the named deployment is absent from the given namespace.
name
The name of the deployment
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': Fal... | python | def deployment_absent(name, namespace='default', **kwargs):
'''
Ensures that the named deployment is absent from the given namespace.
name
The name of the deployment
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': Fal... | [
"def",
"deployment_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
... | Ensures that the named deployment is absent from the given namespace.
name
The name of the deployment
namespace
The name of the namespace | [
"Ensures",
"that",
"the",
"named",
"deployment",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L111-L149 |
33,988 | saltstack/salt | salt/states/kubernetes.py | deployment_present | def deployment_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named deployment is present inside of the specified
namespace with the given metadata and spec.
If the deployment e... | python | def deployment_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named deployment is present inside of the specified
namespace with the given metadata and spec.
If the deployment e... | [
"def",
"deployment_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"source",
"=",
"''",
",",
"template",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
... | Ensures that the named deployment is present inside of the specified
namespace with the given metadata and spec.
If the deployment exists it will be replaced.
name
The name of the deployment.
namespace
The namespace holding the deployment. The 'default' one is going to be
used ... | [
"Ensures",
"that",
"the",
"named",
"deployment",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"metadata",
"and",
"spec",
".",
"If",
"the",
"deployment",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L152-L244 |
33,989 | saltstack/salt | salt/states/kubernetes.py | service_present | def service_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named service is present inside of the specified namespace
with the given metadata and spec.
If the deployment exists ... | python | def service_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named service is present inside of the specified namespace
with the given metadata and spec.
If the deployment exists ... | [
"def",
"service_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"source",
"=",
"''",
",",
"template",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
"... | Ensures that the named service is present inside of the specified namespace
with the given metadata and spec.
If the deployment exists it will be replaced.
name
The name of the service.
namespace
The namespace holding the service. The 'default' one is going to be
used unless a ... | [
"Ensures",
"that",
"the",
"named",
"service",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"metadata",
"and",
"spec",
".",
"If",
"the",
"deployment",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L247-L340 |
33,990 | saltstack/salt | salt/states/kubernetes.py | service_absent | def service_absent(name, namespace='default', **kwargs):
'''
Ensures that the named service is absent from the given namespace.
name
The name of the service
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
... | python | def service_absent(name, namespace='default', **kwargs):
'''
Ensures that the named service is absent from the given namespace.
name
The name of the service
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
... | [
"def",
"service_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"... | Ensures that the named service is absent from the given namespace.
name
The name of the service
namespace
The name of the namespace | [
"Ensures",
"that",
"the",
"named",
"service",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L343-L381 |
33,991 | saltstack/salt | salt/states/kubernetes.py | namespace_absent | def namespace_absent(name, **kwargs):
'''
Ensures that the named namespace is absent.
name
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
namespace = __salt__['kubernetes.show_namespace'](name, **kwarg... | python | def namespace_absent(name, **kwargs):
'''
Ensures that the named namespace is absent.
name
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
namespace = __salt__['kubernetes.show_namespace'](name, **kwarg... | [
"def",
"namespace_absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"namespace",
"=",
"__salt__",
"[",
... | Ensures that the named namespace is absent.
name
The name of the namespace | [
"Ensures",
"that",
"the",
"named",
"namespace",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L384-L431 |
33,992 | saltstack/salt | salt/states/kubernetes.py | namespace_present | def namespace_present(name, **kwargs):
'''
Ensures that the named namespace is present.
name
The name of the namespace.
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
namespace = __salt__['kubernetes.show_namespace'](name, **kw... | python | def namespace_present(name, **kwargs):
'''
Ensures that the named namespace is present.
name
The name of the namespace.
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
namespace = __salt__['kubernetes.show_namespace'](name, **kw... | [
"def",
"namespace_present",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"namespace",
"=",
"__salt__",
"[",
... | Ensures that the named namespace is present.
name
The name of the namespace. | [
"Ensures",
"that",
"the",
"named",
"namespace",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L434-L464 |
33,993 | saltstack/salt | salt/states/kubernetes.py | secret_absent | def secret_absent(name, namespace='default', **kwargs):
'''
Ensures that the named secret is absent from the given namespace.
name
The name of the secret
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
... | python | def secret_absent(name, namespace='default', **kwargs):
'''
Ensures that the named secret is absent from the given namespace.
name
The name of the secret
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
... | [
"def",
"secret_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"s... | Ensures that the named secret is absent from the given namespace.
name
The name of the secret
namespace
The name of the namespace | [
"Ensures",
"that",
"the",
"named",
"secret",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L467-L505 |
33,994 | saltstack/salt | salt/states/kubernetes.py | secret_present | def secret_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named secret is present inside of the specified namespace
with the given data.
If the secret exists it will be replaced.
name
... | python | def secret_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named secret is present inside of the specified namespace
with the given data.
If the secret exists it will be replaced.
name
... | [
"def",
"secret_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"data",
"=",
"None",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",... | Ensures that the named secret is present inside of the specified namespace
with the given data.
If the secret exists it will be replaced.
name
The name of the secret.
namespace
The namespace holding the secret. The 'default' one is going to be
used unless a different one is spe... | [
"Ensures",
"that",
"the",
"named",
"secret",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"data",
".",
"If",
"the",
"secret",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L508-L592 |
33,995 | saltstack/salt | salt/states/kubernetes.py | configmap_absent | def configmap_absent(name, namespace='default', **kwargs):
'''
Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is spec... | python | def configmap_absent(name, namespace='default', **kwargs):
'''
Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is spec... | [
"def",
"configmap_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
... | Ensures that the named configmap is absent from the given namespace.
name
The name of the configmap
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a different one is specified. | [
"Ensures",
"that",
"the",
"named",
"configmap",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L595-L634 |
33,996 | saltstack/salt | salt/states/kubernetes.py | configmap_present | def configmap_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
nam... | python | def configmap_present(
name,
namespace='default',
data=None,
source=None,
template=None,
**kwargs):
'''
Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
nam... | [
"def",
"configmap_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"data",
"=",
"None",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes... | Ensures that the named configmap is present inside of the specified namespace
with the given data.
If the configmap exists it will be replaced.
name
The name of the configmap.
namespace
The namespace holding the configmap. The 'default' one is going to be
used unless a differen... | [
"Ensures",
"that",
"the",
"named",
"configmap",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"data",
".",
"If",
"the",
"configmap",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L637-L717 |
33,997 | saltstack/salt | salt/states/kubernetes.py | pod_absent | def pod_absent(name, namespace='default', **kwargs):
'''
Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comme... | python | def pod_absent(name, namespace='default', **kwargs):
'''
Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace
'''
ret = {'name': name,
'changes': {},
'result': False,
'comme... | [
"def",
"pod_absent",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"pod"... | Ensures that the named pod is absent from the given namespace.
name
The name of the pod
namespace
The name of the namespace | [
"Ensures",
"that",
"the",
"named",
"pod",
"is",
"absent",
"from",
"the",
"given",
"namespace",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L720-L761 |
33,998 | saltstack/salt | salt/states/kubernetes.py | pod_present | def pod_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be repl... | python | def pod_present(
name,
namespace='default',
metadata=None,
spec=None,
source='',
template='',
**kwargs):
'''
Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be repl... | [
"def",
"pod_present",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"source",
"=",
"''",
",",
"template",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
... | Ensures that the named pod is present inside of the specified
namespace with the given metadata and spec.
If the pod exists it will be replaced.
name
The name of the pod.
namespace
The namespace holding the pod. The 'default' one is going to be
used unless a different one is sp... | [
"Ensures",
"that",
"the",
"named",
"pod",
"is",
"present",
"inside",
"of",
"the",
"specified",
"namespace",
"with",
"the",
"given",
"metadata",
"and",
"spec",
".",
"If",
"the",
"pod",
"exists",
"it",
"will",
"be",
"replaced",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L764-L850 |
33,999 | saltstack/salt | salt/states/kubernetes.py | node_label_absent | def node_label_absent(name, node, **kwargs):
'''
Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
labels = __... | python | def node_label_absent(name, node, **kwargs):
'''
Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
labels = __... | [
"def",
"node_label_absent",
"(",
"name",
",",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"labels",
"=",
"__sal... | Ensures that the named label is absent from the node.
name
The name of the label
node
The name of the node | [
"Ensures",
"that",
"the",
"named",
"label",
"is",
"absent",
"from",
"the",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L853-L892 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.