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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,800 | saltstack/salt | salt/modules/boto_iot.py | thing_type_exists | def thing_type_exists(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.1... | python | def thing_type_exists(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.1... | [
"def",
"thing_type_exists",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | Given a thing type name, check to see if the given thing type exists
Returns True if the given thing type exists and returns False if the
given thing type does not exist.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.thing_type_exists mythingtype | [
"Given",
"a",
"thing",
"type",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"thing",
"type",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L101-L130 |
36,801 | saltstack/salt | salt/modules/boto_iot.py | describe_thing_type | def describe_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.desc... | python | def describe_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.desc... | [
"def",
"describe_thing_type",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
... | Given a thing type name describe its properties.
Returns a dictionary of interesting properties.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_thing_type mythingtype | [
"Given",
"a",
"thing",
"type",
"name",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L133-L167 |
36,802 | saltstack/salt | salt/modules/boto_iot.py | create_thing_type | def create_thing_type(thingTypeName, thingTypeDescription,
searchableAttributesList, region=None, key=None,
keyid=None, profile=None):
'''
Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not crea... | python | def create_thing_type(thingTypeName, thingTypeDescription,
searchableAttributesList, region=None, key=None,
keyid=None, profile=None):
'''
Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not crea... | [
"def",
"create_thing_type",
"(",
"thingTypeName",
",",
"thingTypeDescription",
",",
"searchableAttributesList",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
... | Given a valid config, create a thing type.
Returns {created: true} if the thing type was created and returns
{created: False} if the thing type was not created.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_thing_type mythingtype \\
... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"thing",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L170-L209 |
36,803 | saltstack/salt | salt/modules/boto_iot.py | deprecate_thing_type | def deprecate_thing_type(thingTypeName, undoDeprecate=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns... | python | def deprecate_thing_type(thingTypeName, undoDeprecate=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns... | [
"def",
"deprecate_thing_type",
"(",
"thingTypeName",
",",
"undoDeprecate",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"... | Given a thing type name, deprecate it when undoDeprecate is False
and undeprecate it when undoDeprecate is True.
Returns {deprecated: true} if the thing type was deprecated and returns
{deprecated: false} if the thing type was not deprecated.
.. versionadded:: 2016.11.0
CLI Example:
.. code-... | [
"Given",
"a",
"thing",
"type",
"name",
"deprecate",
"it",
"when",
"undoDeprecate",
"is",
"False",
"and",
"undeprecate",
"it",
"when",
"undoDeprecate",
"is",
"True",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L212-L240 |
36,804 | saltstack/salt | salt/modules/boto_iot.py | delete_thing_type | def delete_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Exam... | python | def delete_thing_type(thingTypeName,
region=None, key=None, keyid=None, profile=None):
'''
Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Exam... | [
"def",
"delete_thing_type",
"(",
"thingTypeName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | Given a thing type name, delete it.
Returns {deleted: true} if the thing type was deleted and returns
{deleted: false} if the thing type was not deleted.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_thing_type mythingtype | [
"Given",
"a",
"thing",
"type",
"name",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L243-L269 |
36,805 | saltstack/salt | salt/modules/boto_iot.py | policy_exists | def policy_exists(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
... | python | def policy_exists(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
... | [
"def",
"policy_exists",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"... | Given a policy name, check to see if the given policy exists.
Returns True if the given policy exists and returns False if the given
policy does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.policy_exists mypolicy | [
"Given",
"a",
"policy",
"name",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L272-L296 |
36,806 | saltstack/salt | salt/modules/boto_iot.py | create_policy | def create_policy(policyName, policyDocument,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bas... | python | def create_policy(policyName, policyDocument,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bas... | [
"def",
"create_policy",
"(",
"policyName",
",",
"policyDocument",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",... | Given a valid config, create a policy.
Returns {created: true} if the policy was created and returns
{created: False} if the policy was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_policy my_policy \\
'{"Version":"2015-12-12",\\
"St... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L299-L333 |
36,807 | saltstack/salt | salt/modules/boto_iot.py | describe_policy | def describe_policy(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy
'''
... | python | def describe_policy(policyName,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy
'''
... | [
"def",
"describe_policy",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | Given a policy name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy mypolicy | [
"Given",
"a",
"policy",
"name",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L360-L388 |
36,808 | saltstack/salt | salt/modules/boto_iot.py | policy_version_exists | def policy_version_exists(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does... | python | def policy_version_exists(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does... | [
"def",
"policy_version_exists",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | Given a policy name and version ID, check to see if the given policy version exists.
Returns True if the given policy version exists and returns False if the given
policy version does not exist.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.policy_version_exists mypolicy versionid | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"ID",
"check",
"to",
"see",
"if",
"the",
"given",
"policy",
"version",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L391-L416 |
36,809 | saltstack/salt | salt/modules/boto_iot.py | delete_policy_version | def delete_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Exa... | python | def delete_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Exa... | [
"def",
"delete_policy_version",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | Given a policy name and version, delete it.
Returns {deleted: true} if the policy version was deleted and returns
{deleted: false} if the policy version was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_policy_version mypolicy version | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L454-L476 |
36,810 | saltstack/salt | salt/modules/boto_iot.py | describe_policy_version | def describe_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.de... | python | def describe_policy_version(policyName, policyVersionId,
region=None, key=None, keyid=None, profile=None):
'''
Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.de... | [
"def",
"describe_policy_version",
"(",
"policyName",
",",
"policyVersionId",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
... | Given a policy name and version describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_policy_version mypolicy version | [
"Given",
"a",
"policy",
"name",
"and",
"version",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L479-L508 |
36,811 | saltstack/salt | salt/modules/boto_iot.py | list_policies | def list_policies(region=None, key=None, keyid=None, profile=None):
'''
List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...}
... | python | def list_policies(region=None, key=None, keyid=None, profile=None):
'''
List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...}
... | [
"def",
"list_policies",
"(",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",... | List all policies
Returns list of policies
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policies
Example Return:
.. code-block:: yaml
policies:
- {...}
- {...} | [
"List",
"all",
"policies"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L511-L543 |
36,812 | saltstack/salt | salt/modules/boto_iot.py | list_policy_versions | def list_policy_versions(policyName,
region=None, key=None, keyid=None, profile=None):
'''
List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
... | python | def list_policy_versions(policyName,
region=None, key=None, keyid=None, profile=None):
'''
List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
... | [
"def",
"list_policy_versions",
"(",
"policyName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"... | List the versions available for the given policy.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.list_policy_versions mypolicy
Example Return:
.. code-block:: yaml
policyVersions:
- {...}
- {...} | [
"List",
"the",
"versions",
"available",
"for",
"the",
"given",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L546-L578 |
36,813 | saltstack/salt | salt/modules/boto_iot.py | create_topic_rule | def create_topic_rule(ruleName, sql, actions, description,
ruleDisabled=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not create... | python | def create_topic_rule(ruleName, sql, actions, description,
ruleDisabled=False,
region=None, key=None, keyid=None, profile=None):
'''
Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not create... | [
"def",
"create_topic_rule",
"(",
"ruleName",
",",
"sql",
",",
"actions",
",",
"description",
",",
"ruleDisabled",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try"... | Given a valid config, create a topic rule.
Returns {created: true} if the rule was created and returns
{created: False} if the rule was not created.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.create_topic_rule my_rule "SELECT * FROM 'some/thing'" \\
'[{"lambda":{"fu... | [
"Given",
"a",
"valid",
"config",
"create",
"a",
"topic",
"rule",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L726-L756 |
36,814 | saltstack/salt | salt/modules/boto_iot.py | delete_topic_rule | def delete_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion bo... | python | def delete_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion bo... | [
"def",
"delete_topic_rule",
"(",
"ruleName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | Given a rule name, delete it.
Returns {deleted: true} if the rule was deleted and returns
{deleted: false} if the rule was not deleted.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.delete_rule myrule | [
"Given",
"a",
"rule",
"name",
"delete",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L792-L813 |
36,815 | saltstack/salt | salt/modules/boto_iot.py | describe_topic_rule | def describe_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule
'... | python | def describe_topic_rule(ruleName,
region=None, key=None, keyid=None, profile=None):
'''
Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule
'... | [
"def",
"describe_topic_rule",
"(",
"ruleName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",... | Given a topic rule name describe its properties.
Returns a dictionary of interesting properties.
CLI Example:
.. code-block:: bash
salt myminion boto_iot.describe_topic_rule myrule | [
"Given",
"a",
"topic",
"rule",
"name",
"describe",
"its",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L816-L842 |
36,816 | saltstack/salt | salt/modules/netbsdservice.py | _get_svc | def _get_svc(rcd, service_status):
'''
Returns a unique service status
'''
ena = None
lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines()
for rcvar in lines:
if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar:
ena = 'yes'
elif rcvar.star... | python | def _get_svc(rcd, service_status):
'''
Returns a unique service status
'''
ena = None
lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines()
for rcvar in lines:
if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar:
ena = 'yes'
elif rcvar.star... | [
"def",
"_get_svc",
"(",
"rcd",
",",
"service_status",
")",
":",
"ena",
"=",
"None",
"lines",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} rcvar'",
".",
"format",
"(",
"rcd",
")",
")",
".",
"splitlines",
"(",
")",
"for",
"rcvar",
"in",
"lines",
... | Returns a unique service status | [
"Returns",
"a",
"unique",
"service",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L146-L162 |
36,817 | saltstack/salt | salt/modules/netbsdservice.py | _get_svc_list | def _get_svc_list(service_status):
'''
Returns all service statuses
'''
prefix = '/etc/rc.d/'
ret = set()
lines = glob.glob('{0}*'.format(prefix))
for line in lines:
svc = _get_svc(line, service_status)
if svc is not None:
ret.add(svc)
return sorted(ret) | python | def _get_svc_list(service_status):
'''
Returns all service statuses
'''
prefix = '/etc/rc.d/'
ret = set()
lines = glob.glob('{0}*'.format(prefix))
for line in lines:
svc = _get_svc(line, service_status)
if svc is not None:
ret.add(svc)
return sorted(ret) | [
"def",
"_get_svc_list",
"(",
"service_status",
")",
":",
"prefix",
"=",
"'/etc/rc.d/'",
"ret",
"=",
"set",
"(",
")",
"lines",
"=",
"glob",
".",
"glob",
"(",
"'{0}*'",
".",
"format",
"(",
"prefix",
")",
")",
"for",
"line",
"in",
"lines",
":",
"svc",
"... | Returns all service statuses | [
"Returns",
"all",
"service",
"statuses"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsdservice.py#L165-L177 |
36,818 | saltstack/salt | salt/cloud/clouds/profitbricks.py | list_images | def list_images(call=None, kwargs=None):
'''
List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_images functio... | python | def list_images(call=None, kwargs=None):
'''
List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_images functio... | [
"def",
"list_images",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_images function must be called with '",
"'-f or --function.'",
")",
"if",
"not",
"version_com... | List all the images with alias by location
CLI Example:
.. code-block:: bash
salt-cloud -f list_images my-profitbricks-config location=us/las | [
"List",
"all",
"the",
"images",
"with",
"alias",
"by",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L245-L278 |
36,819 | saltstack/salt | salt/cloud/clouds/profitbricks.py | get_datacenter_id | def get_datacenter_id():
'''
Return datacenter ID from provider configuration
'''
datacenter_id = config.get_cloud_config_value(
'datacenter_id',
get_configured_provider(),
__opts__,
search_global=False
)
conn = get_conn()
try:
conn.get_datacenter(da... | python | def get_datacenter_id():
'''
Return datacenter ID from provider configuration
'''
datacenter_id = config.get_cloud_config_value(
'datacenter_id',
get_configured_provider(),
__opts__,
search_global=False
)
conn = get_conn()
try:
conn.get_datacenter(da... | [
"def",
"get_datacenter_id",
"(",
")",
":",
"datacenter_id",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'datacenter_id'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
"conn",
"=",
"get_conn",
"(",
")... | Return datacenter ID from provider configuration | [
"Return",
"datacenter",
"ID",
"from",
"provider",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L359-L378 |
36,820 | saltstack/salt | salt/cloud/clouds/profitbricks.py | list_loadbalancers | def list_loadbalancers(call=None):
'''
Return a list of the loadbalancers that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-loadbalancers option'
)
... | python | def list_loadbalancers(call=None):
'''
Return a list of the loadbalancers that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-loadbalancers option'
)
... | [
"def",
"list_loadbalancers",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-loadbalancers option'",
")",
"ret",
"=",
"{"... | Return a list of the loadbalancers that are on the provider | [
"Return",
"a",
"list",
"of",
"the",
"loadbalancers",
"that",
"are",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L381-L400 |
36,821 | saltstack/salt | salt/cloud/clouds/profitbricks.py | create_loadbalancer | def create_loadbalancer(call=None, kwargs=None):
'''
Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb
'''
if call != 'function':
raise SaltCloudSystemExit(
... | python | def create_loadbalancer(call=None, kwargs=None):
'''
Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb
'''
if call != 'function':
raise SaltCloudSystemExit(
... | [
"def",
"create_loadbalancer",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | Creates a loadbalancer within the datacenter from the provider config.
CLI Example:
.. code-block:: bash
salt-cloud -f create_loadbalancer profitbricks name=mylb | [
"Creates",
"a",
"loadbalancer",
"within",
"the",
"datacenter",
"from",
"the",
"provider",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L403-L430 |
36,822 | saltstack/salt | salt/cloud/clouds/profitbricks.py | get_datacenter | def get_datacenter(conn):
'''
Return the datacenter from the config provider datacenter ID
'''
datacenter_id = get_datacenter_id()
for item in conn.list_datacenters()['items']:
if item['id'] == datacenter_id:
return item
raise SaltCloudNotFound(
'The specified datac... | python | def get_datacenter(conn):
'''
Return the datacenter from the config provider datacenter ID
'''
datacenter_id = get_datacenter_id()
for item in conn.list_datacenters()['items']:
if item['id'] == datacenter_id:
return item
raise SaltCloudNotFound(
'The specified datac... | [
"def",
"get_datacenter",
"(",
"conn",
")",
":",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"for",
"item",
"in",
"conn",
".",
"list_datacenters",
"(",
")",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'id'",
"]",
"==",
"datacenter_id",
":",
"re... | Return the datacenter from the config provider datacenter ID | [
"Return",
"the",
"datacenter",
"from",
"the",
"config",
"provider",
"datacenter",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L433-L447 |
36,823 | saltstack/salt | salt/cloud/clouds/profitbricks.py | create_datacenter | def create_datacenter(call=None, kwargs=None):
'''
Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description"
'''
if call != 'function'... | python | def create_datacenter(call=None, kwargs=None):
'''
Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description"
'''
if call != 'function'... | [
"def",
"create_datacenter",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_address function must be called with -f or --function.'",
")",
"if",
"kwargs",
"is",
... | Creates a virtual datacenter based on supplied parameters.
CLI Example:
.. code-block:: bash
salt-cloud -f create_datacenter profitbricks name=mydatacenter
location=us/las description="my description" | [
"Creates",
"a",
"virtual",
"datacenter",
"based",
"on",
"supplied",
"parameters",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L450-L483 |
36,824 | saltstack/salt | salt/cloud/clouds/profitbricks.py | list_datacenters | def list_datacenters(conn=None, call=None):
'''
List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_datacenters function must be called wit... | python | def list_datacenters(conn=None, call=None):
'''
List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config
'''
if call != 'function':
raise SaltCloudSystemExit(
'The list_datacenters function must be called wit... | [
"def",
"list_datacenters",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_datacenters function must be called with '",
"'-f or --function.'",
")",
"datacenters",
"=",... | List all the data centers
CLI Example:
.. code-block:: bash
salt-cloud -f list_datacenters my-profitbricks-config | [
"List",
"all",
"the",
"data",
"centers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L524-L550 |
36,825 | saltstack/salt | salt/cloud/clouds/profitbricks.py | reserve_ipblock | def reserve_ipblock(call=None, kwargs=None):
'''
Reserve the IP Block
'''
if call == 'action':
raise SaltCloudSystemExit(
'The reserve_ipblock function must be called with -f or '
'--function.'
)
conn = get_conn()
if kwargs is None:
kwargs = {}
... | python | def reserve_ipblock(call=None, kwargs=None):
'''
Reserve the IP Block
'''
if call == 'action':
raise SaltCloudSystemExit(
'The reserve_ipblock function must be called with -f or '
'--function.'
)
conn = get_conn()
if kwargs is None:
kwargs = {}
... | [
"def",
"reserve_ipblock",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The reserve_ipblock function must be called with -f or '",
"'--function.'",
")",
"conn",
"=",
"get_c... | Reserve the IP Block | [
"Reserve",
"the",
"IP",
"Block"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L628-L658 |
36,826 | saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_nics | def _get_nics(vm_):
'''
Create network interfaces on appropriate LANs as defined in cloud profile.
'''
nics = []
if 'public_lan' in vm_:
firewall_rules = []
# Set LAN to public if it already exists, otherwise create a new
# public LAN.
if 'public_firewall_rules' in vm... | python | def _get_nics(vm_):
'''
Create network interfaces on appropriate LANs as defined in cloud profile.
'''
nics = []
if 'public_lan' in vm_:
firewall_rules = []
# Set LAN to public if it already exists, otherwise create a new
# public LAN.
if 'public_firewall_rules' in vm... | [
"def",
"_get_nics",
"(",
"vm_",
")",
":",
"nics",
"=",
"[",
"]",
"if",
"'public_lan'",
"in",
"vm_",
":",
"firewall_rules",
"=",
"[",
"]",
"# Set LAN to public if it already exists, otherwise create a new",
"# public LAN.",
"if",
"'public_firewall_rules'",
"in",
"vm_",... | Create network interfaces on appropriate LANs as defined in cloud profile. | [
"Create",
"network",
"interfaces",
"on",
"appropriate",
"LANs",
"as",
"defined",
"in",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L703-L733 |
36,827 | saltstack/salt | salt/cloud/clouds/profitbricks.py | set_public_lan | def set_public_lan(lan_id):
'''
Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created.
'''
conn = get_conn()
datacenter_id = get_datacenter_id()
try:
lan = conn.get_lan(datacenter_id=datacenter_id, lan_id=lan_id)... | python | def set_public_lan(lan_id):
'''
Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created.
'''
conn = get_conn()
datacenter_id = get_datacenter_id()
try:
lan = conn.get_lan(datacenter_id=datacenter_id, lan_id=lan_id)... | [
"def",
"set_public_lan",
"(",
"lan_id",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"datacenter_id",
"=",
"get_datacenter_id",
"(",
")",
"try",
":",
"lan",
"=",
"conn",
".",
"get_lan",
"(",
"datacenter_id",
"=",
"datacenter_id",
",",
"lan_id",
"=",
"lan_i... | Enables public Internet access for the specified public_lan. If no public
LAN is available, then a new public LAN is created. | [
"Enables",
"public",
"Internet",
"access",
"for",
"the",
"specified",
"public_lan",
".",
"If",
"no",
"public",
"LAN",
"is",
"available",
"then",
"a",
"new",
"public",
"LAN",
"is",
"created",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L736-L755 |
36,828 | saltstack/salt | salt/cloud/clouds/profitbricks.py | get_public_keys | def get_public_keys(vm_):
'''
Retrieve list of SSH public keys.
'''
key_filename = config.get_cloud_config_value(
'ssh_public_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key_filename)
if not os.pa... | python | def get_public_keys(vm_):
'''
Retrieve list of SSH public keys.
'''
key_filename = config.get_cloud_config_value(
'ssh_public_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key_filename)
if not os.pa... | [
"def",
"get_public_keys",
"(",
"vm_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_public_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"is"... | Retrieve list of SSH public keys. | [
"Retrieve",
"list",
"of",
"SSH",
"public",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L758-L778 |
36,829 | saltstack/salt | salt/cloud/clouds/profitbricks.py | get_key_filename | def get_key_filename(vm_):
'''
Check SSH private key file and return absolute path if exists.
'''
key_filename = config.get_cloud_config_value(
'ssh_private_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key... | python | def get_key_filename(vm_):
'''
Check SSH private key file and return absolute path if exists.
'''
key_filename = config.get_cloud_config_value(
'ssh_private_key', vm_, __opts__, search_global=False, default=None
)
if key_filename is not None:
key_filename = os.path.expanduser(key... | [
"def",
"get_key_filename",
"(",
"vm_",
")",
":",
"key_filename",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'ssh_private_key'",
",",
"vm_",
",",
"__opts__",
",",
"search_global",
"=",
"False",
",",
"default",
"=",
"None",
")",
"if",
"key_filename",
"i... | Check SSH private key file and return absolute path if exists. | [
"Check",
"SSH",
"private",
"key",
"file",
"and",
"return",
"absolute",
"path",
"if",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L781-L797 |
36,830 | saltstack/salt | salt/cloud/clouds/profitbricks.py | _override_size | def _override_size(vm_):
'''
Apply any extra component overrides to VM from the cloud profile.
'''
vm_size = get_size(vm_)
if 'cores' in vm_:
vm_size['cores'] = vm_['cores']
if 'ram' in vm_:
vm_size['ram'] = vm_['ram']
return vm_size | python | def _override_size(vm_):
'''
Apply any extra component overrides to VM from the cloud profile.
'''
vm_size = get_size(vm_)
if 'cores' in vm_:
vm_size['cores'] = vm_['cores']
if 'ram' in vm_:
vm_size['ram'] = vm_['ram']
return vm_size | [
"def",
"_override_size",
"(",
"vm_",
")",
":",
"vm_size",
"=",
"get_size",
"(",
"vm_",
")",
"if",
"'cores'",
"in",
"vm_",
":",
"vm_size",
"[",
"'cores'",
"]",
"=",
"vm_",
"[",
"'cores'",
"]",
"if",
"'ram'",
"in",
"vm_",
":",
"vm_size",
"[",
"'ram'",
... | Apply any extra component overrides to VM from the cloud profile. | [
"Apply",
"any",
"extra",
"component",
"overrides",
"to",
"VM",
"from",
"the",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1100-L1112 |
36,831 | saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_system_volume | def _get_system_volume(vm_):
'''
Construct VM system volume list from cloud profile config
'''
# Override system volume size if 'disk_size' is defined in cloud profile
disk_size = get_size(vm_)['disk']
if 'disk_size' in vm_:
disk_size = vm_['disk_size']
# Construct the system volum... | python | def _get_system_volume(vm_):
'''
Construct VM system volume list from cloud profile config
'''
# Override system volume size if 'disk_size' is defined in cloud profile
disk_size = get_size(vm_)['disk']
if 'disk_size' in vm_:
disk_size = vm_['disk_size']
# Construct the system volum... | [
"def",
"_get_system_volume",
"(",
"vm_",
")",
":",
"# Override system volume size if 'disk_size' is defined in cloud profile",
"disk_size",
"=",
"get_size",
"(",
"vm_",
")",
"[",
"'disk'",
"]",
"if",
"'disk_size'",
"in",
"vm_",
":",
"disk_size",
"=",
"vm_",
"[",
"'d... | Construct VM system volume list from cloud profile config | [
"Construct",
"VM",
"system",
"volume",
"list",
"from",
"cloud",
"profile",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1146-L1179 |
36,832 | saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_data_volumes | def _get_data_volumes(vm_):
'''
Construct a list of optional data volumes from the cloud profile
'''
ret = []
volumes = vm_['volumes']
for key, value in six.iteritems(volumes):
# Verify the required 'disk_size' property is present in the cloud
# profile config
if 'disk_si... | python | def _get_data_volumes(vm_):
'''
Construct a list of optional data volumes from the cloud profile
'''
ret = []
volumes = vm_['volumes']
for key, value in six.iteritems(volumes):
# Verify the required 'disk_size' property is present in the cloud
# profile config
if 'disk_si... | [
"def",
"_get_data_volumes",
"(",
"vm_",
")",
":",
"ret",
"=",
"[",
"]",
"volumes",
"=",
"vm_",
"[",
"'volumes'",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"volumes",
")",
":",
"# Verify the required 'disk_size' property is present in... | Construct a list of optional data volumes from the cloud profile | [
"Construct",
"a",
"list",
"of",
"optional",
"data",
"volumes",
"from",
"the",
"cloud",
"profile"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1182-L1213 |
36,833 | saltstack/salt | salt/cloud/clouds/profitbricks.py | _get_firewall_rules | def _get_firewall_rules(firewall_rules):
'''
Construct a list of optional firewall rules from the cloud profile.
'''
ret = []
for key, value in six.iteritems(firewall_rules):
# Verify the required 'protocol' property is present in the cloud
# profile config
if 'protocol' not ... | python | def _get_firewall_rules(firewall_rules):
'''
Construct a list of optional firewall rules from the cloud profile.
'''
ret = []
for key, value in six.iteritems(firewall_rules):
# Verify the required 'protocol' property is present in the cloud
# profile config
if 'protocol' not ... | [
"def",
"_get_firewall_rules",
"(",
"firewall_rules",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"firewall_rules",
")",
":",
"# Verify the required 'protocol' property is present in the cloud",
"# profile config",
"i... | Construct a list of optional firewall rules from the cloud profile. | [
"Construct",
"a",
"list",
"of",
"optional",
"firewall",
"rules",
"from",
"the",
"cloud",
"profile",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1227-L1251 |
36,834 | saltstack/salt | salt/modules/flatpak.py | is_installed | def is_installed(name):
'''
Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed... | python | def is_installed(name):
'''
Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed... | [
"def",
"is_installed",
"(",
"name",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' info '",
"+",
"name",
")",
"if",
"out",
"[",
"'retcode'",
"]",
"and",
"out",
"[",
"'stderr'",
"]",
":",
"return",
"False"... | Determine if a package or runtime is installed.
Args:
name (str): The name of the package or the runtime.
Returns:
bool: True if the specified package or runtime is installed.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_installed org.gimp.GIMP | [
"Determine",
"if",
"a",
"package",
"or",
"runtime",
"is",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L58-L79 |
36,835 | saltstack/salt | salt/modules/flatpak.py | uninstall | def uninstall(pkg):
'''
Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP
'''
ret = {'result': None, 'output': ''}
... | python | def uninstall(pkg):
'''
Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP
'''
ret = {'result': None, 'output': ''}
... | [
"def",
"uninstall",
"(",
"pkg",
")",
":",
"ret",
"=",
"{",
"'result'",
":",
"None",
",",
"'output'",
":",
"''",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' uninstall '",
"+",
"pkg",
")",
"if",
"out",
"[",... | Uninstall the specified package.
Args:
pkg (str): The package name.
Returns:
dict: The ``result`` and ``output``.
CLI Example:
.. code-block:: bash
salt '*' flatpak.uninstall org.gimp.GIMP | [
"Uninstall",
"the",
"specified",
"package",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L82-L109 |
36,836 | saltstack/salt | salt/modules/flatpak.py | is_remote_added | def is_remote_added(remote):
'''
Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub
'''
out = __salt__['cmd... | python | def is_remote_added(remote):
'''
Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub
'''
out = __salt__['cmd... | [
"def",
"is_remote_added",
"(",
"remote",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"FLATPAK_BINARY_NAME",
"+",
"' remotes'",
")",
"lines",
"=",
"out",
".",
"splitlines",
"(",
")",
"for",
"item",
"in",
"lines",
":",
"i",
"=",
"re",... | Determines if a remote exists.
Args:
remote (str): The remote's name.
Returns:
bool: True if the remote has already been added.
CLI Example:
.. code-block:: bash
salt '*' flatpak.is_remote_added flathub | [
"Determines",
"if",
"a",
"remote",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/flatpak.py#L142-L165 |
36,837 | saltstack/salt | salt/modules/pkgutil.py | upgrade_available | def upgrade_available(name):
'''
Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython
'''
version_num = None
cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format(
name)
out = ... | python | def upgrade_available(name):
'''
Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython
'''
version_num = None
cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format(
name)
out = ... | [
"def",
"upgrade_available",
"(",
"name",
")",
":",
"version_num",
"=",
"None",
"cmd",
"=",
"'/opt/csw/bin/pkgutil -c --parse --single {0}'",
".",
"format",
"(",
"name",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
")",
"if",
"out",
":... | Check if there is an upgrade available for a certain package
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade_available CSWpython | [
"Check",
"if",
"there",
"is",
"an",
"upgrade",
"available",
"for",
"a",
"certain",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L53-L74 |
36,838 | saltstack/salt | salt/modules/pkgutil.py | upgrade | def upgrade(refresh=True):
'''
Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade
... | python | def upgrade(refresh=True):
'''
Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade
... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"True",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"old",
"=",
"list_pkgs",
"(",
")",
"# Install or upgrade the package",
"# If package is alread... | Upgrade all of the packages to the latest available version.
Returns a dict containing the changes::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
CLI Example:
.. code-block:: bash
salt '*' pkgutil.upgrade | [
"Upgrade",
"all",
"of",
"the",
"packages",
"to",
"the",
"latest",
"available",
"version",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L102-L128 |
36,839 | saltstack/salt | salt/modules/pkgutil.py | install | def install(name=None, refresh=False, version=None, pkgs=None, **kwargs):
'''
Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A... | python | def install(name=None, refresh=False, version=None, pkgs=None, **kwargs):
'''
Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"version",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"refresh",
":",
"refresh_db",
"(",
")",
"try",
":",
"# Ignore 'sources' argument",... | Install packages using the pkgutil tool.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346
Multiple Package Installation Options:
pkgs
A list of packages to install from OpenCSW. Must be passed as a python
list.
... | [
"Install",
"packages",
"using",
"the",
"pkgutil",
"tool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L248-L307 |
36,840 | saltstack/salt | salt/modules/pkgutil.py | remove | def remove(name=None, pkgs=None, **kwargs):
'''
Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
... | python | def remove(name=None, pkgs=None, **kwargs):
'''
Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
")",
"[",
"0",
"]",
"except",
"Mini... | Remove a package and all its dependencies which are not in use by other
packages.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this option is... | [
"Remove",
"a",
"package",
"and",
"all",
"its",
"dependencies",
"which",
"are",
"not",
"in",
"use",
"by",
"other",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgutil.py#L310-L351 |
36,841 | saltstack/salt | salt/states/zenoss.py | monitored | def monitored(name, device_class=None, collector='localhost', prod_state=None):
'''
Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com... | python | def monitored(name, device_class=None, collector='localhost', prod_state=None):
'''
Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com... | [
"def",
"monitored",
"(",
"name",
",",
"device_class",
"=",
"None",
",",
"collector",
"=",
"'localhost'",
",",
"prod_state",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'name'",
"]",
"=",
"name",
"# If device is already monitored, return early",
... | Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com
- device_class: /Servers/Linux
- collector: localhost
-... | [
"Ensure",
"a",
"device",
"is",
"monitored",
".",
"The",
"name",
"given",
"will",
"be",
"used",
"for",
"Zenoss",
"device",
"name",
"and",
"should",
"be",
"resolvable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zenoss.py#L37-L92 |
36,842 | saltstack/salt | salt/states/docker_volume.py | _find_volume | def _find_volume(name):
'''
Find volume by name on minion
'''
docker_volumes = __salt__['docker.volumes']()['Volumes']
if docker_volumes:
volumes = [v for v in docker_volumes if v['Name'] == name]
if volumes:
return volumes[0]
return None | python | def _find_volume(name):
'''
Find volume by name on minion
'''
docker_volumes = __salt__['docker.volumes']()['Volumes']
if docker_volumes:
volumes = [v for v in docker_volumes if v['Name'] == name]
if volumes:
return volumes[0]
return None | [
"def",
"_find_volume",
"(",
"name",
")",
":",
"docker_volumes",
"=",
"__salt__",
"[",
"'docker.volumes'",
"]",
"(",
")",
"[",
"'Volumes'",
"]",
"if",
"docker_volumes",
":",
"volumes",
"=",
"[",
"v",
"for",
"v",
"in",
"docker_volumes",
"if",
"v",
"[",
"'N... | Find volume by name on minion | [
"Find",
"volume",
"by",
"name",
"on",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L56-L66 |
36,843 | saltstack/salt | salt/states/docker_volume.py | present | def present(name, driver=None, driver_opts=None, force=False):
'''
Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unles... | python | def present(name, driver=None, driver_opts=None, force=False):
'''
Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unles... | [
"def",
"present",
"(",
"name",
",",
"driver",
"=",
"None",
",",
"driver_opts",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment... | Ensure that a volume is present.
.. versionadded:: 2015.8.4
.. versionchanged:: 2015.8.6
This state no longer deletes and re-creates a volume if the existing
volume's driver does not match the ``driver`` parameter (unless the
``force`` parameter is set to ``True``).
.. versionchange... | [
"Ensure",
"that",
"a",
"volume",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L69-L192 |
36,844 | saltstack/salt | salt/states/docker_volume.py | absent | def absent(name, driver=None):
'''
Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
... | python | def absent(name, driver=None):
'''
Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
... | [
"def",
"absent",
"(",
"name",
",",
"driver",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"volume",
"=",
"_find_volume",
"(",
"name"... | Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionchanged:: 2017.7.0
This state was renamed from **docker.volume_absent** to **docker_volume.absent**
name
Name of the volume
Usage Examples:
.. code-block:: yaml
volume_foo:
docker_volume.absen... | [
"Ensure",
"that",
"a",
"volume",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L195-L231 |
36,845 | saltstack/salt | salt/modules/defaults.py | get | def get(key, default=''):
'''
defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:roo... | python | def get(key, default=''):
'''
defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:roo... | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
")",
":",
"# Determine formula namespace from query",
"if",
"':'",
"in",
"key",
":",
"namespace",
",",
"key",
"=",
"key",
".",
"split",
"(",
"':'",
",",
"1",
")",
"else",
":",
"namespace",
",",
"key"... | defaults.get is used much like pillar.get except that it will read
a default value for a pillar from defaults.json or defaults.yaml
files that are stored in the root of a salt formula.
CLI Example:
.. code-block:: bash
salt '*' defaults.get core:users:root
The defaults is computed from p... | [
"defaults",
".",
"get",
"is",
"used",
"much",
"like",
"pillar",
".",
"get",
"except",
"that",
"it",
"will",
"read",
"a",
"default",
"value",
"for",
"a",
"pillar",
"from",
"defaults",
".",
"json",
"or",
"defaults",
".",
"yaml",
"files",
"that",
"are",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L74-L106 |
36,846 | saltstack/salt | salt/modules/defaults.py | merge | def merge(dest, src, merge_lists=False, in_place=True):
'''
defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it wi... | python | def merge(dest, src, merge_lists=False, in_place=True):
'''
defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it wi... | [
"def",
"merge",
"(",
"dest",
",",
"src",
",",
"merge_lists",
"=",
"False",
",",
"in_place",
"=",
"True",
")",
":",
"if",
"in_place",
":",
"merged",
"=",
"dest",
"else",
":",
"merged",
"=",
"copy",
".",
"deepcopy",
"(",
"dest",
")",
"return",
"dictupd... | defaults.merge
Allows deep merging of dicts in formulas.
merge_lists : False
If True, it will also merge lists instead of replace their items.
in_place : True
If True, it will merge into dest dict,
if not it will make a new copy from that dict and return it.
CLI Exampl... | [
"defaults",
".",
"merge",
"Allows",
"deep",
"merging",
"of",
"dicts",
"in",
"formulas",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L109-L133 |
36,847 | saltstack/salt | salt/modules/win_task.py | _reverse_lookup | def _reverse_lookup(dictionary, value):
'''
Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str
'''
value_in... | python | def _reverse_lookup(dictionary, value):
'''
Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str
'''
value_in... | [
"def",
"_reverse_lookup",
"(",
"dictionary",
",",
"value",
")",
":",
"value_index",
"=",
"-",
"1",
"for",
"idx",
",",
"dict_value",
"in",
"enumerate",
"(",
"dictionary",
".",
"values",
"(",
")",
")",
":",
"if",
"type",
"(",
"dict_value",
")",
"==",
"li... | Lookup the key in a dictionary by it's value. Will return the first match.
:param dict dictionary: The dictionary to search
:param str value: The value to search for.
:return: Returns the first key to match the value
:rtype: str | [
"Lookup",
"the",
"key",
"in",
"a",
"dictionary",
"by",
"it",
"s",
"value",
".",
"Will",
"return",
"the",
"first",
"match",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L241-L262 |
36,848 | saltstack/salt | salt/modules/win_task.py | _lookup_first | def _lookup_first(dictionary, key):
'''
Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtyp... | python | def _lookup_first(dictionary, key):
'''
Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtyp... | [
"def",
"_lookup_first",
"(",
"dictionary",
",",
"key",
")",
":",
"value",
"=",
"dictionary",
"[",
"key",
"]",
"if",
"type",
"(",
"value",
")",
"==",
"list",
":",
"return",
"value",
"[",
"0",
"]",
"else",
":",
"return",
"value"
] | Lookup the first value given a key. Returns the first value if the key
refers to a list or the value itself.
:param dict dictionary: The dictionary to search
:param str key: The key to get
:return: Returns the first value available for the key
:rtype: str | [
"Lookup",
"the",
"first",
"value",
"given",
"a",
"key",
".",
"Returns",
"the",
"first",
"value",
"if",
"the",
"key",
"refers",
"to",
"a",
"list",
"or",
"the",
"value",
"itself",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L265-L281 |
36,849 | saltstack/salt | salt/modules/win_task.py | _save_task_definition | def _save_task_definition(name,
task_folder,
task_definition,
user_name,
password,
logon_type):
'''
Internal function to save the task definition.
:param str name: The name of t... | python | def _save_task_definition(name,
task_folder,
task_definition,
user_name,
password,
logon_type):
'''
Internal function to save the task definition.
:param str name: The name of t... | [
"def",
"_save_task_definition",
"(",
"name",
",",
"task_folder",
",",
"task_definition",
",",
"user_name",
",",
"password",
",",
"logon_type",
")",
":",
"try",
":",
"task_folder",
".",
"RegisterTaskDefinition",
"(",
"name",
",",
"task_definition",
",",
"TASK_CREAT... | Internal function to save the task definition.
:param str name: The name of the task.
:param str task_folder: The object representing the folder in which to save
the task
:param str task_definition: The object representing the task to be saved
:param str user_name: The user_account under which t... | [
"Internal",
"function",
"to",
"save",
"the",
"task",
"definition",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L284-L333 |
36,850 | saltstack/salt | salt/modules/win_task.py | list_tasks | def list_tasks(location='\\'):
r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | python | def list_tasks(location='\\'):
r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | [
"def",
"list_tasks",
"(",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"\"Schedule.Service... | r'''
List all tasks located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
:return: Returns a list of tasks.
... | [
"r",
"List",
"all",
"tasks",
"located",
"in",
"a",
"specific",
"location",
"in",
"the",
"task",
"scheduler",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L336-L366 |
36,851 | saltstack/salt | salt/modules/win_task.py | list_folders | def list_folders(location='\\'):
r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | python | def list_folders(location='\\'):
r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
... | [
"def",
"list_folders",
"(",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"\"Schedule.Servi... | r'''
List all folders located in a specific location in the task scheduler.
:param str location: A string value representing the folder from which you
want to list tasks. Default is '\\' which is the root for the task
scheduler (C:\Windows\System32\tasks).
:return: Returns a list of folder... | [
"r",
"List",
"all",
"folders",
"located",
"in",
"a",
"specific",
"location",
"in",
"the",
"task",
"scheduler",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L369-L399 |
36,852 | saltstack/salt | salt/modules/win_task.py | list_triggers | def list_triggers(name, location='\\'):
r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\'... | python | def list_triggers(name, location='\\'):
r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\'... | [
"def",
"list_triggers",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
... | r'''
List all triggers that pertain to a task in the specified location.
:param str name: The name of the task for which list triggers.
:param str location: A string value representing the location of the task
from which to list triggers. Default is '\\' which is the root for the
task sche... | [
"r",
"List",
"all",
"triggers",
"that",
"pertain",
"to",
"a",
"task",
"in",
"the",
"specified",
"location",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L402-L435 |
36,853 | saltstack/salt | salt/modules/win_task.py | list_actions | def list_actions(name, location='\\'):
r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' whi... | python | def list_actions(name, location='\\'):
r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' whi... | [
"def",
"list_actions",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Create the task service object",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"task_service",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
... | r'''
List all actions that pertain to a task in the specified location.
:param str name: The name of the task for which list actions.
:param str location: A string value representing the location of the task
from which to list actions. Default is '\\' which is the root for the
task schedul... | [
"r",
"List",
"all",
"actions",
"that",
"pertain",
"to",
"a",
"task",
"in",
"the",
"specified",
"location",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L438-L471 |
36,854 | saltstack/salt | salt/modules/win_task.py | create_task_from_xml | def create_task_from_xml(name,
location='\\',
xml_text=None,
xml_path=None,
user_name='System',
password=None):
r'''
Create a task based on XML. Source can be a file or a string of XML.
... | python | def create_task_from_xml(name,
location='\\',
xml_text=None,
xml_path=None,
user_name='System',
password=None):
r'''
Create a task based on XML. Source can be a file or a string of XML.
... | [
"def",
"create_task_from_xml",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
",",
"xml_text",
"=",
"None",
",",
"xml_path",
"=",
"None",
",",
"user_name",
"=",
"'System'",
",",
"password",
"=",
"None",
")",
":",
"# Check for existing task",
"if",
"name",
"in"... | r'''
Create a task based on XML. Source can be a file or a string of XML.
:param str name: The name of the task. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the task. Default is '\\' which is the root for th... | [
"r",
"Create",
"a",
"task",
"based",
"on",
"XML",
".",
"Source",
"can",
"be",
"a",
"file",
"or",
"a",
"string",
"of",
"XML",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L557-L675 |
36,855 | saltstack/salt | salt/modules/win_task.py | create_folder | def create_folder(name, location='\\'):
r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' whi... | python | def create_folder(name, location='\\'):
r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' whi... | [
"def",
"create_folder",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"in",
"list_folders",
"(",
"location",
")",
":",
"# Connect to an existing task definition",
"return",
"'{0} already exists'",
".",
"format",
"(... | r'''
Create a folder in which to create tasks.
:param str name: The name of the folder. This will be displayed in the task
scheduler.
:param str location: A string value representing the location in which to
create the folder. Default is '\\' which is the root for the task
schedule... | [
"r",
"Create",
"a",
"folder",
"in",
"which",
"to",
"create",
"tasks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L678-L716 |
36,856 | saltstack/salt | salt/modules/win_task.py | delete_task | def delete_task(name, location='\\'):
r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\ta... | python | def delete_task(name, location='\\'):
r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\ta... | [
"def",
"delete_task",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing task",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
... | r'''
Delete a task from the task scheduler.
:param str name: The name of the task to delete.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if successful, Fa... | [
"r",
"Delete",
"a",
"task",
"from",
"the",
"task",
"scheduler",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1061-L1098 |
36,857 | saltstack/salt | salt/modules/win_task.py | run | def run(name, location='\\'):
r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return:... | python | def run(name, location='\\'):
r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return:... | [
"def",
"run",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
"# c... | r'''
Run a scheduled task manually.
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if successful, False if unsu... | [
"r",
"Run",
"a",
"scheduled",
"task",
"manually",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1142-L1178 |
36,858 | saltstack/salt | salt/modules/win_task.py | run_wait | def run_wait(name, location='\\'):
r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\S... | python | def run_wait(name, location='\\'):
r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\S... | [
"def",
"run_wait",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
... | r'''
Run a scheduled task and return when the task finishes
:param str name: The name of the task to run.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: True if s... | [
"r",
"Run",
"a",
"scheduled",
"task",
"and",
"return",
"when",
"the",
"task",
"finishes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1181-L1235 |
36,859 | saltstack/salt | salt/modules/win_task.py | status | def status(name, location='\\'):
r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the tas... | python | def status(name, location='\\'):
r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the tas... | [
"def",
"status",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing folder",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")",
"... | r'''
Determine the status of a task. Is it Running, Queued, Ready, etc.
:param str name: The name of the task for which to return the status
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\Syste... | [
"r",
"Determine",
"the",
"status",
"of",
"a",
"task",
".",
"Is",
"it",
"Running",
"Queued",
"Ready",
"etc",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1277-L1316 |
36,860 | saltstack/salt | salt/modules/win_task.py | clear_triggers | def clear_triggers(name, location='\\'):
r'''
Remove all triggers from the task.
:param str name: The name of the task from which to clear all triggers.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(... | python | def clear_triggers(name, location='\\'):
r'''
Remove all triggers from the task.
:param str name: The name of the task from which to clear all triggers.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(... | [
"def",
"clear_triggers",
"(",
"name",
",",
"location",
"=",
"'\\\\'",
")",
":",
"# Check for existing task",
"if",
"name",
"not",
"in",
"list_tasks",
"(",
"location",
")",
":",
"return",
"'{0} not found in {1}'",
".",
"format",
"(",
"name",
",",
"location",
")... | r'''
Remove all triggers from the task.
:param str name: The name of the task from which to clear all triggers.
:param str location: A string value representing the location of the task.
Default is '\\' which is the root for the task scheduler
(C:\Windows\System32\tasks).
:return: Tru... | [
"r",
"Remove",
"all",
"triggers",
"from",
"the",
"task",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L2205-L2246 |
36,861 | saltstack/salt | salt/sdb/couchdb.py | _get_conn | def _get_conn(profile):
'''
Get a connection to CouchDB
'''
DEFAULT_BASE_URL = _construct_uri(profile) or 'http://localhost:5984'
server = couchdb.Server()
if profile['database'] not in server:
server.create(profile['database'])
return server | python | def _get_conn(profile):
'''
Get a connection to CouchDB
'''
DEFAULT_BASE_URL = _construct_uri(profile) or 'http://localhost:5984'
server = couchdb.Server()
if profile['database'] not in server:
server.create(profile['database'])
return server | [
"def",
"_get_conn",
"(",
"profile",
")",
":",
"DEFAULT_BASE_URL",
"=",
"_construct_uri",
"(",
"profile",
")",
"or",
"'http://localhost:5984'",
"server",
"=",
"couchdb",
".",
"Server",
"(",
")",
"if",
"profile",
"[",
"'database'",
"]",
"not",
"in",
"server",
... | Get a connection to CouchDB | [
"Get",
"a",
"connection",
"to",
"CouchDB"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/couchdb.py#L79-L88 |
36,862 | saltstack/salt | salt/client/ssh/shell.py | gen_key | def gen_key(path):
'''
Generate a key for use with salt-ssh
'''
cmd = 'ssh-keygen -P "" -f {0} -t rsa -q'.format(path)
if not os.path.isdir(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
subprocess.call(cmd, shell=True) | python | def gen_key(path):
'''
Generate a key for use with salt-ssh
'''
cmd = 'ssh-keygen -P "" -f {0} -t rsa -q'.format(path)
if not os.path.isdir(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
subprocess.call(cmd, shell=True) | [
"def",
"gen_key",
"(",
"path",
")",
":",
"cmd",
"=",
"'ssh-keygen -P \"\" -f {0} -t rsa -q'",
".",
"format",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
":",
"os",
"."... | Generate a key for use with salt-ssh | [
"Generate",
"a",
"key",
"for",
"use",
"with",
"salt",
"-",
"ssh"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L42-L49 |
36,863 | saltstack/salt | salt/client/ssh/shell.py | gen_shell | def gen_shell(opts, **kwargs):
'''
Return the correct shell interface for the target system
'''
if kwargs['winrm']:
try:
import saltwinshell
shell = saltwinshell.Shell(opts, **kwargs)
except ImportError:
log.error('The saltwinshell library is not avail... | python | def gen_shell(opts, **kwargs):
'''
Return the correct shell interface for the target system
'''
if kwargs['winrm']:
try:
import saltwinshell
shell = saltwinshell.Shell(opts, **kwargs)
except ImportError:
log.error('The saltwinshell library is not avail... | [
"def",
"gen_shell",
"(",
"opts",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
"[",
"'winrm'",
"]",
":",
"try",
":",
"import",
"saltwinshell",
"shell",
"=",
"saltwinshell",
".",
"Shell",
"(",
"opts",
",",
"*",
"*",
"kwargs",
")",
"except",
"Impo... | Return the correct shell interface for the target system | [
"Return",
"the",
"correct",
"shell",
"interface",
"for",
"the",
"target",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L52-L65 |
36,864 | saltstack/salt | salt/client/ssh/shell.py | Shell.get_error | def get_error(self, errstr):
'''
Parse out an error and return a targeted error string
'''
for line in errstr.split('\n'):
if line.startswith('ssh:'):
return line
if line.startswith('Pseudo-terminal'):
continue
if 'to th... | python | def get_error(self, errstr):
'''
Parse out an error and return a targeted error string
'''
for line in errstr.split('\n'):
if line.startswith('ssh:'):
return line
if line.startswith('Pseudo-terminal'):
continue
if 'to th... | [
"def",
"get_error",
"(",
"self",
",",
"errstr",
")",
":",
"for",
"line",
"in",
"errstr",
".",
"split",
"(",
"'\\n'",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"'ssh:'",
")",
":",
"return",
"line",
"if",
"line",
".",
"startswith",
"(",
"'Pseudo-... | Parse out an error and return a targeted error string | [
"Parse",
"out",
"an",
"error",
"and",
"return",
"a",
"targeted",
"error",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L106-L118 |
36,865 | saltstack/salt | salt/client/ssh/shell.py | Shell._key_opts | def _key_opts(self):
'''
Return options for the ssh command base for Salt to call
'''
options = [
'KbdInteractiveAuthentication=no',
]
if self.passwd:
options.append('PasswordAuthentication=yes')
else:
options.... | python | def _key_opts(self):
'''
Return options for the ssh command base for Salt to call
'''
options = [
'KbdInteractiveAuthentication=no',
]
if self.passwd:
options.append('PasswordAuthentication=yes')
else:
options.... | [
"def",
"_key_opts",
"(",
"self",
")",
":",
"options",
"=",
"[",
"'KbdInteractiveAuthentication=no'",
",",
"]",
"if",
"self",
".",
"passwd",
":",
"options",
".",
"append",
"(",
"'PasswordAuthentication=yes'",
")",
"else",
":",
"options",
".",
"append",
"(",
"... | Return options for the ssh command base for Salt to call | [
"Return",
"options",
"for",
"the",
"ssh",
"command",
"base",
"for",
"Salt",
"to",
"call"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L120-L154 |
36,866 | saltstack/salt | salt/client/ssh/shell.py | Shell._passwd_opts | def _passwd_opts(self):
'''
Return options to pass to ssh
'''
# TODO ControlMaster does not work without ControlPath
# user could take advantage of it if they set ControlPath in their
# ssh config. Also, ControlPersist not widely available.
options = ['ControlMas... | python | def _passwd_opts(self):
'''
Return options to pass to ssh
'''
# TODO ControlMaster does not work without ControlPath
# user could take advantage of it if they set ControlPath in their
# ssh config. Also, ControlPersist not widely available.
options = ['ControlMas... | [
"def",
"_passwd_opts",
"(",
"self",
")",
":",
"# TODO ControlMaster does not work without ControlPath",
"# user could take advantage of it if they set ControlPath in their",
"# ssh config. Also, ControlPersist not widely available.",
"options",
"=",
"[",
"'ControlMaster=auto'",
",",
"'S... | Return options to pass to ssh | [
"Return",
"options",
"to",
"pass",
"to",
"ssh"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L156-L194 |
36,867 | saltstack/salt | salt/client/ssh/shell.py | Shell._copy_id_str_old | def _copy_id_str_old(self):
'''
Return the string to execute ssh-copy-id
'''
if self.passwd:
# Using single quotes prevents shell expansion and
# passwords containing '$'
return "{0} {1} '{2} -p {3} {4} {5}@{6}'".format(
'ssh-copy-i... | python | def _copy_id_str_old(self):
'''
Return the string to execute ssh-copy-id
'''
if self.passwd:
# Using single quotes prevents shell expansion and
# passwords containing '$'
return "{0} {1} '{2} -p {3} {4} {5}@{6}'".format(
'ssh-copy-i... | [
"def",
"_copy_id_str_old",
"(",
"self",
")",
":",
"if",
"self",
".",
"passwd",
":",
"# Using single quotes prevents shell expansion and",
"# passwords containing '$'",
"return",
"\"{0} {1} '{2} -p {3} {4} {5}@{6}'\"",
".",
"format",
"(",
"'ssh-copy-id'",
",",
"'-i {0}.pub'",
... | Return the string to execute ssh-copy-id | [
"Return",
"the",
"string",
"to",
"execute",
"ssh",
"-",
"copy",
"-",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L200-L215 |
36,868 | saltstack/salt | salt/client/ssh/shell.py | Shell.copy_id | def copy_id(self):
'''
Execute ssh-copy-id to plant the id file on the target
'''
stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old())
if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr:
stdout, stderr, retcode = self._run_cmd(self._copy_id_... | python | def copy_id(self):
'''
Execute ssh-copy-id to plant the id file on the target
'''
stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old())
if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr:
stdout, stderr, retcode = self._run_cmd(self._copy_id_... | [
"def",
"copy_id",
"(",
"self",
")",
":",
"stdout",
",",
"stderr",
",",
"retcode",
"=",
"self",
".",
"_run_cmd",
"(",
"self",
".",
"_copy_id_str_old",
"(",
")",
")",
"if",
"salt",
".",
"defaults",
".",
"exitcodes",
".",
"EX_OK",
"!=",
"retcode",
"and",
... | Execute ssh-copy-id to plant the id file on the target | [
"Execute",
"ssh",
"-",
"copy",
"-",
"id",
"to",
"plant",
"the",
"id",
"file",
"on",
"the",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L235-L242 |
36,869 | saltstack/salt | salt/client/ssh/shell.py | Shell._cmd_str | def _cmd_str(self, cmd, ssh='ssh'):
'''
Return the cmd string to execute
'''
# TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will
# need to deliver the SHIM to the remote host and execute it there
command = [ssh]
if ssh != 'scp':
comm... | python | def _cmd_str(self, cmd, ssh='ssh'):
'''
Return the cmd string to execute
'''
# TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will
# need to deliver the SHIM to the remote host and execute it there
command = [ssh]
if ssh != 'scp':
comm... | [
"def",
"_cmd_str",
"(",
"self",
",",
"cmd",
",",
"ssh",
"=",
"'ssh'",
")",
":",
"# TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will",
"# need to deliver the SHIM to the remote host and execute it there",
"command",
"=",
"[",
"ssh",
"]",
"if",
"ssh",
"!=",
... | Return the cmd string to execute | [
"Return",
"the",
"cmd",
"string",
"to",
"execute"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L244-L267 |
36,870 | saltstack/salt | salt/client/ssh/shell.py | Shell._old_run_cmd | def _old_run_cmd(self, cmd):
'''
Cleanly execute the command string
'''
try:
proc = subprocess.Popen(
cmd,
shell=True,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
data = proc.commun... | python | def _old_run_cmd(self, cmd):
'''
Cleanly execute the command string
'''
try:
proc = subprocess.Popen(
cmd,
shell=True,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
data = proc.commun... | [
"def",
"_old_run_cmd",
"(",
"self",
",",
"cmd",
")",
":",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"stderr",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
... | Cleanly execute the command string | [
"Cleanly",
"execute",
"the",
"command",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L269-L284 |
36,871 | saltstack/salt | salt/client/ssh/shell.py | Shell.exec_nb_cmd | def exec_nb_cmd(self, cmd):
'''
Yield None until cmd finished
'''
r_out = []
r_err = []
rcode = None
cmd = self._cmd_str(cmd)
logmsg = 'Executing non-blocking command: {0}'.format(cmd)
if self.passwd:
logmsg = logmsg.replace(self.passw... | python | def exec_nb_cmd(self, cmd):
'''
Yield None until cmd finished
'''
r_out = []
r_err = []
rcode = None
cmd = self._cmd_str(cmd)
logmsg = 'Executing non-blocking command: {0}'.format(cmd)
if self.passwd:
logmsg = logmsg.replace(self.passw... | [
"def",
"exec_nb_cmd",
"(",
"self",
",",
"cmd",
")",
":",
"r_out",
"=",
"[",
"]",
"r_err",
"=",
"[",
"]",
"rcode",
"=",
"None",
"cmd",
"=",
"self",
".",
"_cmd_str",
"(",
"cmd",
")",
"logmsg",
"=",
"'Executing non-blocking command: {0}'",
".",
"format",
... | Yield None until cmd finished | [
"Yield",
"None",
"until",
"cmd",
"finished"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L310-L330 |
36,872 | saltstack/salt | salt/client/ssh/shell.py | Shell.exec_cmd | def exec_cmd(self, cmd):
'''
Execute a remote command
'''
cmd = self._cmd_str(cmd)
logmsg = 'Executing command: {0}'.format(cmd)
if self.passwd:
logmsg = logmsg.replace(self.passwd, ('*' * 6))
if 'decode("base64")' in logmsg or 'base64.b64decode(' in ... | python | def exec_cmd(self, cmd):
'''
Execute a remote command
'''
cmd = self._cmd_str(cmd)
logmsg = 'Executing command: {0}'.format(cmd)
if self.passwd:
logmsg = logmsg.replace(self.passwd, ('*' * 6))
if 'decode("base64")' in logmsg or 'base64.b64decode(' in ... | [
"def",
"exec_cmd",
"(",
"self",
",",
"cmd",
")",
":",
"cmd",
"=",
"self",
".",
"_cmd_str",
"(",
"cmd",
")",
"logmsg",
"=",
"'Executing command: {0}'",
".",
"format",
"(",
"cmd",
")",
"if",
"self",
".",
"passwd",
":",
"logmsg",
"=",
"logmsg",
".",
"re... | Execute a remote command | [
"Execute",
"a",
"remote",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L332-L348 |
36,873 | saltstack/salt | salt/client/ssh/shell.py | Shell.send | def send(self, local, remote, makedirs=False):
'''
scp a file or files to a remote system
'''
if makedirs:
self.exec_cmd('mkdir -p {0}'.format(os.path.dirname(remote)))
# scp needs [<ipv6}
host = self.host
if ':' in host:
host = '[{0}]'.fo... | python | def send(self, local, remote, makedirs=False):
'''
scp a file or files to a remote system
'''
if makedirs:
self.exec_cmd('mkdir -p {0}'.format(os.path.dirname(remote)))
# scp needs [<ipv6}
host = self.host
if ':' in host:
host = '[{0}]'.fo... | [
"def",
"send",
"(",
"self",
",",
"local",
",",
"remote",
",",
"makedirs",
"=",
"False",
")",
":",
"if",
"makedirs",
":",
"self",
".",
"exec_cmd",
"(",
"'mkdir -p {0}'",
".",
"format",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"remote",
")",
")",
... | scp a file or files to a remote system | [
"scp",
"a",
"file",
"or",
"files",
"to",
"a",
"remote",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L350-L370 |
36,874 | saltstack/salt | salt/client/ssh/shell.py | Shell._run_cmd | def _run_cmd(self, cmd, key_accept=False, passwd_retries=3):
'''
Execute a shell command via VT. This is blocking and assumes that ssh
is being run
'''
if not cmd:
return '', 'No command or passphrase', 245
term = salt.utils.vt.Terminal(
cmd,
... | python | def _run_cmd(self, cmd, key_accept=False, passwd_retries=3):
'''
Execute a shell command via VT. This is blocking and assumes that ssh
is being run
'''
if not cmd:
return '', 'No command or passphrase', 245
term = salt.utils.vt.Terminal(
cmd,
... | [
"def",
"_run_cmd",
"(",
"self",
",",
"cmd",
",",
"key_accept",
"=",
"False",
",",
"passwd_retries",
"=",
"3",
")",
":",
"if",
"not",
"cmd",
":",
"return",
"''",
",",
"'No command or passphrase'",
",",
"245",
"term",
"=",
"salt",
".",
"utils",
".",
"vt"... | Execute a shell command via VT. This is blocking and assumes that ssh
is being run | [
"Execute",
"a",
"shell",
"command",
"via",
"VT",
".",
"This",
"is",
"blocking",
"and",
"assumes",
"that",
"ssh",
"is",
"being",
"run"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L372-L441 |
36,875 | saltstack/salt | salt/log/handlers/sentry_mod.py | setup_handlers | def setup_handlers():
'''
sets up the sentry handler
'''
__grains__ = salt.loader.grains(__opts__)
__salt__ = salt.loader.minion_mods(__opts__)
if 'sentry_handler' not in __opts__:
log.debug('No \'sentry_handler\' key was found in the configuration')
return False
options = {}... | python | def setup_handlers():
'''
sets up the sentry handler
'''
__grains__ = salt.loader.grains(__opts__)
__salt__ = salt.loader.minion_mods(__opts__)
if 'sentry_handler' not in __opts__:
log.debug('No \'sentry_handler\' key was found in the configuration')
return False
options = {}... | [
"def",
"setup_handlers",
"(",
")",
":",
"__grains__",
"=",
"salt",
".",
"loader",
".",
"grains",
"(",
"__opts__",
")",
"__salt__",
"=",
"salt",
".",
"loader",
".",
"minion_mods",
"(",
"__opts__",
")",
"if",
"'sentry_handler'",
"not",
"in",
"__opts__",
":",... | sets up the sentry handler | [
"sets",
"up",
"the",
"sentry",
"handler"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/sentry_mod.py#L120-L235 |
36,876 | saltstack/salt | salt/auth/ldap.py | _config | def _config(key, mandatory=True, opts=None):
'''
Return a value for 'name' from master config file options or defaults.
'''
try:
if opts:
value = opts['auth.ldap.{0}'.format(key)]
else:
value = __opts__['auth.ldap.{0}'.format(key)]
except KeyError:
try... | python | def _config(key, mandatory=True, opts=None):
'''
Return a value for 'name' from master config file options or defaults.
'''
try:
if opts:
value = opts['auth.ldap.{0}'.format(key)]
else:
value = __opts__['auth.ldap.{0}'.format(key)]
except KeyError:
try... | [
"def",
"_config",
"(",
"key",
",",
"mandatory",
"=",
"True",
",",
"opts",
"=",
"None",
")",
":",
"try",
":",
"if",
"opts",
":",
"value",
"=",
"opts",
"[",
"'auth.ldap.{0}'",
".",
"format",
"(",
"key",
")",
"]",
"else",
":",
"value",
"=",
"__opts__"... | Return a value for 'name' from master config file options or defaults. | [
"Return",
"a",
"value",
"for",
"name",
"from",
"master",
"config",
"file",
"options",
"or",
"defaults",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L51-L68 |
36,877 | saltstack/salt | salt/auth/ldap.py | _render_template | def _render_template(param, username):
'''
Render config template, substituting username where found.
'''
env = Environment()
template = env.from_string(param)
variables = {'username': username}
return template.render(variables) | python | def _render_template(param, username):
'''
Render config template, substituting username where found.
'''
env = Environment()
template = env.from_string(param)
variables = {'username': username}
return template.render(variables) | [
"def",
"_render_template",
"(",
"param",
",",
"username",
")",
":",
"env",
"=",
"Environment",
"(",
")",
"template",
"=",
"env",
".",
"from_string",
"(",
"param",
")",
"variables",
"=",
"{",
"'username'",
":",
"username",
"}",
"return",
"template",
".",
... | Render config template, substituting username where found. | [
"Render",
"config",
"template",
"substituting",
"username",
"where",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L71-L78 |
36,878 | saltstack/salt | salt/auth/ldap.py | auth | def auth(username, password):
'''
Simple LDAP auth
'''
if not HAS_LDAP:
log.error('LDAP authentication requires python-ldap module')
return False
bind = None
# If bind credentials are configured, verify that we receive a valid bind
if _config('binddn', mandatory=False) and ... | python | def auth(username, password):
'''
Simple LDAP auth
'''
if not HAS_LDAP:
log.error('LDAP authentication requires python-ldap module')
return False
bind = None
# If bind credentials are configured, verify that we receive a valid bind
if _config('binddn', mandatory=False) and ... | [
"def",
"auth",
"(",
"username",
",",
"password",
")",
":",
"if",
"not",
"HAS_LDAP",
":",
"log",
".",
"error",
"(",
"'LDAP authentication requires python-ldap module'",
")",
"return",
"False",
"bind",
"=",
"None",
"# If bind credentials are configured, verify that we rec... | Simple LDAP auth | [
"Simple",
"LDAP",
"auth"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L293-L322 |
36,879 | saltstack/salt | salt/modules/napalm_mod.py | reconnect | def reconnect(force=False, **kwargs): # pylint: disable=unused-argument
'''
Reconnect the NAPALM proxy when the connection
is dropped by the network device.
The connection can be forced to be restarted
using the ``force`` argument.
.. note::
This function can be used only when running... | python | def reconnect(force=False, **kwargs): # pylint: disable=unused-argument
'''
Reconnect the NAPALM proxy when the connection
is dropped by the network device.
The connection can be forced to be restarted
using the ``force`` argument.
.. note::
This function can be used only when running... | [
"def",
"reconnect",
"(",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"default_ret",
"=",
"{",
"'out'",
":",
"None",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'Already alive.'",
"}",
"if",
"not",
... | Reconnect the NAPALM proxy when the connection
is dropped by the network device.
The connection can be forced to be restarted
using the ``force`` argument.
.. note::
This function can be used only when running proxy minions.
CLI Example:
.. code-block:: bash
salt '*' napalm.... | [
"Reconnect",
"the",
"NAPALM",
"proxy",
"when",
"the",
"connection",
"is",
"dropped",
"by",
"the",
"network",
"device",
".",
"The",
"connection",
"can",
"be",
"forced",
"to",
"be",
"restarted",
"using",
"the",
"force",
"argument",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L195-L249 |
36,880 | saltstack/salt | salt/modules/napalm_mod.py | call | def call(method, *args, **kwargs):
'''
Execute arbitrary methods from the NAPALM library.
To see the expected output, please consult the NAPALM documentation.
.. note::
This feature is not recommended to be used in production.
It should be used for testing only!
CLI Example:
... | python | def call(method, *args, **kwargs):
'''
Execute arbitrary methods from the NAPALM library.
To see the expected output, please consult the NAPALM documentation.
.. note::
This feature is not recommended to be used in production.
It should be used for testing only!
CLI Example:
... | [
"def",
"call",
"(",
"method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"clean_kwargs",
"=",
"{",
"}",
"for",
"karg",
",",
"warg",
"in",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
":",
"# remove the __pub args",
"if",
"not",
"karg",
".",... | Execute arbitrary methods from the NAPALM library.
To see the expected output, please consult the NAPALM documentation.
.. note::
This feature is not recommended to be used in production.
It should be used for testing only!
CLI Example:
.. code-block:: bash
salt '*' napalm.c... | [
"Execute",
"arbitrary",
"methods",
"from",
"the",
"NAPALM",
"library",
".",
"To",
"see",
"the",
"expected",
"output",
"please",
"consult",
"the",
"NAPALM",
"documentation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L253-L281 |
36,881 | saltstack/salt | salt/modules/napalm_mod.py | compliance_report | def compliance_report(filepath=None,
string=None,
renderer='jinja|yaml',
**kwargs):
'''
Return the compliance report.
filepath
The absolute path to the validation file.
.. versionchanged:: 2019.2.0
Beginning with re... | python | def compliance_report(filepath=None,
string=None,
renderer='jinja|yaml',
**kwargs):
'''
Return the compliance report.
filepath
The absolute path to the validation file.
.. versionchanged:: 2019.2.0
Beginning with re... | [
"def",
"compliance_report",
"(",
"filepath",
"=",
"None",
",",
"string",
"=",
"None",
",",
"renderer",
"=",
"'jinja|yaml'",
",",
"*",
"*",
"kwargs",
")",
":",
"validation_string",
"=",
"__salt__",
"[",
"'slsutil.renderer'",
"]",
"(",
"path",
"=",
"filepath",... | Return the compliance report.
filepath
The absolute path to the validation file.
.. versionchanged:: 2019.2.0
Beginning with release codename ``2019.2.0``, this function has been
enhanced, to be able to leverage the multi-engine template rendering
of Salt, besides the poss... | [
"Return",
"the",
"compliance",
"report",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L285-L417 |
36,882 | saltstack/salt | salt/states/grafana_dashboard.py | _cleaned | def _cleaned(_dashboard):
'''Return a copy without fields that can differ.'''
dashboard = copy.deepcopy(_dashboard)
for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS:
dashboard.pop(ignored_dashboard_field, None)
for row in dashboard.get('rows', []):
for ignored_row_field in _IGNO... | python | def _cleaned(_dashboard):
'''Return a copy without fields that can differ.'''
dashboard = copy.deepcopy(_dashboard)
for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS:
dashboard.pop(ignored_dashboard_field, None)
for row in dashboard.get('rows', []):
for ignored_row_field in _IGNO... | [
"def",
"_cleaned",
"(",
"_dashboard",
")",
":",
"dashboard",
"=",
"copy",
".",
"deepcopy",
"(",
"_dashboard",
")",
"for",
"ignored_dashboard_field",
"in",
"_IGNORED_DASHBOARD_FIELDS",
":",
"dashboard",
".",
"pop",
"(",
"ignored_dashboard_field",
",",
"None",
")",
... | Return a copy without fields that can differ. | [
"Return",
"a",
"copy",
"without",
"fields",
"that",
"can",
"differ",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L241-L258 |
36,883 | saltstack/salt | salt/states/grafana_dashboard.py | _inherited_dashboard | def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret):
'''Return a dashboard with properties from parents.'''
base_dashboards = []
for base_dashboard_from_pillar in base_dashboards_from_pillar:
base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar)
if base_dashbo... | python | def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret):
'''Return a dashboard with properties from parents.'''
base_dashboards = []
for base_dashboard_from_pillar in base_dashboards_from_pillar:
base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar)
if base_dashbo... | [
"def",
"_inherited_dashboard",
"(",
"dashboard",
",",
"base_dashboards_from_pillar",
",",
"ret",
")",
":",
"base_dashboards",
"=",
"[",
"]",
"for",
"base_dashboard_from_pillar",
"in",
"base_dashboards_from_pillar",
":",
"base_dashboard",
"=",
"__salt__",
"[",
"'pillar.g... | Return a dashboard with properties from parents. | [
"Return",
"a",
"dashboard",
"with",
"properties",
"from",
"parents",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L261-L282 |
36,884 | saltstack/salt | salt/states/grafana_dashboard.py | _inherited_row | def _inherited_row(row, base_rows_from_pillar, ret):
'''Return a row with properties from parents.'''
base_rows = []
for base_row_from_pillar in base_rows_from_pillar:
base_row = __salt__['pillar.get'](base_row_from_pillar)
if base_row:
base_rows.append(base_row)
elif bas... | python | def _inherited_row(row, base_rows_from_pillar, ret):
'''Return a row with properties from parents.'''
base_rows = []
for base_row_from_pillar in base_rows_from_pillar:
base_row = __salt__['pillar.get'](base_row_from_pillar)
if base_row:
base_rows.append(base_row)
elif bas... | [
"def",
"_inherited_row",
"(",
"row",
",",
"base_rows_from_pillar",
",",
"ret",
")",
":",
"base_rows",
"=",
"[",
"]",
"for",
"base_row_from_pillar",
"in",
"base_rows_from_pillar",
":",
"base_row",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"base_row_from_pilla... | Return a row with properties from parents. | [
"Return",
"a",
"row",
"with",
"properties",
"from",
"parents",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L285-L303 |
36,885 | saltstack/salt | salt/states/grafana_dashboard.py | _inherited_panel | def _inherited_panel(panel, base_panels_from_pillar, ret):
'''Return a panel with properties from parents.'''
base_panels = []
for base_panel_from_pillar in base_panels_from_pillar:
base_panel = __salt__['pillar.get'](base_panel_from_pillar)
if base_panel:
base_panels.append(base... | python | def _inherited_panel(panel, base_panels_from_pillar, ret):
'''Return a panel with properties from parents.'''
base_panels = []
for base_panel_from_pillar in base_panels_from_pillar:
base_panel = __salt__['pillar.get'](base_panel_from_pillar)
if base_panel:
base_panels.append(base... | [
"def",
"_inherited_panel",
"(",
"panel",
",",
"base_panels_from_pillar",
",",
"ret",
")",
":",
"base_panels",
"=",
"[",
"]",
"for",
"base_panel_from_pillar",
"in",
"base_panels_from_pillar",
":",
"base_panel",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"base_... | Return a panel with properties from parents. | [
"Return",
"a",
"panel",
"with",
"properties",
"from",
"parents",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L306-L324 |
36,886 | saltstack/salt | salt/states/grafana_dashboard.py | _auto_adjust_panel_spans | def _auto_adjust_panel_spans(dashboard):
'''Adjust panel spans to take up the available width.
For each group of panels that would be laid out on the same level, scale up
the unspecified panel spans to fill up the level.
'''
for row in dashboard.get('rows', []):
levels = []
current_... | python | def _auto_adjust_panel_spans(dashboard):
'''Adjust panel spans to take up the available width.
For each group of panels that would be laid out on the same level, scale up
the unspecified panel spans to fill up the level.
'''
for row in dashboard.get('rows', []):
levels = []
current_... | [
"def",
"_auto_adjust_panel_spans",
"(",
"dashboard",
")",
":",
"for",
"row",
"in",
"dashboard",
".",
"get",
"(",
"'rows'",
",",
"[",
"]",
")",
":",
"levels",
"=",
"[",
"]",
"current_level",
"=",
"[",
"]",
"levels",
".",
"append",
"(",
"current_level",
... | Adjust panel spans to take up the available width.
For each group of panels that would be laid out on the same level, scale up
the unspecified panel spans to fill up the level. | [
"Adjust",
"panel",
"spans",
"to",
"take",
"up",
"the",
"available",
"width",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L331-L362 |
36,887 | saltstack/salt | salt/states/grafana_dashboard.py | _ensure_pinned_rows | def _ensure_pinned_rows(dashboard):
'''Pin rows to the top of the dashboard.'''
pinned_row_titles = __salt__['pillar.get'](_PINNED_ROWS_PILLAR)
if not pinned_row_titles:
return
pinned_row_titles_lower = []
for title in pinned_row_titles:
pinned_row_titles_lower.append(title.lower())... | python | def _ensure_pinned_rows(dashboard):
'''Pin rows to the top of the dashboard.'''
pinned_row_titles = __salt__['pillar.get'](_PINNED_ROWS_PILLAR)
if not pinned_row_titles:
return
pinned_row_titles_lower = []
for title in pinned_row_titles:
pinned_row_titles_lower.append(title.lower())... | [
"def",
"_ensure_pinned_rows",
"(",
"dashboard",
")",
":",
"pinned_row_titles",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"_PINNED_ROWS_PILLAR",
")",
"if",
"not",
"pinned_row_titles",
":",
"return",
"pinned_row_titles_lower",
"=",
"[",
"]",
"for",
"title",
"i... | Pin rows to the top of the dashboard. | [
"Pin",
"rows",
"to",
"the",
"top",
"of",
"the",
"dashboard",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L365-L380 |
36,888 | saltstack/salt | salt/states/grafana_dashboard.py | _ensure_panel_ids | def _ensure_panel_ids(dashboard):
'''Assign panels auto-incrementing IDs.'''
panel_id = 1
for row in dashboard.get('rows', []):
for panel in row.get('panels', []):
panel['id'] = panel_id
panel_id += 1 | python | def _ensure_panel_ids(dashboard):
'''Assign panels auto-incrementing IDs.'''
panel_id = 1
for row in dashboard.get('rows', []):
for panel in row.get('panels', []):
panel['id'] = panel_id
panel_id += 1 | [
"def",
"_ensure_panel_ids",
"(",
"dashboard",
")",
":",
"panel_id",
"=",
"1",
"for",
"row",
"in",
"dashboard",
".",
"get",
"(",
"'rows'",
",",
"[",
"]",
")",
":",
"for",
"panel",
"in",
"row",
".",
"get",
"(",
"'panels'",
",",
"[",
"]",
")",
":",
... | Assign panels auto-incrementing IDs. | [
"Assign",
"panels",
"auto",
"-",
"incrementing",
"IDs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L383-L389 |
36,889 | saltstack/salt | salt/states/grafana_dashboard.py | _ensure_annotations | def _ensure_annotations(dashboard):
'''Explode annotation_tags into annotations.'''
if 'annotation_tags' not in dashboard:
return
tags = dashboard['annotation_tags']
annotations = {
'enable': True,
'list': [],
}
for tag in tags:
annotations['list'].append({
... | python | def _ensure_annotations(dashboard):
'''Explode annotation_tags into annotations.'''
if 'annotation_tags' not in dashboard:
return
tags = dashboard['annotation_tags']
annotations = {
'enable': True,
'list': [],
}
for tag in tags:
annotations['list'].append({
... | [
"def",
"_ensure_annotations",
"(",
"dashboard",
")",
":",
"if",
"'annotation_tags'",
"not",
"in",
"dashboard",
":",
"return",
"tags",
"=",
"dashboard",
"[",
"'annotation_tags'",
"]",
"annotations",
"=",
"{",
"'enable'",
":",
"True",
",",
"'list'",
":",
"[",
... | Explode annotation_tags into annotations. | [
"Explode",
"annotation_tags",
"into",
"annotations",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L392-L413 |
36,890 | saltstack/salt | salt/states/grafana_dashboard.py | _get | def _get(url, profile):
'''Get a specific dashboard.'''
request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'),
url)
response = requests.get(
request_url,
headers={
"Accept": "application/json",
"Auth... | python | def _get(url, profile):
'''Get a specific dashboard.'''
request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'),
url)
response = requests.get(
request_url,
headers={
"Accept": "application/json",
"Auth... | [
"def",
"_get",
"(",
"url",
",",
"profile",
")",
":",
"request_url",
"=",
"\"{0}/api/dashboards/{1}\"",
".",
"format",
"(",
"profile",
".",
"get",
"(",
"'grafana_url'",
")",
",",
"url",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"request_url",
",",
... | Get a specific dashboard. | [
"Get",
"a",
"specific",
"dashboard",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L416-L433 |
36,891 | saltstack/salt | salt/states/grafana_dashboard.py | _delete | def _delete(url, profile):
'''Delete a specific dashboard.'''
request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'),
url)
response = requests.delete(
request_url,
headers={
"Accept": "application/json",
... | python | def _delete(url, profile):
'''Delete a specific dashboard.'''
request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'),
url)
response = requests.delete(
request_url,
headers={
"Accept": "application/json",
... | [
"def",
"_delete",
"(",
"url",
",",
"profile",
")",
":",
"request_url",
"=",
"\"{0}/api/dashboards/{1}\"",
".",
"format",
"(",
"profile",
".",
"get",
"(",
"'grafana_url'",
")",
",",
"url",
")",
"response",
"=",
"requests",
".",
"delete",
"(",
"request_url",
... | Delete a specific dashboard. | [
"Delete",
"a",
"specific",
"dashboard",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L436-L449 |
36,892 | saltstack/salt | salt/states/grafana_dashboard.py | _update | def _update(dashboard, profile):
'''Update a specific dashboard.'''
payload = {
'dashboard': dashboard,
'overwrite': True
}
request_url = "{0}/api/dashboards/db".format(profile.get('grafana_url'))
response = requests.post(
request_url,
headers={
"Authoriza... | python | def _update(dashboard, profile):
'''Update a specific dashboard.'''
payload = {
'dashboard': dashboard,
'overwrite': True
}
request_url = "{0}/api/dashboards/db".format(profile.get('grafana_url'))
response = requests.post(
request_url,
headers={
"Authoriza... | [
"def",
"_update",
"(",
"dashboard",
",",
"profile",
")",
":",
"payload",
"=",
"{",
"'dashboard'",
":",
"dashboard",
",",
"'overwrite'",
":",
"True",
"}",
"request_url",
"=",
"\"{0}/api/dashboards/db\"",
".",
"format",
"(",
"profile",
".",
"get",
"(",
"'grafa... | Update a specific dashboard. | [
"Update",
"a",
"specific",
"dashboard",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L452-L466 |
36,893 | saltstack/salt | salt/states/grafana_dashboard.py | _stripped | def _stripped(d):
'''Strip falsey entries.'''
ret = {}
for k, v in six.iteritems(d):
if v:
ret[k] = v
return ret | python | def _stripped(d):
'''Strip falsey entries.'''
ret = {}
for k, v in six.iteritems(d):
if v:
ret[k] = v
return ret | [
"def",
"_stripped",
"(",
"d",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"d",
")",
":",
"if",
"v",
":",
"ret",
"[",
"k",
"]",
"=",
"v",
"return",
"ret"
] | Strip falsey entries. | [
"Strip",
"falsey",
"entries",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L540-L546 |
36,894 | saltstack/salt | salt/modules/telemetry.py | get_alert_config | def get_alert_config(deployment_id, metric_name=None, api_key=None, profile="telemetry"):
'''
Get all alert definitions associated with a given deployment or if metric_name
is specified, obtain the specific alert config
Returns dictionary or list of dictionaries.
CLI Example:
salt myminio... | python | def get_alert_config(deployment_id, metric_name=None, api_key=None, profile="telemetry"):
'''
Get all alert definitions associated with a given deployment or if metric_name
is specified, obtain the specific alert config
Returns dictionary or list of dictionaries.
CLI Example:
salt myminio... | [
"def",
"get_alert_config",
"(",
"deployment_id",
",",
"metric_name",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"auth",
"=",
"_auth",
"(",
"profile",
"=",
"profile",
")",
"alert",
"=",
"False",
"key",
"=",
"... | Get all alert definitions associated with a given deployment or if metric_name
is specified, obtain the specific alert config
Returns dictionary or list of dictionaries.
CLI Example:
salt myminion telemetry.get_alert_config rs-ds033197 currentConnections profile=telemetry
salt myminion te... | [
"Get",
"all",
"alert",
"definitions",
"associated",
"with",
"a",
"given",
"deployment",
"or",
"if",
"metric_name",
"is",
"specified",
"obtain",
"the",
"specific",
"alert",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L119-L159 |
36,895 | saltstack/salt | salt/modules/telemetry.py | get_notification_channel_id | def get_notification_channel_id(notify_channel, profile="telemetry"):
'''
Given an email address, creates a notification-channels
if one is not found and also returns the corresponding
notification channel id.
notify_channel
Email escalation policy
profile
A dict of telemetry co... | python | def get_notification_channel_id(notify_channel, profile="telemetry"):
'''
Given an email address, creates a notification-channels
if one is not found and also returns the corresponding
notification channel id.
notify_channel
Email escalation policy
profile
A dict of telemetry co... | [
"def",
"get_notification_channel_id",
"(",
"notify_channel",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"# This helper is used to procure the channel ids",
"# used to notify when the alarm threshold is violated",
"auth",
"=",
"_auth",
"(",
"profile",
"=",
"profile",
")",
... | Given an email address, creates a notification-channels
if one is not found and also returns the corresponding
notification channel id.
notify_channel
Email escalation policy
profile
A dict of telemetry config information.
CLI Example:
salt myminion telemetry.get_notificat... | [
"Given",
"an",
"email",
"address",
"creates",
"a",
"notification",
"-",
"channels",
"if",
"one",
"is",
"not",
"found",
"and",
"also",
"returns",
"the",
"corresponding",
"notification",
"channel",
"id",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L162-L203 |
36,896 | saltstack/salt | salt/modules/telemetry.py | get_alarms | def get_alarms(deployment_id, profile="telemetry"):
'''
get all the alarms set up against the current deployment
Returns dictionary of alarm information
CLI Example:
salt myminion telemetry.get_alarms rs-ds033197 profile=telemetry
'''
auth = _auth(profile=profile)
try:
r... | python | def get_alarms(deployment_id, profile="telemetry"):
'''
get all the alarms set up against the current deployment
Returns dictionary of alarm information
CLI Example:
salt myminion telemetry.get_alarms rs-ds033197 profile=telemetry
'''
auth = _auth(profile=profile)
try:
r... | [
"def",
"get_alarms",
"(",
"deployment_id",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"auth",
"=",
"_auth",
"(",
"profile",
"=",
"profile",
")",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"_get_telemetry_base",
"(",
"profile",
")",
"+",... | get all the alarms set up against the current deployment
Returns dictionary of alarm information
CLI Example:
salt myminion telemetry.get_alarms rs-ds033197 profile=telemetry | [
"get",
"all",
"the",
"alarms",
"set",
"up",
"against",
"the",
"current",
"deployment"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L206-L234 |
36,897 | saltstack/salt | salt/modules/telemetry.py | create_alarm | def create_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
'''
create an telemetry alarms.
data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.create_alarm rs-ds033197 {} profile=telemetry... | python | def create_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
'''
create an telemetry alarms.
data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.create_alarm rs-ds033197 {} profile=telemetry... | [
"def",
"create_alarm",
"(",
"deployment_id",
",",
"metric_name",
",",
"data",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"auth",
"=",
"_auth",
"(",
"api_key",
",",
"profile",
")",
"request_uri",
"=",
"_get_telemetry_base",
"... | create an telemetry alarms.
data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.create_alarm rs-ds033197 {} profile=telemetry | [
"create",
"an",
"telemetry",
"alarms",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L237-L287 |
36,898 | saltstack/salt | salt/modules/telemetry.py | update_alarm | def update_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
'''
update an telemetry alarms. data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.update_alarm rs-ds033197 {} profile=telemetry
... | python | def update_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
'''
update an telemetry alarms. data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.update_alarm rs-ds033197 {} profile=telemetry
... | [
"def",
"update_alarm",
"(",
"deployment_id",
",",
"metric_name",
",",
"data",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"\"telemetry\"",
")",
":",
"auth",
"=",
"_auth",
"(",
"api_key",
",",
"profile",
")",
"alert",
"=",
"get_alert_config",
"(",
"de... | update an telemetry alarms. data is a dict of alert configuration data.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.update_alarm rs-ds033197 {} profile=telemetry | [
"update",
"an",
"telemetry",
"alarms",
".",
"data",
"is",
"a",
"dict",
"of",
"alert",
"configuration",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L290-L343 |
36,899 | saltstack/salt | salt/modules/telemetry.py | delete_alarms | def delete_alarms(deployment_id, alert_id=None, metric_name=None, api_key=None, profile='telemetry'):
'''delete an alert specified by alert_id or if not specified blows away all the alerts
in the current deployment.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion te... | python | def delete_alarms(deployment_id, alert_id=None, metric_name=None, api_key=None, profile='telemetry'):
'''delete an alert specified by alert_id or if not specified blows away all the alerts
in the current deployment.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion te... | [
"def",
"delete_alarms",
"(",
"deployment_id",
",",
"alert_id",
"=",
"None",
",",
"metric_name",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"profile",
"=",
"'telemetry'",
")",
":",
"auth",
"=",
"_auth",
"(",
"profile",
"=",
"profile",
")",
"if",
"aler... | delete an alert specified by alert_id or if not specified blows away all the alerts
in the current deployment.
Returns (bool success, str message) tuple.
CLI Example:
salt myminion telemetry.delete_alarms rs-ds033197 profile=telemetry | [
"delete",
"an",
"alert",
"specified",
"by",
"alert_id",
"or",
"if",
"not",
"specified",
"blows",
"away",
"all",
"the",
"alerts",
"in",
"the",
"current",
"deployment",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telemetry.py#L346-L388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.