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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,100 | saltstack/salt | salt/auth/__init__.py | Authorize.rights_check | def rights_check(self, form, sub_auth, name, load, eauth=None):
'''
Read in the access system to determine if the validated user has
requested rights
'''
if load.get('eauth'):
sub_auth = sub_auth[load['eauth']]
good = self.ckminions.any_auth(
f... | python | def rights_check(self, form, sub_auth, name, load, eauth=None):
'''
Read in the access system to determine if the validated user has
requested rights
'''
if load.get('eauth'):
sub_auth = sub_auth[load['eauth']]
good = self.ckminions.any_auth(
f... | [
"def",
"rights_check",
"(",
"self",
",",
"form",
",",
"sub_auth",
",",
"name",
",",
"load",
",",
"eauth",
"=",
"None",
")",
":",
"if",
"load",
".",
"get",
"(",
"'eauth'",
")",
":",
"sub_auth",
"=",
"sub_auth",
"[",
"load",
"[",
"'eauth'",
"]",
"]",... | Read in the access system to determine if the validated user has
requested rights | [
"Read",
"in",
"the",
"access",
"system",
"to",
"determine",
"if",
"the",
"validated",
"user",
"has",
"requested",
"rights"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L604-L631 |
35,101 | saltstack/salt | salt/auth/__init__.py | Authorize.rights | def rights(self, form, load):
'''
Determine what type of authentication is being requested and pass
authorization
Note: this will check that the user has at least one right that will let
the user execute "load", this does not deal with conflicting rules
'''
adat... | python | def rights(self, form, load):
'''
Determine what type of authentication is being requested and pass
authorization
Note: this will check that the user has at least one right that will let
the user execute "load", this does not deal with conflicting rules
'''
adat... | [
"def",
"rights",
"(",
"self",
",",
"form",
",",
"load",
")",
":",
"adata",
"=",
"self",
".",
"auth_data",
"good",
"=",
"False",
"if",
"load",
".",
"get",
"(",
"'token'",
",",
"False",
")",
":",
"for",
"sub_auth",
"in",
"self",
".",
"token",
"(",
... | Determine what type of authentication is being requested and pass
authorization
Note: this will check that the user has at least one right that will let
the user execute "load", this does not deal with conflicting rules | [
"Determine",
"what",
"type",
"of",
"authentication",
"is",
"being",
"requested",
"and",
"pass",
"authorization"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L633-L670 |
35,102 | saltstack/salt | salt/auth/__init__.py | Resolver.cli | def cli(self, eauth):
'''
Execute the CLI options to fill in the extra data needed for the
defined eauth system
'''
ret = {}
if not eauth:
print('External authentication system has not been specified')
return ret
fstr = '{0}.auth'.format(ea... | python | def cli(self, eauth):
'''
Execute the CLI options to fill in the extra data needed for the
defined eauth system
'''
ret = {}
if not eauth:
print('External authentication system has not been specified')
return ret
fstr = '{0}.auth'.format(ea... | [
"def",
"cli",
"(",
"self",
",",
"eauth",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"eauth",
":",
"print",
"(",
"'External authentication system has not been specified'",
")",
"return",
"ret",
"fstr",
"=",
"'{0}.auth'",
".",
"format",
"(",
"eauth",
")",
... | Execute the CLI options to fill in the extra data needed for the
defined eauth system | [
"Execute",
"the",
"CLI",
"options",
"to",
"fill",
"in",
"the",
"extra",
"data",
"needed",
"for",
"the",
"defined",
"eauth",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L690-L724 |
35,103 | saltstack/salt | salt/auth/__init__.py | Resolver.token_cli | def token_cli(self, eauth, load):
'''
Create the token from the CLI and request the correct data to
authenticate via the passed authentication mechanism
'''
load['cmd'] = 'mk_token'
load['eauth'] = eauth
tdata = self._send_token_request(load)
if 'token' no... | python | def token_cli(self, eauth, load):
'''
Create the token from the CLI and request the correct data to
authenticate via the passed authentication mechanism
'''
load['cmd'] = 'mk_token'
load['eauth'] = eauth
tdata = self._send_token_request(load)
if 'token' no... | [
"def",
"token_cli",
"(",
"self",
",",
"eauth",
",",
"load",
")",
":",
"load",
"[",
"'cmd'",
"]",
"=",
"'mk_token'",
"load",
"[",
"'eauth'",
"]",
"=",
"eauth",
"tdata",
"=",
"self",
".",
"_send_token_request",
"(",
"load",
")",
"if",
"'token'",
"not",
... | Create the token from the CLI and request the correct data to
authenticate via the passed authentication mechanism | [
"Create",
"the",
"token",
"from",
"the",
"CLI",
"and",
"request",
"the",
"correct",
"data",
"to",
"authenticate",
"via",
"the",
"passed",
"authentication",
"mechanism"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L726-L742 |
35,104 | saltstack/salt | salt/auth/__init__.py | Resolver.get_token | def get_token(self, token):
'''
Request a token from the master
'''
load = {}
load['token'] = token
load['cmd'] = 'get_token'
tdata = self._send_token_request(load)
return tdata | python | def get_token(self, token):
'''
Request a token from the master
'''
load = {}
load['token'] = token
load['cmd'] = 'get_token'
tdata = self._send_token_request(load)
return tdata | [
"def",
"get_token",
"(",
"self",
",",
"token",
")",
":",
"load",
"=",
"{",
"}",
"load",
"[",
"'token'",
"]",
"=",
"token",
"load",
"[",
"'cmd'",
"]",
"=",
"'get_token'",
"tdata",
"=",
"self",
".",
"_send_token_request",
"(",
"load",
")",
"return",
"t... | Request a token from the master | [
"Request",
"a",
"token",
"from",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L752-L760 |
35,105 | saltstack/salt | salt/modules/boto3_sns.py | list_topics | def list_topics(region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the requester's topics
CLI example::
salt myminion boto3_sns.list_topics
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
res = {}
NextToken = ''
while NextToken is... | python | def list_topics(region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the requester's topics
CLI example::
salt myminion boto3_sns.list_topics
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
res = {}
NextToken = ''
while NextToken is... | [
"def",
"list_topics",
"(",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"keyid",
"=",
"keyid",... | Returns a list of the requester's topics
CLI example::
salt myminion boto3_sns.list_topics | [
"Returns",
"a",
"list",
"of",
"the",
"requester",
"s",
"topics"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L78-L96 |
35,106 | saltstack/salt | salt/modules/boto3_sns.py | describe_topic | def describe_topic(name, region=None, key=None, keyid=None, profile=None):
'''
Returns details about a specific SNS topic, specified by name or ARN.
CLI example::
salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice
'''
topics = list_topics(region=region, key=key, keyi... | python | def describe_topic(name, region=None, key=None, keyid=None, profile=None):
'''
Returns details about a specific SNS topic, specified by name or ARN.
CLI example::
salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice
'''
topics = list_topics(region=region, key=key, keyi... | [
"def",
"describe_topic",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"topics",
"=",
"list_topics",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
",",
"k... | Returns details about a specific SNS topic, specified by name or ARN.
CLI example::
salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice | [
"Returns",
"details",
"about",
"a",
"specific",
"SNS",
"topic",
"specified",
"by",
"name",
"or",
"ARN",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L99-L127 |
35,107 | saltstack/salt | salt/modules/boto3_sns.py | get_topic_attributes | def get_topic_attributes(TopicArn, region=None, key=None, keyid=None, profile=None):
'''
Returns all of the properties of a topic. Topic properties returned might differ based on the
authorization of the user.
CLI example::
salt myminion boto3_sns.get_topic_attributes someTopic region=us-west... | python | def get_topic_attributes(TopicArn, region=None, key=None, keyid=None, profile=None):
'''
Returns all of the properties of a topic. Topic properties returned might differ based on the
authorization of the user.
CLI example::
salt myminion boto3_sns.get_topic_attributes someTopic region=us-west... | [
"def",
"get_topic_attributes",
"(",
"TopicArn",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key",
","... | Returns all of the properties of a topic. Topic properties returned might differ based on the
authorization of the user.
CLI example::
salt myminion boto3_sns.get_topic_attributes someTopic region=us-west-1 | [
"Returns",
"all",
"of",
"the",
"properties",
"of",
"a",
"topic",
".",
"Topic",
"properties",
"returned",
"might",
"differ",
"based",
"on",
"the",
"authorization",
"of",
"the",
"user",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L181-L195 |
35,108 | saltstack/salt | salt/modules/boto3_sns.py | set_topic_attributes | def set_topic_attributes(TopicArn, AttributeName, AttributeValue, region=None, key=None, keyid=None,
profile=None):
'''
Set an attribute of a topic to a new value.
CLI example::
salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue
'''
... | python | def set_topic_attributes(TopicArn, AttributeName, AttributeValue, region=None, key=None, keyid=None,
profile=None):
'''
Set an attribute of a topic to a new value.
CLI example::
salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue
'''
... | [
"def",
"set_topic_attributes",
"(",
"TopicArn",
",",
"AttributeName",
",",
"AttributeValue",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"... | Set an attribute of a topic to a new value.
CLI example::
salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue | [
"Set",
"an",
"attribute",
"of",
"a",
"topic",
"to",
"a",
"new",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L198-L217 |
35,109 | saltstack/salt | salt/modules/boto3_sns.py | list_subscriptions_by_topic | def list_subscriptions_by_topic(TopicArn, region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the subscriptions to a specific topic
CLI example::
salt myminion boto3_sns.list_subscriptions_by_topic mytopic region=us-east-1
'''
conn = _get_conn(region=region, key=key, ke... | python | def list_subscriptions_by_topic(TopicArn, region=None, key=None, keyid=None, profile=None):
'''
Returns a list of the subscriptions to a specific topic
CLI example::
salt myminion boto3_sns.list_subscriptions_by_topic mytopic region=us-east-1
'''
conn = _get_conn(region=region, key=key, ke... | [
"def",
"list_subscriptions_by_topic",
"(",
"TopicArn",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key"... | Returns a list of the subscriptions to a specific topic
CLI example::
salt myminion boto3_sns.list_subscriptions_by_topic mytopic region=us-east-1 | [
"Returns",
"a",
"list",
"of",
"the",
"subscriptions",
"to",
"a",
"specific",
"topic"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L220-L240 |
35,110 | saltstack/salt | salt/modules/boto3_sns.py | get_subscription_attributes | def get_subscription_attributes(SubscriptionArn, region=None, key=None, keyid=None, profile=None):
'''
Returns all of the properties of a subscription.
CLI example::
salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1
'''
conn = _get_conn(region=region, ke... | python | def get_subscription_attributes(SubscriptionArn, region=None, key=None, keyid=None, profile=None):
'''
Returns all of the properties of a subscription.
CLI example::
salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1
'''
conn = _get_conn(region=region, ke... | [
"def",
"get_subscription_attributes",
"(",
"SubscriptionArn",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"key",
"=",
... | Returns all of the properties of a subscription.
CLI example::
salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1 | [
"Returns",
"all",
"of",
"the",
"properties",
"of",
"a",
"subscription",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L266-L285 |
35,111 | saltstack/salt | salt/utils/win_update.py | needs_reboot | def needs_reboot():
'''
Determines if the system needs to be rebooted.
Returns:
bool: True if the system requires a reboot, False if not
CLI Examples:
.. code-block:: bash
import salt.utils.win_update
salt.utils.win_update.needs_reboot()
'''
# Initialize the Py... | python | def needs_reboot():
'''
Determines if the system needs to be rebooted.
Returns:
bool: True if the system requires a reboot, False if not
CLI Examples:
.. code-block:: bash
import salt.utils.win_update
salt.utils.win_update.needs_reboot()
'''
# Initialize the Py... | [
"def",
"needs_reboot",
"(",
")",
":",
"# Initialize the PyCom system",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"# Create an AutoUpdate object",
"obj_sys",
"=",
"win32com",
".",
"client",
".",
"Dispatch",
"(",
"'Microsoft.Update.Syst... | Determines if the system needs to be rebooted.
Returns:
bool: True if the system requires a reboot, False if not
CLI Examples:
.. code-block:: bash
import salt.utils.win_update
salt.utils.win_update.needs_reboot() | [
"Determines",
"if",
"the",
"system",
"needs",
"to",
"be",
"rebooted",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L998-L1019 |
35,112 | saltstack/salt | salt/utils/win_update.py | Updates.list | def list(self):
'''
Create a dictionary with the details for the updates in the collection.
Returns:
dict: Details about each update
.. code-block:: cfg
List of Updates:
{'<GUID>': {'Title': <title>,
'KB': <KB>,
... | python | def list(self):
'''
Create a dictionary with the details for the updates in the collection.
Returns:
dict: Details about each update
.. code-block:: cfg
List of Updates:
{'<GUID>': {'Title': <title>,
'KB': <KB>,
... | [
"def",
"list",
"(",
"self",
")",
":",
"# https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx",
"if",
"self",
".",
"count",
"(",
")",
"==",
"0",
":",
"return",
"'Nothing to return'",
"log",
".",
"debug",
"(",
"'Building a detailed report of the ... | Create a dictionary with the details for the updates in the collection.
Returns:
dict: Details about each update
.. code-block:: cfg
List of Updates:
{'<GUID>': {'Title': <title>,
'KB': <KB>,
'GUID': <the globally uni... | [
"Create",
"a",
"dictionary",
"with",
"the",
"details",
"for",
"the",
"updates",
"in",
"the",
"collection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L101-L167 |
35,113 | saltstack/salt | salt/utils/win_update.py | Updates.summary | def summary(self):
'''
Create a dictionary with a summary of the updates in the collection.
Returns:
dict: Summary of the contents of the collection
.. code-block:: cfg
Summary of Updates:
{'Total': <total number of updates returned>,
'... | python | def summary(self):
'''
Create a dictionary with a summary of the updates in the collection.
Returns:
dict: Summary of the contents of the collection
.. code-block:: cfg
Summary of Updates:
{'Total': <total number of updates returned>,
'... | [
"def",
"summary",
"(",
"self",
")",
":",
"# https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx",
"if",
"self",
".",
"count",
"(",
")",
"==",
"0",
":",
"return",
"'Nothing to return'",
"# Build a dictionary containing a summary of updates available",
... | Create a dictionary with a summary of the updates in the collection.
Returns:
dict: Summary of the contents of the collection
.. code-block:: cfg
Summary of Updates:
{'Total': <total number of updates returned>,
'Available': <updates that are not downl... | [
"Create",
"a",
"dictionary",
"with",
"a",
"summary",
"of",
"the",
"updates",
"in",
"the",
"collection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L169-L242 |
35,114 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent.refresh | def refresh(self):
'''
Refresh the contents of the ``_updates`` collection. This gets all
updates in the Windows Update system and loads them into the collection.
This is the part that is slow.
Code Example:
.. code-block:: python
import salt.utils.win_upda... | python | def refresh(self):
'''
Refresh the contents of the ``_updates`` collection. This gets all
updates in the Windows Update system and loads them into the collection.
This is the part that is slow.
Code Example:
.. code-block:: python
import salt.utils.win_upda... | [
"def",
"refresh",
"(",
"self",
")",
":",
"# https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx",
"search_string",
"=",
"'Type=\\'Software\\' or '",
"'Type=\\'Driver\\''",
"# Create searcher object",
"searcher",
"=",
"self",
".",
"_session",
".",
"Crea... | Refresh the contents of the ``_updates`` collection. This gets all
updates in the Windows Update system and loads them into the collection.
This is the part that is slow.
Code Example:
.. code-block:: python
import salt.utils.win_update
wua = salt.utils.win_upd... | [
"Refresh",
"the",
"contents",
"of",
"the",
"_updates",
"collection",
".",
"This",
"gets",
"all",
"updates",
"in",
"the",
"Windows",
"Update",
"system",
"and",
"loads",
"them",
"into",
"the",
"collection",
".",
"This",
"is",
"the",
"part",
"that",
"is",
"sl... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L327-L366 |
35,115 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent.available | def available(self,
skip_hidden=True,
skip_installed=True,
skip_mandatory=False,
skip_reboot=False,
software=True,
drivers=True,
categories=None,
severities=None):
'''
... | python | def available(self,
skip_hidden=True,
skip_installed=True,
skip_mandatory=False,
skip_reboot=False,
software=True,
drivers=True,
categories=None,
severities=None):
'''
... | [
"def",
"available",
"(",
"self",
",",
"skip_hidden",
"=",
"True",
",",
"skip_installed",
"=",
"True",
",",
"skip_mandatory",
"=",
"False",
",",
"skip_reboot",
"=",
"False",
",",
"software",
"=",
"True",
",",
"drivers",
"=",
"True",
",",
"categories",
"=",
... | Gets a list of all updates available on the system that match the passed
criteria.
Args:
skip_hidden (bool): Skip hidden updates. Default is True
skip_installed (bool): Skip installed updates. Default is True
skip_mandatory (bool): Skip mandatory updates. Default ... | [
"Gets",
"a",
"list",
"of",
"all",
"updates",
"available",
"on",
"the",
"system",
"that",
"match",
"the",
"passed",
"criteria",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L368-L484 |
35,116 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent.search | def search(self, search_string):
'''
Search for either a single update or a specific list of updates. GUIDs
are searched first, then KB numbers, and finally Titles.
Args:
search_string (str, list): The search string to use to find the
update. This can be the GUI... | python | def search(self, search_string):
'''
Search for either a single update or a specific list of updates. GUIDs
are searched first, then KB numbers, and finally Titles.
Args:
search_string (str, list): The search string to use to find the
update. This can be the GUI... | [
"def",
"search",
"(",
"self",
",",
"search_string",
")",
":",
"updates",
"=",
"Updates",
"(",
")",
"found",
"=",
"updates",
".",
"updates",
"if",
"isinstance",
"(",
"search_string",
",",
"six",
".",
"string_types",
")",
":",
"search_string",
"=",
"[",
"s... | Search for either a single update or a specific list of updates. GUIDs
are searched first, then KB numbers, and finally Titles.
Args:
search_string (str, list): The search string to use to find the
update. This can be the GUID or KB of the update (preferred). It can
... | [
"Search",
"for",
"either",
"a",
"single",
"update",
"or",
"a",
"specific",
"list",
"of",
"updates",
".",
"GUIDs",
"are",
"searched",
"first",
"then",
"KB",
"numbers",
"and",
"finally",
"Titles",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L486-L550 |
35,117 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent.download | def download(self, updates):
'''
Download the updates passed in the updates collection. Load the updates
collection using ``search`` or ``available``
Args:
updates (Updates): An instance of the Updates class containing a
the updates to be downloaded.
Re... | python | def download(self, updates):
'''
Download the updates passed in the updates collection. Load the updates
collection using ``search`` or ``available``
Args:
updates (Updates): An instance of the Updates class containing a
the updates to be downloaded.
Re... | [
"def",
"download",
"(",
"self",
",",
"updates",
")",
":",
"# Check for empty list",
"if",
"updates",
".",
"count",
"(",
")",
"==",
"0",
":",
"ret",
"=",
"{",
"'Success'",
":",
"False",
",",
"'Updates'",
":",
"'Nothing to download'",
"}",
"return",
"ret",
... | Download the updates passed in the updates collection. Load the updates
collection using ``search`` or ``available``
Args:
updates (Updates): An instance of the Updates class containing a
the updates to be downloaded.
Returns:
dict: A dictionary containing ... | [
"Download",
"the",
"updates",
"passed",
"in",
"the",
"updates",
"collection",
".",
"Load",
"the",
"updates",
"collection",
"using",
"search",
"or",
"available"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L552-L662 |
35,118 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent.install | def install(self, updates):
'''
Install the updates passed in the updates collection. Load the updates
collection using the ``search`` or ``available`` functions. If the
updates need to be downloaded, use the ``download`` function.
Args:
updates (Updates): An instan... | python | def install(self, updates):
'''
Install the updates passed in the updates collection. Load the updates
collection using the ``search`` or ``available`` functions. If the
updates need to be downloaded, use the ``download`` function.
Args:
updates (Updates): An instan... | [
"def",
"install",
"(",
"self",
",",
"updates",
")",
":",
"# Check for empty list",
"if",
"updates",
".",
"count",
"(",
")",
"==",
"0",
":",
"ret",
"=",
"{",
"'Success'",
":",
"False",
",",
"'Updates'",
":",
"'Nothing to install'",
"}",
"return",
"ret",
"... | Install the updates passed in the updates collection. Load the updates
collection using the ``search`` or ``available`` functions. If the
updates need to be downloaded, use the ``download`` function.
Args:
updates (Updates): An instance of the Updates class containing a
... | [
"Install",
"the",
"updates",
"passed",
"in",
"the",
"updates",
"collection",
".",
"Load",
"the",
"updates",
"collection",
"using",
"the",
"search",
"or",
"available",
"functions",
".",
"If",
"the",
"updates",
"need",
"to",
"be",
"downloaded",
"use",
"the",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L664-L773 |
35,119 | saltstack/salt | salt/utils/win_update.py | WindowsUpdateAgent._run | def _run(self, cmd):
'''
Internal function for running commands. Used by the uninstall function.
Args:
cmd (str, list): The command to run
Returns:
str: The stdout of the command
'''
if isinstance(cmd, six.string_types):
cmd = salt.u... | python | def _run(self, cmd):
'''
Internal function for running commands. Used by the uninstall function.
Args:
cmd (str, list): The command to run
Returns:
str: The stdout of the command
'''
if isinstance(cmd, six.string_types):
cmd = salt.u... | [
"def",
"_run",
"(",
"self",
",",
"cmd",
")",
":",
"if",
"isinstance",
"(",
"cmd",
",",
"six",
".",
"string_types",
")",
":",
"cmd",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"shlex_split",
"(",
"cmd",
")",
"try",
":",
"log",
".",
"debug",
"(",... | Internal function for running commands. Used by the uninstall function.
Args:
cmd (str, list): The command to run
Returns:
str: The stdout of the command | [
"Internal",
"function",
"for",
"running",
"commands",
".",
"Used",
"by",
"the",
"uninstall",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_update.py#L969-L995 |
35,120 | saltstack/salt | salt/renderers/yaml.py | render | def render(yaml_data, saltenv='base', sls='', argline='', **kws):
'''
Accepts YAML as a string or as a file object and runs it through the YAML
parser.
:rtype: A Python data structure
'''
if not isinstance(yaml_data, string_types):
yaml_data = yaml_data.read()
with warnings.catch_wa... | python | def render(yaml_data, saltenv='base', sls='', argline='', **kws):
'''
Accepts YAML as a string or as a file object and runs it through the YAML
parser.
:rtype: A Python data structure
'''
if not isinstance(yaml_data, string_types):
yaml_data = yaml_data.read()
with warnings.catch_wa... | [
"def",
"render",
"(",
"yaml_data",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"argline",
"=",
"''",
",",
"*",
"*",
"kws",
")",
":",
"if",
"not",
"isinstance",
"(",
"yaml_data",
",",
"string_types",
")",
":",
"yaml_data",
"=",
"yaml_da... | Accepts YAML as a string or as a file object and runs it through the YAML
parser.
:rtype: A Python data structure | [
"Accepts",
"YAML",
"as",
"a",
"string",
"or",
"as",
"a",
"file",
"object",
"and",
"runs",
"it",
"through",
"the",
"YAML",
"parser",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/yaml.py#L42-L88 |
35,121 | saltstack/salt | salt/modules/macdefaults.py | delete | def delete(domain, key, user=None):
'''
Delete a default from the system
CLI Example:
.. code-block:: bash
salt '*' macdefaults.delete com.apple.CrashReporter DialogType
salt '*' macdefaults.delete NSGlobalDomain ApplePersistence
domain
The name of the domain to delete f... | python | def delete(domain, key, user=None):
'''
Delete a default from the system
CLI Example:
.. code-block:: bash
salt '*' macdefaults.delete com.apple.CrashReporter DialogType
salt '*' macdefaults.delete NSGlobalDomain ApplePersistence
domain
The name of the domain to delete f... | [
"def",
"delete",
"(",
"domain",
",",
"key",
",",
"user",
"=",
"None",
")",
":",
"cmd",
"=",
"'defaults delete \"{0}\" \"{1}\"'",
".",
"format",
"(",
"domain",
",",
"key",
")",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"runas",
"="... | Delete a default from the system
CLI Example:
.. code-block:: bash
salt '*' macdefaults.delete com.apple.CrashReporter DialogType
salt '*' macdefaults.delete NSGlobalDomain ApplePersistence
domain
The name of the domain to delete from
key
The key of the given domain... | [
"Delete",
"a",
"default",
"from",
"the",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/macdefaults.py#L93-L116 |
35,122 | saltstack/salt | salt/states/win_system.py | computer_desc | def computer_desc(name):
'''
Manage the computer's description field
name
The desired computer description
'''
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {'name': name,
'changes': {},
'result': True,
... | python | def computer_desc(name):
'''
Manage the computer's description field
name
The desired computer description
'''
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {'name': name,
'changes': {},
'result': True,
... | [
"def",
"computer_desc",
"(",
"name",
")",
":",
"# Just in case someone decides to enter a numeric description",
"name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":... | Manage the computer's description field
name
The desired computer description | [
"Manage",
"the",
"computer",
"s",
"description",
"field"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_system.py#L47-L82 |
35,123 | saltstack/salt | salt/states/win_system.py | computer_name | def computer_name(name):
'''
Manage the computer's name
name
The desired computer name
'''
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Compu... | python | def computer_name(name):
'''
Manage the computer's name
name
The desired computer name
'''
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Compu... | [
"def",
"computer_name",
"(",
"name",
")",
":",
"# Just in case someone decides to enter a numeric description",
"name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":... | Manage the computer's name
name
The desired computer name | [
"Manage",
"the",
"computer",
"s",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_system.py#L88-L132 |
35,124 | saltstack/salt | salt/states/win_system.py | join_domain | def join_domain(name,
username=None,
password=None,
account_ou=None,
account_exists=False,
restart=False):
'''
Checks if a computer is joined to the Domain. If the computer is not in the
Domain, it will be joined.
Args:
... | python | def join_domain(name,
username=None,
password=None,
account_ou=None,
account_exists=False,
restart=False):
'''
Checks if a computer is joined to the Domain. If the computer is not in the
Domain, it will be joined.
Args:
... | [
"def",
"join_domain",
"(",
"name",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"account_ou",
"=",
"None",
",",
"account_exists",
"=",
"False",
",",
"restart",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"... | Checks if a computer is joined to the Domain. If the computer is not in the
Domain, it will be joined.
Args:
name (str):
The name of the Domain.
username (str):
Username of an account which is authorized to join computers to the
specified domain. Need to be... | [
"Checks",
"if",
"a",
"computer",
"is",
"joined",
"to",
"the",
"Domain",
".",
"If",
"the",
"computer",
"is",
"not",
"in",
"the",
"Domain",
"it",
"will",
"be",
"joined",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_system.py#L228-L315 |
35,125 | saltstack/salt | salt/states/win_system.py | reboot | def reboot(name, message=None, timeout=5, force_close=True, in_seconds=False,
only_on_pending_reboot=True):
'''
Reboot the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is... | python | def reboot(name, message=None, timeout=5, force_close=True, in_seconds=False,
only_on_pending_reboot=True):
'''
Reboot the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is... | [
"def",
"reboot",
"(",
"name",
",",
"message",
"=",
"None",
",",
"timeout",
"=",
"5",
",",
"force_close",
"=",
"True",
",",
"in_seconds",
"=",
"False",
",",
"only_on_pending_reboot",
"=",
"True",
")",
":",
"return",
"shutdown",
"(",
"name",
",",
"message"... | Reboot the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is None.
:param int timeout:
The number of minutes or seconds before a reboot will occur. Whether
this number re... | [
"Reboot",
"the",
"computer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_system.py#L318-L361 |
35,126 | saltstack/salt | salt/states/win_system.py | shutdown | def shutdown(name, message=None, timeout=5, force_close=True, reboot=False,
in_seconds=False, only_on_pending_reboot=False):
'''
Shutdown the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
... | python | def shutdown(name, message=None, timeout=5, force_close=True, reboot=False,
in_seconds=False, only_on_pending_reboot=False):
'''
Shutdown the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
... | [
"def",
"shutdown",
"(",
"name",
",",
"message",
"=",
"None",
",",
"timeout",
"=",
"5",
",",
"force_close",
"=",
"True",
",",
"reboot",
"=",
"False",
",",
"in_seconds",
"=",
"False",
",",
"only_on_pending_reboot",
"=",
"False",
")",
":",
"ret",
"=",
"{"... | Shutdown the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is None.
:param int timeout:
The number of minutes or seconds before a shutdown will occur. Whether
this numbe... | [
"Shutdown",
"the",
"computer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_system.py#L364-L449 |
35,127 | saltstack/salt | salt/modules/btrfs.py | _parse_btrfs_info | def _parse_btrfs_info(data):
'''
Parse BTRFS device info data.
'''
ret = {}
for line in [line for line in data.split("\n") if line][:-1]:
if line.startswith("Label:"):
line = re.sub(r"Label:\s+", "", line)
label, uuid_ = [tkn.strip() for tkn in line.split("uuid:")]
... | python | def _parse_btrfs_info(data):
'''
Parse BTRFS device info data.
'''
ret = {}
for line in [line for line in data.split("\n") if line][:-1]:
if line.startswith("Label:"):
line = re.sub(r"Label:\s+", "", line)
label, uuid_ = [tkn.strip() for tkn in line.split("uuid:")]
... | [
"def",
"_parse_btrfs_info",
"(",
"data",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"[",
"line",
"for",
"line",
"in",
"data",
".",
"split",
"(",
"\"\\n\"",
")",
"if",
"line",
"]",
"[",
":",
"-",
"1",
"]",
":",
"if",
"line",
".",
"star... | Parse BTRFS device info data. | [
"Parse",
"BTRFS",
"device",
"info",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L60-L82 |
35,128 | saltstack/salt | salt/modules/btrfs.py | info | def info(device):
'''
Get BTRFS filesystem information.
CLI Example:
.. code-block:: bash
salt '*' btrfs.info /dev/sda1
'''
out = __salt__['cmd.run_all']("btrfs filesystem show {0}".format(device))
salt.utils.fsutils._verify_run(out)
return _parse_btrfs_info(out['stdout']) | python | def info(device):
'''
Get BTRFS filesystem information.
CLI Example:
.. code-block:: bash
salt '*' btrfs.info /dev/sda1
'''
out = __salt__['cmd.run_all']("btrfs filesystem show {0}".format(device))
salt.utils.fsutils._verify_run(out)
return _parse_btrfs_info(out['stdout']) | [
"def",
"info",
"(",
"device",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"btrfs filesystem show {0}\"",
".",
"format",
"(",
"device",
")",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run",
"(",
"out",
")",
"return",
... | Get BTRFS filesystem information.
CLI Example:
.. code-block:: bash
salt '*' btrfs.info /dev/sda1 | [
"Get",
"BTRFS",
"filesystem",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L85-L98 |
35,129 | saltstack/salt | salt/modules/btrfs.py | devices | def devices():
'''
Get known BTRFS formatted devices on the system.
CLI Example:
.. code-block:: bash
salt '*' btrfs.devices
'''
out = __salt__['cmd.run_all']("blkid -o export")
salt.utils.fsutils._verify_run(out)
return salt.utils.fsutils._blkid_output(out['stdout'], fs_type... | python | def devices():
'''
Get known BTRFS formatted devices on the system.
CLI Example:
.. code-block:: bash
salt '*' btrfs.devices
'''
out = __salt__['cmd.run_all']("blkid -o export")
salt.utils.fsutils._verify_run(out)
return salt.utils.fsutils._blkid_output(out['stdout'], fs_type... | [
"def",
"devices",
"(",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"blkid -o export\"",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run",
"(",
"out",
")",
"return",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_blkid_o... | Get known BTRFS formatted devices on the system.
CLI Example:
.. code-block:: bash
salt '*' btrfs.devices | [
"Get",
"known",
"BTRFS",
"formatted",
"devices",
"on",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L101-L114 |
35,130 | saltstack/salt | salt/modules/btrfs.py | _defragment_mountpoint | def _defragment_mountpoint(mountpoint):
'''
Defragment only one BTRFS mountpoint.
'''
out = __salt__['cmd.run_all']("btrfs filesystem defragment -f {0}".format(mountpoint))
return {
'mount_point': mountpoint,
'passed': not out['stderr'],
'log': out['stderr'] or False,
... | python | def _defragment_mountpoint(mountpoint):
'''
Defragment only one BTRFS mountpoint.
'''
out = __salt__['cmd.run_all']("btrfs filesystem defragment -f {0}".format(mountpoint))
return {
'mount_point': mountpoint,
'passed': not out['stderr'],
'log': out['stderr'] or False,
... | [
"def",
"_defragment_mountpoint",
"(",
"mountpoint",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"btrfs filesystem defragment -f {0}\"",
".",
"format",
"(",
"mountpoint",
")",
")",
"return",
"{",
"'mount_point'",
":",
"mountpoint",
",",
"'pa... | Defragment only one BTRFS mountpoint. | [
"Defragment",
"only",
"one",
"BTRFS",
"mountpoint",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L117-L127 |
35,131 | saltstack/salt | salt/modules/btrfs.py | defragment | def defragment(path):
'''
Defragment mounted BTRFS filesystem.
In order to defragment a filesystem, device should be properly mounted and writable.
If passed a device name, then defragmented whole filesystem, mounted on in.
If passed a moun tpoint of the filesystem, then only this mount point is de... | python | def defragment(path):
'''
Defragment mounted BTRFS filesystem.
In order to defragment a filesystem, device should be properly mounted and writable.
If passed a device name, then defragmented whole filesystem, mounted on in.
If passed a moun tpoint of the filesystem, then only this mount point is de... | [
"def",
"defragment",
"(",
"path",
")",
":",
"is_device",
"=",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_is_device",
"(",
"path",
")",
"mounts",
"=",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_get_mounts",
"(",
"\"btrfs\"",
")",
"if",
"is_device",
... | Defragment mounted BTRFS filesystem.
In order to defragment a filesystem, device should be properly mounted and writable.
If passed a device name, then defragmented whole filesystem, mounted on in.
If passed a moun tpoint of the filesystem, then only this mount point is defragmented.
CLI Example:
... | [
"Defragment",
"mounted",
"BTRFS",
"filesystem",
".",
"In",
"order",
"to",
"defragment",
"a",
"filesystem",
"device",
"should",
"be",
"properly",
"mounted",
"and",
"writable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L130-L171 |
35,132 | saltstack/salt | salt/modules/btrfs.py | features | def features():
'''
List currently available BTRFS features.
CLI Example:
.. code-block:: bash
salt '*' btrfs.mkfs_features
'''
out = __salt__['cmd.run_all']("mkfs.btrfs -O list-all")
salt.utils.fsutils._verify_run(out)
ret = {}
for line in [re.sub(r"\s+", " ", line) for ... | python | def features():
'''
List currently available BTRFS features.
CLI Example:
.. code-block:: bash
salt '*' btrfs.mkfs_features
'''
out = __salt__['cmd.run_all']("mkfs.btrfs -O list-all")
salt.utils.fsutils._verify_run(out)
ret = {}
for line in [re.sub(r"\s+", " ", line) for ... | [
"def",
"features",
"(",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"mkfs.btrfs -O list-all\"",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run",
"(",
"out",
")",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"[",
"re"... | List currently available BTRFS features.
CLI Example:
.. code-block:: bash
salt '*' btrfs.mkfs_features | [
"List",
"currently",
"available",
"BTRFS",
"features",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L174-L192 |
35,133 | saltstack/salt | salt/modules/btrfs.py | usage | def usage(path):
'''
Show in which disk the chunks are allocated.
CLI Example:
.. code-block:: bash
salt '*' btrfs.usage /your/mountpoint
'''
out = __salt__['cmd.run_all']("btrfs filesystem usage {0}".format(path))
salt.utils.fsutils._verify_run(out)
ret = {}
for section ... | python | def usage(path):
'''
Show in which disk the chunks are allocated.
CLI Example:
.. code-block:: bash
salt '*' btrfs.usage /your/mountpoint
'''
out = __salt__['cmd.run_all']("btrfs filesystem usage {0}".format(path))
salt.utils.fsutils._verify_run(out)
ret = {}
for section ... | [
"def",
"usage",
"(",
"path",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"btrfs filesystem usage {0}\"",
".",
"format",
"(",
"path",
")",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run",
"(",
"out",
")",
"ret",
"=",
... | Show in which disk the chunks are allocated.
CLI Example:
.. code-block:: bash
salt '*' btrfs.usage /your/mountpoint | [
"Show",
"in",
"which",
"disk",
"the",
"chunks",
"are",
"allocated",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L249-L271 |
35,134 | saltstack/salt | salt/modules/btrfs.py | resize | def resize(mountpoint, size):
'''
Resize filesystem.
General options:
* **mountpoint**: Specify the BTRFS mountpoint to resize.
* **size**: ([+/-]<newsize>[kKmMgGtTpPeE]|max) Specify the new size of the target.
CLI Example:
.. code-block:: bash
salt '*' btrfs.resize /mountpoint ... | python | def resize(mountpoint, size):
'''
Resize filesystem.
General options:
* **mountpoint**: Specify the BTRFS mountpoint to resize.
* **size**: ([+/-]<newsize>[kKmMgGtTpPeE]|max) Specify the new size of the target.
CLI Example:
.. code-block:: bash
salt '*' btrfs.resize /mountpoint ... | [
"def",
"resize",
"(",
"mountpoint",
",",
"size",
")",
":",
"if",
"size",
"==",
"'max'",
":",
"if",
"not",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_is_device",
"(",
"mountpoint",
")",
":",
"raise",
"CommandExecutionError",
"(",
"\"Mountpoint \\\"{0}\\\" s... | Resize filesystem.
General options:
* **mountpoint**: Specify the BTRFS mountpoint to resize.
* **size**: ([+/-]<newsize>[kKmMgGtTpPeE]|max) Specify the new size of the target.
CLI Example:
.. code-block:: bash
salt '*' btrfs.resize /mountpoint size=+1g
salt '*' btrfs.resize /de... | [
"Resize",
"filesystem",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L357-L389 |
35,135 | saltstack/salt | salt/modules/btrfs.py | _parse_proplist | def _parse_proplist(data):
'''
Parse properties list.
'''
out = {}
for line in data.split("\n"):
line = re.split(r"\s+", line, 1)
if len(line) == 2:
out[line[0]] = line[1]
return out | python | def _parse_proplist(data):
'''
Parse properties list.
'''
out = {}
for line in data.split("\n"):
line = re.split(r"\s+", line, 1)
if len(line) == 2:
out[line[0]] = line[1]
return out | [
"def",
"_parse_proplist",
"(",
"data",
")",
":",
"out",
"=",
"{",
"}",
"for",
"line",
"in",
"data",
".",
"split",
"(",
"\"\\n\"",
")",
":",
"line",
"=",
"re",
".",
"split",
"(",
"r\"\\s+\"",
",",
"line",
",",
"1",
")",
"if",
"len",
"(",
"line",
... | Parse properties list. | [
"Parse",
"properties",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L614-L624 |
35,136 | saltstack/salt | salt/modules/btrfs.py | subvolume_create | def subvolume_create(name, dest=None, qgroupids=None):
'''
Create subvolume `name` in `dest`.
Return True if the subvolume is created, False is the subvolume is
already there.
name
Name of the new subvolume
dest
If not given, the subvolume will be created in the current
... | python | def subvolume_create(name, dest=None, qgroupids=None):
'''
Create subvolume `name` in `dest`.
Return True if the subvolume is created, False is the subvolume is
already there.
name
Name of the new subvolume
dest
If not given, the subvolume will be created in the current
... | [
"def",
"subvolume_create",
"(",
"name",
",",
"dest",
"=",
"None",
",",
"qgroupids",
"=",
"None",
")",
":",
"if",
"qgroupids",
"and",
"type",
"(",
"qgroupids",
")",
"is",
"not",
"list",
":",
"raise",
"CommandExecutionError",
"(",
"'Qgroupids parameter must be a... | Create subvolume `name` in `dest`.
Return True if the subvolume is created, False is the subvolume is
already there.
name
Name of the new subvolume
dest
If not given, the subvolume will be created in the current
directory, if given will be in /dest/name
qgroupids
... | [
"Create",
"subvolume",
"name",
"in",
"dest",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L696-L741 |
35,137 | saltstack/salt | salt/modules/btrfs.py | subvolume_find_new | def subvolume_find_new(name, last_gen):
'''
List the recently modified files in a subvolume
name
Name of the subvolume
last_gen
Last transid marker from where to compare
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024
''... | python | def subvolume_find_new(name, last_gen):
'''
List the recently modified files in a subvolume
name
Name of the subvolume
last_gen
Last transid marker from where to compare
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024
''... | [
"def",
"subvolume_find_new",
"(",
"name",
",",
"last_gen",
")",
":",
"cmd",
"=",
"[",
"'btrfs'",
",",
"'subvolume'",
",",
"'find-new'",
",",
"name",
",",
"last_gen",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"salt",
".",
... | List the recently modified files in a subvolume
name
Name of the subvolume
last_gen
Last transid marker from where to compare
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024 | [
"List",
"the",
"recently",
"modified",
"files",
"in",
"a",
"subvolume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L802-L832 |
35,138 | saltstack/salt | salt/modules/btrfs.py | subvolume_get_default | def subvolume_get_default(path):
'''
Get the default subvolume of the filesystem path
path
Mount point for the subvolume
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_get_default /var/volumes/tmp
'''
cmd = ['btrfs', 'subvolume', 'get-default', path]
res... | python | def subvolume_get_default(path):
'''
Get the default subvolume of the filesystem path
path
Mount point for the subvolume
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_get_default /var/volumes/tmp
'''
cmd = ['btrfs', 'subvolume', 'get-default', path]
res... | [
"def",
"subvolume_get_default",
"(",
"path",
")",
":",
"cmd",
"=",
"[",
"'btrfs'",
",",
"'subvolume'",
",",
"'get-default'",
",",
"path",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
... | Get the default subvolume of the filesystem path
path
Mount point for the subvolume
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_get_default /var/volumes/tmp | [
"Get",
"the",
"default",
"subvolume",
"of",
"the",
"filesystem",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L835-L869 |
35,139 | saltstack/salt | salt/modules/btrfs.py | _pop | def _pop(line, key, use_rest):
'''
Helper for the line parser.
If key is a prefix of line, will remove ir from the line and will
extract the value (space separation), and the rest of the line.
If use_rest is True, the value will be the rest of the line.
Return a tuple with the value and the r... | python | def _pop(line, key, use_rest):
'''
Helper for the line parser.
If key is a prefix of line, will remove ir from the line and will
extract the value (space separation), and the rest of the line.
If use_rest is True, the value will be the rest of the line.
Return a tuple with the value and the r... | [
"def",
"_pop",
"(",
"line",
",",
"key",
",",
"use_rest",
")",
":",
"value",
"=",
"None",
"if",
"line",
".",
"startswith",
"(",
"key",
")",
":",
"line",
"=",
"line",
"[",
"len",
"(",
"key",
")",
":",
"]",
".",
"strip",
"(",
")",
"if",
"use_rest"... | Helper for the line parser.
If key is a prefix of line, will remove ir from the line and will
extract the value (space separation), and the rest of the line.
If use_rest is True, the value will be the rest of the line.
Return a tuple with the value and the rest of the line. | [
"Helper",
"for",
"the",
"line",
"parser",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L872-L891 |
35,140 | saltstack/salt | salt/modules/btrfs.py | subvolume_list | def subvolume_list(path, parent_id=False, absolute=False,
ogeneration=False, generation=False,
subvolumes=False, uuid=False, parent_uuid=False,
sent_subvolume_uuid=False, snapshots=False,
readonly=False, deleted=False, generation_cmp=None,
... | python | def subvolume_list(path, parent_id=False, absolute=False,
ogeneration=False, generation=False,
subvolumes=False, uuid=False, parent_uuid=False,
sent_subvolume_uuid=False, snapshots=False,
readonly=False, deleted=False, generation_cmp=None,
... | [
"def",
"subvolume_list",
"(",
"path",
",",
"parent_id",
"=",
"False",
",",
"absolute",
"=",
"False",
",",
"ogeneration",
"=",
"False",
",",
"generation",
"=",
"False",
",",
"subvolumes",
"=",
"False",
",",
"uuid",
"=",
"False",
",",
"parent_uuid",
"=",
"... | List the subvolumes present in the filesystem.
path
Mount point for the subvolume
parent_id
Print parent ID
absolute
Print all the subvolumes in the filesystem and distinguish
between absolute and relative path with respect to the given
<path>
ogeneration
... | [
"List",
"the",
"subvolumes",
"present",
"in",
"the",
"filesystem",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L894-L1031 |
35,141 | saltstack/salt | salt/modules/btrfs.py | subvolume_set_default | def subvolume_set_default(subvolid, path):
'''
Set the subvolume as default
subvolid
ID of the new default subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_set_default 257 /var/volumes/tmp
'''
cmd = ['b... | python | def subvolume_set_default(subvolid, path):
'''
Set the subvolume as default
subvolid
ID of the new default subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_set_default 257 /var/volumes/tmp
'''
cmd = ['b... | [
"def",
"subvolume_set_default",
"(",
"subvolid",
",",
"path",
")",
":",
"cmd",
"=",
"[",
"'btrfs'",
",",
"'subvolume'",
",",
"'set-default'",
",",
"subvolid",
",",
"path",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"salt",
"... | Set the subvolume as default
subvolid
ID of the new default subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_set_default 257 /var/volumes/tmp | [
"Set",
"the",
"subvolume",
"as",
"default"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L1034-L1055 |
35,142 | saltstack/salt | salt/modules/btrfs.py | subvolume_show | def subvolume_show(path):
'''
Show information of a given subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_show /var/volumes/tmp
'''
cmd = ['btrfs', 'subvolume', 'show', path]
res = __salt__['cmd.run_all'](cmd)... | python | def subvolume_show(path):
'''
Show information of a given subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_show /var/volumes/tmp
'''
cmd = ['btrfs', 'subvolume', 'show', path]
res = __salt__['cmd.run_all'](cmd)... | [
"def",
"subvolume_show",
"(",
"path",
")",
":",
"cmd",
"=",
"[",
"'btrfs'",
",",
"'subvolume'",
",",
"'show'",
",",
"path",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_verify_run... | Show information of a given subvolume
path
Mount point for the filesystem
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_show /var/volumes/tmp | [
"Show",
"information",
"of",
"a",
"given",
"subvolume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L1058-L1088 |
35,143 | saltstack/salt | salt/modules/btrfs.py | subvolume_snapshot | def subvolume_snapshot(source, dest=None, name=None, read_only=False):
'''
Create a snapshot of a source subvolume
source
Source subvolume from where to create the snapshot
dest
If only dest is given, the subvolume will be named as the
basename of the source
name
Na... | python | def subvolume_snapshot(source, dest=None, name=None, read_only=False):
'''
Create a snapshot of a source subvolume
source
Source subvolume from where to create the snapshot
dest
If only dest is given, the subvolume will be named as the
basename of the source
name
Na... | [
"def",
"subvolume_snapshot",
"(",
"source",
",",
"dest",
"=",
"None",
",",
"name",
"=",
"None",
",",
"read_only",
"=",
"False",
")",
":",
"if",
"not",
"dest",
"and",
"not",
"name",
":",
"raise",
"CommandExecutionError",
"(",
"'Provide parameter dest, name, or ... | Create a snapshot of a source subvolume
source
Source subvolume from where to create the snapshot
dest
If only dest is given, the subvolume will be named as the
basename of the source
name
Name of the snapshot
read_only
Create a read only snapshot
CLI Exam... | [
"Create",
"a",
"snapshot",
"of",
"a",
"source",
"subvolume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L1091-L1131 |
35,144 | saltstack/salt | salt/modules/btrfs.py | subvolume_sync | def subvolume_sync(path, subvolids=None, sleep=None):
'''
Wait until given subvolume are completely removed from the
filesystem after deletion.
path
Mount point for the filesystem
subvolids
List of IDs of subvolumes to wait for
sleep
Sleep N seconds betwenn checks (def... | python | def subvolume_sync(path, subvolids=None, sleep=None):
'''
Wait until given subvolume are completely removed from the
filesystem after deletion.
path
Mount point for the filesystem
subvolids
List of IDs of subvolumes to wait for
sleep
Sleep N seconds betwenn checks (def... | [
"def",
"subvolume_sync",
"(",
"path",
",",
"subvolids",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"if",
"subvolids",
"and",
"type",
"(",
"subvolids",
")",
"is",
"not",
"list",
":",
"raise",
"CommandExecutionError",
"(",
"'Subvolids parameter must be a ... | Wait until given subvolume are completely removed from the
filesystem after deletion.
path
Mount point for the filesystem
subvolids
List of IDs of subvolumes to wait for
sleep
Sleep N seconds betwenn checks (default: 1)
CLI Example:
.. code-block:: bash
salt... | [
"Wait",
"until",
"given",
"subvolume",
"are",
"completely",
"removed",
"from",
"the",
"filesystem",
"after",
"deletion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L1134-L1169 |
35,145 | saltstack/salt | salt/modules/win_useradd.py | add | def add(name,
password=None,
fullname=None,
description=None,
groups=None,
home=None,
homedrive=None,
profile=None,
logonscript=None):
'''
Add a user to the minion.
Args:
name (str): User name
password (str, optional): User's ... | python | def add(name,
password=None,
fullname=None,
description=None,
groups=None,
home=None,
homedrive=None,
profile=None,
logonscript=None):
'''
Add a user to the minion.
Args:
name (str): User name
password (str, optional): User's ... | [
"def",
"add",
"(",
"name",
",",
"password",
"=",
"None",
",",
"fullname",
"=",
"None",
",",
"description",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"home",
"=",
"None",
",",
"homedrive",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"logonscrip... | Add a user to the minion.
Args:
name (str): User name
password (str, optional): User's password in plain text.
fullname (str, optional): The user's full name.
description (str, optional): A brief description of the user account.
groups (str, optional): A list of groups t... | [
"Add",
"a",
"user",
"to",
"the",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L99-L182 |
35,146 | saltstack/salt | salt/modules/win_useradd.py | update | def update(name,
password=None,
fullname=None,
description=None,
home=None,
homedrive=None,
logonscript=None,
profile=None,
expiration_date=None,
expired=None,
account_disabled=None,
unlock_account=N... | python | def update(name,
password=None,
fullname=None,
description=None,
home=None,
homedrive=None,
logonscript=None,
profile=None,
expiration_date=None,
expired=None,
account_disabled=None,
unlock_account=N... | [
"def",
"update",
"(",
"name",
",",
"password",
"=",
"None",
",",
"fullname",
"=",
"None",
",",
"description",
"=",
"None",
",",
"home",
"=",
"None",
",",
"homedrive",
"=",
"None",
",",
"logonscript",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"ex... | Updates settings for the windows user. Name is the only required parameter.
Settings will only be changed if the parameter is passed a value.
.. versionadded:: 2015.8.0
Args:
name (str): The user name to update.
password (str, optional): New user password in plain text.
fullname ... | [
"Updates",
"settings",
"for",
"the",
"windows",
"user",
".",
"Name",
"is",
"the",
"only",
"required",
"parameter",
".",
"Settings",
"will",
"only",
"be",
"changed",
"if",
"the",
"parameter",
"is",
"passed",
"a",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L185-L337 |
35,147 | saltstack/salt | salt/modules/win_useradd.py | getUserSid | def getUserSid(username):
'''
Get the Security ID for the user
Args:
username (str): The user name for which to look up the SID
Returns:
str: The user SID
CLI Example:
.. code-block:: bash
salt '*' user.getUserSid jsnuffy
'''
if six.PY2:
username = _t... | python | def getUserSid(username):
'''
Get the Security ID for the user
Args:
username (str): The user name for which to look up the SID
Returns:
str: The user SID
CLI Example:
.. code-block:: bash
salt '*' user.getUserSid jsnuffy
'''
if six.PY2:
username = _t... | [
"def",
"getUserSid",
"(",
"username",
")",
":",
"if",
"six",
".",
"PY2",
":",
"username",
"=",
"_to_unicode",
"(",
"username",
")",
"domain",
"=",
"win32api",
".",
"GetComputerName",
"(",
")",
"if",
"username",
".",
"find",
"(",
"'\\\\'",
")",
"!=",
"-... | Get the Security ID for the user
Args:
username (str): The user name for which to look up the SID
Returns:
str: The user SID
CLI Example:
.. code-block:: bash
salt '*' user.getUserSid jsnuffy | [
"Get",
"the",
"Security",
"ID",
"for",
"the",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L442-L467 |
35,148 | saltstack/salt | salt/modules/win_useradd.py | chgroups | def chgroups(name, groups, append=True):
'''
Change the groups this user belongs to, add append=False to make the user a
member of only the specified groups
Args:
name (str): The user name for which to change groups
groups (str, list): A single group or a list of groups to assign to th... | python | def chgroups(name, groups, append=True):
'''
Change the groups this user belongs to, add append=False to make the user a
member of only the specified groups
Args:
name (str): The user name for which to change groups
groups (str, list): A single group or a list of groups to assign to th... | [
"def",
"chgroups",
"(",
"name",
",",
"groups",
",",
"append",
"=",
"True",
")",
":",
"if",
"six",
".",
"PY2",
":",
"name",
"=",
"_to_unicode",
"(",
"name",
")",
"if",
"isinstance",
"(",
"groups",
",",
"string_types",
")",
":",
"groups",
"=",
"groups"... | Change the groups this user belongs to, add append=False to make the user a
member of only the specified groups
Args:
name (str): The user name for which to change groups
groups (str, list): A single group or a list of groups to assign to the
user. For multiple groups this can be a... | [
"Change",
"the",
"groups",
"this",
"user",
"belongs",
"to",
"add",
"append",
"=",
"False",
"to",
"make",
"the",
"user",
"a",
"member",
"of",
"only",
"the",
"specified",
"groups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L657-L716 |
35,149 | saltstack/salt | salt/modules/win_useradd.py | _get_userprofile_from_registry | def _get_userprofile_from_registry(user, sid):
'''
In case net user doesn't return the userprofile we can get it from the
registry
Args:
user (str): The user name, used in debug message
sid (str): The sid to lookup in the registry
Returns:
str: Profile directory
'''
... | python | def _get_userprofile_from_registry(user, sid):
'''
In case net user doesn't return the userprofile we can get it from the
registry
Args:
user (str): The user name, used in debug message
sid (str): The sid to lookup in the registry
Returns:
str: Profile directory
'''
... | [
"def",
"_get_userprofile_from_registry",
"(",
"user",
",",
"sid",
")",
":",
"profile_dir",
"=",
"__utils__",
"[",
"'reg.read_value'",
"]",
"(",
"'HKEY_LOCAL_MACHINE'",
",",
"'SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\ProfileList\\\\{0}'",
".",
"format",
"(",
... | In case net user doesn't return the userprofile we can get it from the
registry
Args:
user (str): The user name, used in debug message
sid (str): The sid to lookup in the registry
Returns:
str: Profile directory | [
"In",
"case",
"net",
"user",
"doesn",
"t",
"return",
"the",
"userprofile",
"we",
"can",
"get",
"it",
"from",
"the",
"registry"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L828-L850 |
35,150 | saltstack/salt | salt/modules/win_useradd.py | list_groups | def list_groups(name):
'''
Return a list of groups the named user belongs to
Args:
name (str): The user name for which to list groups
Returns:
list: A list of groups to which the user belongs
CLI Example:
.. code-block:: bash
salt '*' user.list_groups foo
'''
... | python | def list_groups(name):
'''
Return a list of groups the named user belongs to
Args:
name (str): The user name for which to list groups
Returns:
list: A list of groups to which the user belongs
CLI Example:
.. code-block:: bash
salt '*' user.list_groups foo
'''
... | [
"def",
"list_groups",
"(",
"name",
")",
":",
"if",
"six",
".",
"PY2",
":",
"name",
"=",
"_to_unicode",
"(",
"name",
")",
"ugrp",
"=",
"set",
"(",
")",
"try",
":",
"user",
"=",
"info",
"(",
"name",
")",
"[",
"'groups'",
"]",
"except",
"KeyError",
... | Return a list of groups the named user belongs to
Args:
name (str): The user name for which to list groups
Returns:
list: A list of groups to which the user belongs
CLI Example:
.. code-block:: bash
salt '*' user.list_groups foo | [
"Return",
"a",
"list",
"of",
"groups",
"the",
"named",
"user",
"belongs",
"to"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L853-L880 |
35,151 | saltstack/salt | salt/modules/win_useradd.py | list_users | def list_users():
'''
Return a list of all users on Windows
Returns:
list: A list of all users on the system
CLI Example:
.. code-block:: bash
salt '*' user.list_users
'''
res = 0
user_list = []
dowhile = True
try:
while res or dowhile:
dow... | python | def list_users():
'''
Return a list of all users on Windows
Returns:
list: A list of all users on the system
CLI Example:
.. code-block:: bash
salt '*' user.list_users
'''
res = 0
user_list = []
dowhile = True
try:
while res or dowhile:
dow... | [
"def",
"list_users",
"(",
")",
":",
"res",
"=",
"0",
"user_list",
"=",
"[",
"]",
"dowhile",
"=",
"True",
"try",
":",
"while",
"res",
"or",
"dowhile",
":",
"dowhile",
"=",
"False",
"(",
"users",
",",
"_",
",",
"res",
")",
"=",
"win32net",
".",
"Ne... | Return a list of all users on Windows
Returns:
list: A list of all users on the system
CLI Example:
.. code-block:: bash
salt '*' user.list_users | [
"Return",
"a",
"list",
"of",
"all",
"users",
"on",
"Windows"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L922-L952 |
35,152 | saltstack/salt | salt/modules/win_useradd.py | current | def current(sam=False):
'''
Get the username that salt-minion is running under. If salt-minion is
running as a service it should return the Local System account. If salt is
running from a command prompt it should return the username that started the
command prompt.
.. versionadded:: 2015.5.6
... | python | def current(sam=False):
'''
Get the username that salt-minion is running under. If salt-minion is
running as a service it should return the Local System account. If salt is
running from a command prompt it should return the username that started the
command prompt.
.. versionadded:: 2015.5.6
... | [
"def",
"current",
"(",
"sam",
"=",
"False",
")",
":",
"try",
":",
"if",
"sam",
":",
"user_name",
"=",
"win32api",
".",
"GetUserNameEx",
"(",
"win32con",
".",
"NameSamCompatible",
")",
"else",
":",
"user_name",
"=",
"win32api",
".",
"GetUserName",
"(",
")... | Get the username that salt-minion is running under. If salt-minion is
running as a service it should return the Local System account. If salt is
running from a command prompt it should return the username that started the
command prompt.
.. versionadded:: 2015.5.6
Args:
sam (bool, optional... | [
"Get",
"the",
"username",
"that",
"salt",
"-",
"minion",
"is",
"running",
"under",
".",
"If",
"salt",
"-",
"minion",
"is",
"running",
"as",
"a",
"service",
"it",
"should",
"return",
"the",
"Local",
"System",
"account",
".",
"If",
"salt",
"is",
"running",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_useradd.py#L1025-L1063 |
35,153 | saltstack/salt | salt/utils/validate/net.py | netmask | def netmask(mask):
'''
Returns True if the value passed is a valid netmask, otherwise return False
'''
if not isinstance(mask, string_types):
return False
octets = mask.split('.')
if not len(octets) == 4:
return False
return ipv4_addr(mask) and octets == sorted(octets, reve... | python | def netmask(mask):
'''
Returns True if the value passed is a valid netmask, otherwise return False
'''
if not isinstance(mask, string_types):
return False
octets = mask.split('.')
if not len(octets) == 4:
return False
return ipv4_addr(mask) and octets == sorted(octets, reve... | [
"def",
"netmask",
"(",
"mask",
")",
":",
"if",
"not",
"isinstance",
"(",
"mask",
",",
"string_types",
")",
":",
"return",
"False",
"octets",
"=",
"mask",
".",
"split",
"(",
"'.'",
")",
"if",
"not",
"len",
"(",
"octets",
")",
"==",
"4",
":",
"return... | Returns True if the value passed is a valid netmask, otherwise return False | [
"Returns",
"True",
"if",
"the",
"value",
"passed",
"is",
"a",
"valid",
"netmask",
"otherwise",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/net.py#L92-L103 |
35,154 | saltstack/salt | salt/modules/memcached.py | status | def status(host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Get memcached status
CLI Example:
.. code-block:: bash
salt '*' memcached.status
'''
conn = _connect(host, port)
try:
stats = _check_stats(conn)[0]
except (CommandExecutionError, IndexError):
return False
... | python | def status(host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Get memcached status
CLI Example:
.. code-block:: bash
salt '*' memcached.status
'''
conn = _connect(host, port)
try:
stats = _check_stats(conn)[0]
except (CommandExecutionError, IndexError):
return False
... | [
"def",
"status",
"(",
"host",
"=",
"DEFAULT_HOST",
",",
"port",
"=",
"DEFAULT_PORT",
")",
":",
"conn",
"=",
"_connect",
"(",
"host",
",",
"port",
")",
"try",
":",
"stats",
"=",
"_check_stats",
"(",
"conn",
")",
"[",
"0",
"]",
"except",
"(",
"CommandE... | Get memcached status
CLI Example:
.. code-block:: bash
salt '*' memcached.status | [
"Get",
"memcached",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/memcached.py#L74-L90 |
35,155 | saltstack/salt | salt/modules/memcached.py | get | def get(key, host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Retrieve value for a key
CLI Example:
.. code-block:: bash
salt '*' memcached.get <key>
'''
conn = _connect(host, port)
_check_stats(conn)
return conn.get(key) | python | def get(key, host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Retrieve value for a key
CLI Example:
.. code-block:: bash
salt '*' memcached.get <key>
'''
conn = _connect(host, port)
_check_stats(conn)
return conn.get(key) | [
"def",
"get",
"(",
"key",
",",
"host",
"=",
"DEFAULT_HOST",
",",
"port",
"=",
"DEFAULT_PORT",
")",
":",
"conn",
"=",
"_connect",
"(",
"host",
",",
"port",
")",
"_check_stats",
"(",
"conn",
")",
"return",
"conn",
".",
"get",
"(",
"key",
")"
] | Retrieve value for a key
CLI Example:
.. code-block:: bash
salt '*' memcached.get <key> | [
"Retrieve",
"value",
"for",
"a",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/memcached.py#L93-L105 |
35,156 | saltstack/salt | salt/modules/memcached.py | delete | def delete(key,
host=DEFAULT_HOST,
port=DEFAULT_PORT,
time=DEFAULT_TIME):
'''
Delete a key from memcache server
CLI Example:
.. code-block:: bash
salt '*' memcached.delete <key>
'''
if not isinstance(time, six.integer_types):
raise SaltInvocati... | python | def delete(key,
host=DEFAULT_HOST,
port=DEFAULT_PORT,
time=DEFAULT_TIME):
'''
Delete a key from memcache server
CLI Example:
.. code-block:: bash
salt '*' memcached.delete <key>
'''
if not isinstance(time, six.integer_types):
raise SaltInvocati... | [
"def",
"delete",
"(",
"key",
",",
"host",
"=",
"DEFAULT_HOST",
",",
"port",
"=",
"DEFAULT_PORT",
",",
"time",
"=",
"DEFAULT_TIME",
")",
":",
"if",
"not",
"isinstance",
"(",
"time",
",",
"six",
".",
"integer_types",
")",
":",
"raise",
"SaltInvocationError",... | Delete a key from memcache server
CLI Example:
.. code-block:: bash
salt '*' memcached.delete <key> | [
"Delete",
"a",
"key",
"from",
"memcache",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/memcached.py#L132-L149 |
35,157 | saltstack/salt | salt/modules/memcached.py | increment | def increment(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Increment the value of a key
CLI Example:
.. code-block:: bash
salt '*' memcached.increment <key>
salt '*' memcached.increment <key> 2
'''
conn = _connect(host, port)
_check_stats(conn)
cur = get(ke... | python | def increment(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT):
'''
Increment the value of a key
CLI Example:
.. code-block:: bash
salt '*' memcached.increment <key>
salt '*' memcached.increment <key> 2
'''
conn = _connect(host, port)
_check_stats(conn)
cur = get(ke... | [
"def",
"increment",
"(",
"key",
",",
"delta",
"=",
"1",
",",
"host",
"=",
"DEFAULT_HOST",
",",
"port",
"=",
"DEFAULT_PORT",
")",
":",
"conn",
"=",
"_connect",
"(",
"host",
",",
"port",
")",
"_check_stats",
"(",
"conn",
")",
"cur",
"=",
"get",
"(",
... | Increment the value of a key
CLI Example:
.. code-block:: bash
salt '*' memcached.increment <key>
salt '*' memcached.increment <key> 2 | [
"Increment",
"the",
"value",
"of",
"a",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/memcached.py#L213-L239 |
35,158 | saltstack/salt | salt/client/ssh/wrapper/publish.py | runner | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runnr function
CLI Example:
.. code-block:: bash
salt-ssh '*' publish.runner jobs.lookup_jid 20140916125524463507
'''
# Form args as list
if not isinstance(arg, list):
arg... | python | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runnr function
CLI Example:
.. code-block:: bash
salt-ssh '*' publish.runner jobs.lookup_jid 20140916125524463507
'''
# Form args as list
if not isinstance(arg, list):
arg... | [
"def",
"runner",
"(",
"fun",
",",
"arg",
"=",
"None",
",",
"timeout",
"=",
"5",
")",
":",
"# Form args as list",
"if",
"not",
"isinstance",
"(",
"arg",
",",
"list",
")",
":",
"arg",
"=",
"[",
"salt",
".",
"utils",
".",
"args",
".",
"yamlify_arg",
"... | Execute a runner on the master and return the data from the runnr function
CLI Example:
.. code-block:: bash
salt-ssh '*' publish.runner jobs.lookup_jid 20140916125524463507 | [
"Execute",
"a",
"runner",
"on",
"the",
"master",
"and",
"return",
"the",
"data",
"from",
"the",
"runnr",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/publish.py#L221-L241 |
35,159 | saltstack/salt | salt/utils/openstack/pyrax/queues.py | RackspaceQueues.create | def create(self, qname):
'''
Create RackSpace Queue.
'''
try:
if self.exists(qname):
log.error('Queues "%s" already exists. Nothing done.', qname)
return True
self.conn.create(qname)
return True
except pyrax.ex... | python | def create(self, qname):
'''
Create RackSpace Queue.
'''
try:
if self.exists(qname):
log.error('Queues "%s" already exists. Nothing done.', qname)
return True
self.conn.create(qname)
return True
except pyrax.ex... | [
"def",
"create",
"(",
"self",
",",
"qname",
")",
":",
"try",
":",
"if",
"self",
".",
"exists",
"(",
"qname",
")",
":",
"log",
".",
"error",
"(",
"'Queues \"%s\" already exists. Nothing done.'",
",",
"qname",
")",
"return",
"True",
"self",
".",
"conn",
".... | Create RackSpace Queue. | [
"Create",
"RackSpace",
"Queue",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/pyrax/queues.py#L25-L40 |
35,160 | saltstack/salt | salt/utils/openstack/pyrax/queues.py | RackspaceQueues.delete | def delete(self, qname):
'''
Delete an existings RackSpace Queue.
'''
try:
q = self.exists(qname)
if not q:
return False
queue = self.show(qname)
if queue:
queue.delete()
except pyrax.exceptions as er... | python | def delete(self, qname):
'''
Delete an existings RackSpace Queue.
'''
try:
q = self.exists(qname)
if not q:
return False
queue = self.show(qname)
if queue:
queue.delete()
except pyrax.exceptions as er... | [
"def",
"delete",
"(",
"self",
",",
"qname",
")",
":",
"try",
":",
"q",
"=",
"self",
".",
"exists",
"(",
"qname",
")",
"if",
"not",
"q",
":",
"return",
"False",
"queue",
"=",
"self",
".",
"show",
"(",
"qname",
")",
"if",
"queue",
":",
"queue",
"... | Delete an existings RackSpace Queue. | [
"Delete",
"an",
"existings",
"RackSpace",
"Queue",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/pyrax/queues.py#L42-L58 |
35,161 | saltstack/salt | salt/utils/openstack/pyrax/queues.py | RackspaceQueues.exists | def exists(self, qname):
'''
Check to see if a Queue exists.
'''
try:
# First if not exists() -> exit
if self.conn.queue_exists(qname):
return True
return False
except pyrax.exceptions as err_msg:
log.error('RackSpac... | python | def exists(self, qname):
'''
Check to see if a Queue exists.
'''
try:
# First if not exists() -> exit
if self.conn.queue_exists(qname):
return True
return False
except pyrax.exceptions as err_msg:
log.error('RackSpac... | [
"def",
"exists",
"(",
"self",
",",
"qname",
")",
":",
"try",
":",
"# First if not exists() -> exit",
"if",
"self",
".",
"conn",
".",
"queue_exists",
"(",
"qname",
")",
":",
"return",
"True",
"return",
"False",
"except",
"pyrax",
".",
"exceptions",
"as",
"e... | Check to see if a Queue exists. | [
"Check",
"to",
"see",
"if",
"a",
"Queue",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/pyrax/queues.py#L60-L73 |
35,162 | saltstack/salt | salt/utils/openstack/pyrax/queues.py | RackspaceQueues.show | def show(self, qname):
'''
Show information about Queue
'''
try:
# First if not exists() -> exit
if not self.conn.queue_exists(qname):
return {}
# If exist, search the queue to return the Queue Object
for queue in self.conn.... | python | def show(self, qname):
'''
Show information about Queue
'''
try:
# First if not exists() -> exit
if not self.conn.queue_exists(qname):
return {}
# If exist, search the queue to return the Queue Object
for queue in self.conn.... | [
"def",
"show",
"(",
"self",
",",
"qname",
")",
":",
"try",
":",
"# First if not exists() -> exit",
"if",
"not",
"self",
".",
"conn",
".",
"queue_exists",
"(",
"qname",
")",
":",
"return",
"{",
"}",
"# If exist, search the queue to return the Queue Object",
"for",
... | Show information about Queue | [
"Show",
"information",
"about",
"Queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/pyrax/queues.py#L75-L90 |
35,163 | saltstack/salt | salt/modules/win_autoruns.py | _get_dirs | def _get_dirs(user_dir, startup_dir):
'''
Return a list of startup dirs
'''
try:
users = os.listdir(user_dir)
except WindowsError: # pylint: disable=E0602
users = []
full_dirs = []
for user in users:
full_dir = os.path.join(user_dir, user, startup_dir)
if os... | python | def _get_dirs(user_dir, startup_dir):
'''
Return a list of startup dirs
'''
try:
users = os.listdir(user_dir)
except WindowsError: # pylint: disable=E0602
users = []
full_dirs = []
for user in users:
full_dir = os.path.join(user_dir, user, startup_dir)
if os... | [
"def",
"_get_dirs",
"(",
"user_dir",
",",
"startup_dir",
")",
":",
"try",
":",
"users",
"=",
"os",
".",
"listdir",
"(",
"user_dir",
")",
"except",
"WindowsError",
":",
"# pylint: disable=E0602",
"users",
"=",
"[",
"]",
"full_dirs",
"=",
"[",
"]",
"for",
... | Return a list of startup dirs | [
"Return",
"a",
"list",
"of",
"startup",
"dirs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_autoruns.py#L34-L48 |
35,164 | saltstack/salt | salt/modules/win_autoruns.py | list_ | def list_():
'''
Get a list of automatically running programs
CLI Example:
.. code-block:: bash
salt '*' autoruns.list
'''
autoruns = {}
# Find autoruns in registry
keys = ['HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',
'HKLM\\Software\\Microsoft\\Windows\... | python | def list_():
'''
Get a list of automatically running programs
CLI Example:
.. code-block:: bash
salt '*' autoruns.list
'''
autoruns = {}
# Find autoruns in registry
keys = ['HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',
'HKLM\\Software\\Microsoft\\Windows\... | [
"def",
"list_",
"(",
")",
":",
"autoruns",
"=",
"{",
"}",
"# Find autoruns in registry",
"keys",
"=",
"[",
"'HKLM\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run'",
",",
"'HKLM\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run /reg:64'",
",",
"'HKCU\\\\Softw... | Get a list of automatically running programs
CLI Example:
.. code-block:: bash
salt '*' autoruns.list | [
"Get",
"a",
"list",
"of",
"automatically",
"running",
"programs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_autoruns.py#L51-L90 |
35,165 | saltstack/salt | salt/pillar/vault.py | ext_pillar | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf,
nesting_key=None):
'''
Get pillar data from Vault for the configuration ``conf``.
'''
comps = conf.split()
paths = [comp for comp in comps if comp.startswith('path=... | python | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf,
nesting_key=None):
'''
Get pillar data from Vault for the configuration ``conf``.
'''
comps = conf.split()
paths = [comp for comp in comps if comp.startswith('path=... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"conf",
",",
"nesting_key",
"=",
"None",
")",
":",
"comps",
"=",
"conf",
".",
"split",
"(",
")",
"paths",
"=",
"[",
"comp",
"for",
"comp",
"in",
... | Get pillar data from Vault for the configuration ``conf``. | [
"Get",
"pillar",
"data",
"from",
"Vault",
"for",
"the",
"configuration",
"conf",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/vault.py#L142-L172 |
35,166 | saltstack/salt | salt/states/svn.py | export | def export(name,
target=None,
rev=None,
user=None,
username=None,
password=None,
force=False,
overwrite=False,
externals=True,
trust=False,
trust_failures=None):
'''
Export a file or directory from an S... | python | def export(name,
target=None,
rev=None,
user=None,
username=None,
password=None,
force=False,
overwrite=False,
externals=True,
trust=False,
trust_failures=None):
'''
Export a file or directory from an S... | [
"def",
"export",
"(",
"name",
",",
"target",
"=",
"None",
",",
"rev",
"=",
"None",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"force",
"=",
"False",
",",
"overwrite",
"=",
"False",
",",
"externals",
"... | Export a file or directory from an SVN repository
name
Address and path to the file or directory to be exported.
target
Name of the target directory where the checkout will put the working
directory
rev : None
The name revision number to checkout. Enable "force" if the dir... | [
"Export",
"a",
"file",
"or",
"directory",
"from",
"an",
"SVN",
"repository"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/svn.py#L190-L291 |
35,167 | saltstack/salt | salt/states/svn.py | dirty | def dirty(name,
target,
user=None,
username=None,
password=None,
ignore_unversioned=False):
'''
Determine if the working directory has been changed.
'''
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
return _fail(ret, 'This functi... | python | def dirty(name,
target,
user=None,
username=None,
password=None,
ignore_unversioned=False):
'''
Determine if the working directory has been changed.
'''
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
return _fail(ret, 'This functi... | [
"def",
"dirty",
"(",
"name",
",",
"target",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ignore_unversioned",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",... | Determine if the working directory has been changed. | [
"Determine",
"if",
"the",
"working",
"directory",
"has",
"been",
"changed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/svn.py#L294-L304 |
35,168 | saltstack/salt | salt/pillar/saltclass.py | ext_pillar | def ext_pillar(minion_id, pillar, *args, **kwargs):
'''
Compile pillar data
'''
# Node definitions path will be retrieved from args (or set to default),
# then added to 'salt_data' dict that is passed to the 'get_pillars'
# function. The dictionary contains:
# - __opts__
# - __sa... | python | def ext_pillar(minion_id, pillar, *args, **kwargs):
'''
Compile pillar data
'''
# Node definitions path will be retrieved from args (or set to default),
# then added to 'salt_data' dict that is passed to the 'get_pillars'
# function. The dictionary contains:
# - __opts__
# - __sa... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Node definitions path will be retrieved from args (or set to default),",
"# then added to 'salt_data' dict that is passed to the 'get_pillars'",
"# function. The dictionary... | Compile pillar data | [
"Compile",
"pillar",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/saltclass.py#L30-L65 |
35,169 | saltstack/salt | salt/states/libcloud_storage.py | container_present | def container_present(name, profile):
'''
Ensures a container is present.
:param name: Container name
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
'''
containers = __salt__['libcloud_storage.list_containers'](profile)
match = [z for z in containers i... | python | def container_present(name, profile):
'''
Ensures a container is present.
:param name: Container name
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
'''
containers = __salt__['libcloud_storage.list_containers'](profile)
match = [z for z in containers i... | [
"def",
"container_present",
"(",
"name",
",",
"profile",
")",
":",
"containers",
"=",
"__salt__",
"[",
"'libcloud_storage.list_containers'",
"]",
"(",
"profile",
")",
"match",
"=",
"[",
"z",
"for",
"z",
"in",
"containers",
"if",
"z",
"[",
"'name'",
"]",
"=... | Ensures a container is present.
:param name: Container name
:type name: ``str``
:param profile: The profile key
:type profile: ``str`` | [
"Ensures",
"a",
"container",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_storage.py#L92-L108 |
35,170 | saltstack/salt | salt/states/libcloud_storage.py | object_present | def object_present(container, name, path, profile):
'''
Ensures a object is presnt.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str``
:param profile: The profile k... | python | def object_present(container, name, path, profile):
'''
Ensures a object is presnt.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str``
:param profile: The profile k... | [
"def",
"object_present",
"(",
"container",
",",
"name",
",",
"path",
",",
"profile",
")",
":",
"existing_object",
"=",
"__salt__",
"[",
"'libcloud_storage.get_container_object'",
"]",
"(",
"container",
",",
"name",
",",
"profile",
")",
"if",
"existing_object",
"... | Ensures a object is presnt.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str``
:param profile: The profile key
:type profile: ``str`` | [
"Ensures",
"a",
"object",
"is",
"presnt",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_storage.py#L130-L151 |
35,171 | saltstack/salt | salt/states/libcloud_storage.py | object_absent | def object_absent(container, name, profile):
'''
Ensures a object is absent.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
'''
existing_object = __salt__... | python | def object_absent(container, name, profile):
'''
Ensures a object is absent.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
'''
existing_object = __salt__... | [
"def",
"object_absent",
"(",
"container",
",",
"name",
",",
"profile",
")",
":",
"existing_object",
"=",
"__salt__",
"[",
"'libcloud_storage.get_container_object'",
"]",
"(",
"container",
",",
"name",
",",
"profile",
")",
"if",
"existing_object",
"is",
"None",
"... | Ensures a object is absent.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param profile: The profile key
:type profile: ``str`` | [
"Ensures",
"a",
"object",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_storage.py#L154-L172 |
35,172 | saltstack/salt | salt/states/libcloud_storage.py | file_present | def file_present(container, name, path, profile, overwrite_existing=False):
'''
Ensures a object is downloaded locally.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str`... | python | def file_present(container, name, path, profile, overwrite_existing=False):
'''
Ensures a object is downloaded locally.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str`... | [
"def",
"file_present",
"(",
"container",
",",
"name",
",",
"path",
",",
"profile",
",",
"overwrite_existing",
"=",
"False",
")",
":",
"result",
"=",
"__salt__",
"[",
"'libcloud_storage.download_object'",
"]",
"(",
"path",
",",
"container",
",",
"name",
",",
... | Ensures a object is downloaded locally.
:param container: Container name
:type container: ``str``
:param name: Object name in cloud
:type name: ``str``
:param path: Local path to file
:type path: ``str``
:param profile: The profile key
:type profile: ``str``
:param overwrite... | [
"Ensures",
"a",
"object",
"is",
"downloaded",
"locally",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_storage.py#L175-L195 |
35,173 | saltstack/salt | salt/proxy/nxos.py | init | def init(opts=None):
'''
Required.
Initialize device connection using ssh or nxapi connection type.
'''
global CONNECTION
if __opts__.get('proxy').get('connection') is not None:
CONNECTION = __opts__.get('proxy').get('connection')
if CONNECTION == 'ssh':
log.info('NXOS PROXY... | python | def init(opts=None):
'''
Required.
Initialize device connection using ssh or nxapi connection type.
'''
global CONNECTION
if __opts__.get('proxy').get('connection') is not None:
CONNECTION = __opts__.get('proxy').get('connection')
if CONNECTION == 'ssh':
log.info('NXOS PROXY... | [
"def",
"init",
"(",
"opts",
"=",
"None",
")",
":",
"global",
"CONNECTION",
"if",
"__opts__",
".",
"get",
"(",
"'proxy'",
")",
".",
"get",
"(",
"'connection'",
")",
"is",
"not",
"None",
":",
"CONNECTION",
"=",
"__opts__",
".",
"get",
"(",
"'proxy'",
"... | Required.
Initialize device connection using ssh or nxapi connection type. | [
"Required",
".",
"Initialize",
"device",
"connection",
"using",
"ssh",
"or",
"nxapi",
"connection",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L210-L227 |
35,174 | saltstack/salt | salt/proxy/nxos.py | sendline | def sendline(command, method='cli_show_ascii', **kwargs):
'''
Send arbitrary show or config commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_co... | python | def sendline(command, method='cli_show_ascii', **kwargs):
'''
Send arbitrary show or config commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_co... | [
"def",
"sendline",
"(",
"command",
",",
"method",
"=",
"'cli_show_ascii'",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"if",
"CONNECTION",
"==",
"'ssh'",
":",
"result",
"=",
"_sendline_ssh",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
"elif",
"CON... | Send arbitrary show or config commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to the device.
Defaults to `... | [
"Send",
"arbitrary",
"show",
"or",
"config",
"commands",
"to",
"the",
"NX",
"-",
"OS",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L297-L327 |
35,175 | saltstack/salt | salt/proxy/nxos.py | proxy_config | def proxy_config(commands, **kwargs):
'''
Send configuration commands over SSH or NX-API
commands
List of configuration commands
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
De... | python | def proxy_config(commands, **kwargs):
'''
Send configuration commands over SSH or NX-API
commands
List of configuration commands
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
De... | [
"def",
"proxy_config",
"(",
"commands",
",",
"*",
"*",
"kwargs",
")",
":",
"no_save_config",
"=",
"DEVICE_DETAILS",
"[",
"'no_save_config'",
"]",
"no_save_config",
"=",
"kwargs",
".",
"get",
"(",
"'no_save_config'",
",",
"no_save_config",
")",
"if",
"not",
"is... | Send configuration commands over SSH or NX-API
commands
List of configuration commands
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block: bash
sal... | [
"Send",
"configuration",
"commands",
"over",
"SSH",
"or",
"NX",
"-",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L330-L376 |
35,176 | saltstack/salt | salt/proxy/nxos.py | _init_ssh | def _init_ssh(opts):
'''
Open a connection to the NX-OS switch over SSH.
'''
if opts is None:
opts = __opts__
try:
this_prompt = None
if 'prompt_regex' in opts['proxy']:
this_prompt = opts['proxy']['prompt_regex']
elif 'prompt_name' in opts['proxy']:
... | python | def _init_ssh(opts):
'''
Open a connection to the NX-OS switch over SSH.
'''
if opts is None:
opts = __opts__
try:
this_prompt = None
if 'prompt_regex' in opts['proxy']:
this_prompt = opts['proxy']['prompt_regex']
elif 'prompt_name' in opts['proxy']:
... | [
"def",
"_init_ssh",
"(",
"opts",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"__opts__",
"try",
":",
"this_prompt",
"=",
"None",
"if",
"'prompt_regex'",
"in",
"opts",
"[",
"'proxy'",
"]",
":",
"this_prompt",
"=",
"opts",
"[",
"'proxy'",
"]"... | Open a connection to the NX-OS switch over SSH. | [
"Open",
"a",
"connection",
"to",
"the",
"NX",
"-",
"OS",
"switch",
"over",
"SSH",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L382-L415 |
35,177 | saltstack/salt | salt/proxy/nxos.py | _parse_output_for_errors | def _parse_output_for_errors(data, command, **kwargs):
'''
Helper method to parse command output for error information
'''
if re.search('% Invalid', data):
raise CommandExecutionError({
'rejected_input': command,
'message': 'CLI excution error',
'code': '400',... | python | def _parse_output_for_errors(data, command, **kwargs):
'''
Helper method to parse command output for error information
'''
if re.search('% Invalid', data):
raise CommandExecutionError({
'rejected_input': command,
'message': 'CLI excution error',
'code': '400',... | [
"def",
"_parse_output_for_errors",
"(",
"data",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"re",
".",
"search",
"(",
"'% Invalid'",
",",
"data",
")",
":",
"raise",
"CommandExecutionError",
"(",
"{",
"'rejected_input'",
":",
"command",
",",
"'... | Helper method to parse command output for error information | [
"Helper",
"method",
"to",
"parse",
"command",
"output",
"for",
"error",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L446-L465 |
35,178 | saltstack/salt | salt/proxy/nxos.py | _init_nxapi | def _init_nxapi(opts):
'''
Open a connection to the NX-OS switch over NX-API.
As the communication is HTTP(S) based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock... | python | def _init_nxapi(opts):
'''
Open a connection to the NX-OS switch over NX-API.
As the communication is HTTP(S) based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock... | [
"def",
"_init_nxapi",
"(",
"opts",
")",
":",
"proxy_dict",
"=",
"opts",
".",
"get",
"(",
"'proxy'",
",",
"{",
"}",
")",
"conn_args",
"=",
"copy",
".",
"deepcopy",
"(",
"proxy_dict",
")",
"conn_args",
".",
"pop",
"(",
"'proxytype'",
",",
"None",
")",
... | Open a connection to the NX-OS switch over NX-API.
As the communication is HTTP(S) based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
which doesn't come with muc... | [
"Open",
"a",
"connection",
"to",
"the",
"NX",
"-",
"OS",
"switch",
"over",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L475-L506 |
35,179 | saltstack/salt | salt/proxy/nxos.py | _nxapi_request | def _nxapi_request(commands, method='cli_conf', **kwargs):
'''
Executes an nxapi_request request over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output... | python | def _nxapi_request(commands, method='cli_conf', **kwargs):
'''
Executes an nxapi_request request over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output... | [
"def",
"_nxapi_request",
"(",
"commands",
",",
"method",
"=",
"'cli_conf'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"CONNECTION",
"==",
"'ssh'",
":",
"return",
"'_nxapi_request is not available for ssh proxy'",
"conn_args",
"=",
"DEVICE_DETAILS",
"[",
"'conn_args'"... | Executes an nxapi_request request over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to the device.
... | [
"Executes",
"an",
"nxapi_request",
"request",
"over",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L521-L539 |
35,180 | saltstack/salt | salt/utils/yast.py | mksls | def mksls(src, dst=None):
'''
Convert an AutoYAST file to an SLS file
'''
with salt.utils.files.fopen(src, 'r') as fh_:
ps_opts = xml.to_dict(ET.fromstring(fh_.read()))
if dst is not None:
with salt.utils.files.fopen(dst, 'w') as fh_:
salt.utils.yaml.safe_dump(ps_opts, f... | python | def mksls(src, dst=None):
'''
Convert an AutoYAST file to an SLS file
'''
with salt.utils.files.fopen(src, 'r') as fh_:
ps_opts = xml.to_dict(ET.fromstring(fh_.read()))
if dst is not None:
with salt.utils.files.fopen(dst, 'w') as fh_:
salt.utils.yaml.safe_dump(ps_opts, f... | [
"def",
"mksls",
"(",
"src",
",",
"dst",
"=",
"None",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"src",
",",
"'r'",
")",
"as",
"fh_",
":",
"ps_opts",
"=",
"xml",
".",
"to_dict",
"(",
"ET",
".",
"fromstring",
"(",
"f... | Convert an AutoYAST file to an SLS file | [
"Convert",
"an",
"AutoYAST",
"file",
"to",
"an",
"SLS",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/yast.py#L14-L25 |
35,181 | saltstack/salt | salt/utils/color.py | get_color_theme | def get_color_theme(theme):
'''
Return the color theme to use
'''
# Keep the heavy lifting out of the module space
import salt.utils.data
import salt.utils.files
import salt.utils.yaml
if not os.path.isfile(theme):
log.warning('The named theme %s if not available', theme)
tr... | python | def get_color_theme(theme):
'''
Return the color theme to use
'''
# Keep the heavy lifting out of the module space
import salt.utils.data
import salt.utils.files
import salt.utils.yaml
if not os.path.isfile(theme):
log.warning('The named theme %s if not available', theme)
tr... | [
"def",
"get_color_theme",
"(",
"theme",
")",
":",
"# Keep the heavy lifting out of the module space",
"import",
"salt",
".",
"utils",
".",
"data",
"import",
"salt",
".",
"utils",
".",
"files",
"import",
"salt",
".",
"utils",
".",
"yaml",
"if",
"not",
"os",
"."... | Return the color theme to use | [
"Return",
"the",
"color",
"theme",
"to",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/color.py#L18-L41 |
35,182 | saltstack/salt | salt/states/zabbix_usergroup.py | absent | def absent(name, **kwargs):
'''
Ensures that the user group does not exist, eventually delete user group.
.. versionadded:: 2016.3.0
:param name: name of the user group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | python | def absent(name, **kwargs):
'''
Ensures that the user group does not exist, eventually delete user group.
.. versionadded:: 2016.3.0
:param name: name of the user group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connection_user'",
"]",
"if",
"'_con... | Ensures that the user group does not exist, eventually delete user group.
.. versionadded:: 2016.3.0
:param name: name of the user group
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (... | [
"Ensures",
"that",
"the",
"user",
"group",
"does",
"not",
"exist",
"eventually",
"delete",
"user",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_usergroup.py#L185-L253 |
35,183 | saltstack/salt | salt/modules/highstate_doc.py | proccess_lowstates | def proccess_lowstates(**kwargs):
'''
return proccessed lowstate data that was not blacklisted
render_module_function is used to provide your own.
defaults to from_lowstate
'''
states = []
config = _get_config(**kwargs)
proccesser = config.get('proccesser')
ls = __salt__['state.show... | python | def proccess_lowstates(**kwargs):
'''
return proccessed lowstate data that was not blacklisted
render_module_function is used to provide your own.
defaults to from_lowstate
'''
states = []
config = _get_config(**kwargs)
proccesser = config.get('proccesser')
ls = __salt__['state.show... | [
"def",
"proccess_lowstates",
"(",
"*",
"*",
"kwargs",
")",
":",
"states",
"=",
"[",
"]",
"config",
"=",
"_get_config",
"(",
"*",
"*",
"kwargs",
")",
"proccesser",
"=",
"config",
".",
"get",
"(",
"'proccesser'",
")",
"ls",
"=",
"__salt__",
"[",
"'state.... | return proccessed lowstate data that was not blacklisted
render_module_function is used to provide your own.
defaults to from_lowstate | [
"return",
"proccessed",
"lowstate",
"data",
"that",
"was",
"not",
"blacklisted"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L477-L501 |
35,184 | saltstack/salt | salt/modules/highstate_doc.py | _state_data_to_yaml_string | def _state_data_to_yaml_string(data, whitelist=None, blacklist=None):
'''
return a data dict in yaml string format.
'''
y = {}
if blacklist is None:
# TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTERNAL_KEYWORDS
blacklist = ['__env__', '__id__',... | python | def _state_data_to_yaml_string(data, whitelist=None, blacklist=None):
'''
return a data dict in yaml string format.
'''
y = {}
if blacklist is None:
# TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTERNAL_KEYWORDS
blacklist = ['__env__', '__id__',... | [
"def",
"_state_data_to_yaml_string",
"(",
"data",
",",
"whitelist",
"=",
"None",
",",
"blacklist",
"=",
"None",
")",
":",
"y",
"=",
"{",
"}",
"if",
"blacklist",
"is",
"None",
":",
"# TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTER... | return a data dict in yaml string format. | [
"return",
"a",
"data",
"dict",
"in",
"yaml",
"string",
"format",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L504-L521 |
35,185 | saltstack/salt | salt/modules/highstate_doc.py | _format_markdown_requisite | def _format_markdown_requisite(state, stateid, makelink=True):
'''
format requisite as a link users can click
'''
fmt_id = '{0}: {1}'.format(state, stateid)
if makelink:
return ' * [{0}](#{1})\n'.format(fmt_id, _format_markdown_link(fmt_id))
else:
return ' * `{0}`\n'.format(fmt_i... | python | def _format_markdown_requisite(state, stateid, makelink=True):
'''
format requisite as a link users can click
'''
fmt_id = '{0}: {1}'.format(state, stateid)
if makelink:
return ' * [{0}](#{1})\n'.format(fmt_id, _format_markdown_link(fmt_id))
else:
return ' * `{0}`\n'.format(fmt_i... | [
"def",
"_format_markdown_requisite",
"(",
"state",
",",
"stateid",
",",
"makelink",
"=",
"True",
")",
":",
"fmt_id",
"=",
"'{0}: {1}'",
".",
"format",
"(",
"state",
",",
"stateid",
")",
"if",
"makelink",
":",
"return",
"' * [{0}](#{1})\\n'",
".",
"format",
"... | format requisite as a link users can click | [
"format",
"requisite",
"as",
"a",
"link",
"users",
"can",
"click"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L569-L577 |
35,186 | saltstack/salt | salt/utils/win_osinfo.py | os_version_info_ex | def os_version_info_ex():
'''
Helper function to return the results of the GetVersionExW Windows API call.
It is a ctypes Structure that contains Windows OS Version information.
Returns:
class: An instance of a class containing version info
'''
if not HAS_WIN32:
return
clas... | python | def os_version_info_ex():
'''
Helper function to return the results of the GetVersionExW Windows API call.
It is a ctypes Structure that contains Windows OS Version information.
Returns:
class: An instance of a class containing version info
'''
if not HAS_WIN32:
return
clas... | [
"def",
"os_version_info_ex",
"(",
")",
":",
"if",
"not",
"HAS_WIN32",
":",
"return",
"class",
"OSVersionInfo",
"(",
"ctypes",
".",
"Structure",
")",
":",
"_fields_",
"=",
"(",
"(",
"'dwOSVersionInfoSize'",
",",
"DWORD",
")",
",",
"(",
"'dwMajorVersion'",
","... | Helper function to return the results of the GetVersionExW Windows API call.
It is a ctypes Structure that contains Windows OS Version information.
Returns:
class: An instance of a class containing version info | [
"Helper",
"function",
"to",
"return",
"the",
"results",
"of",
"the",
"GetVersionExW",
"Windows",
"API",
"call",
".",
"It",
"is",
"a",
"ctypes",
"Structure",
"that",
"contains",
"Windows",
"OS",
"Version",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_osinfo.py#L35-L66 |
35,187 | saltstack/salt | salt/modules/mac_user.py | _dscl | def _dscl(cmd, ctype='create'):
'''
Run a dscl -create command
'''
if __grains__['osrelease_info'] < (10, 8):
source, noderoot = '.', ''
else:
source, noderoot = 'localhost', '/Local/Default'
if noderoot:
cmd[0] = noderoot + cmd[0]
return __salt__['cmd.run_all'](
... | python | def _dscl(cmd, ctype='create'):
'''
Run a dscl -create command
'''
if __grains__['osrelease_info'] < (10, 8):
source, noderoot = '.', ''
else:
source, noderoot = 'localhost', '/Local/Default'
if noderoot:
cmd[0] = noderoot + cmd[0]
return __salt__['cmd.run_all'](
... | [
"def",
"_dscl",
"(",
"cmd",
",",
"ctype",
"=",
"'create'",
")",
":",
"if",
"__grains__",
"[",
"'osrelease_info'",
"]",
"<",
"(",
"10",
",",
"8",
")",
":",
"source",
",",
"noderoot",
"=",
"'.'",
",",
"''",
"else",
":",
"source",
",",
"noderoot",
"="... | Run a dscl -create command | [
"Run",
"a",
"dscl",
"-",
"create",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L56-L71 |
35,188 | saltstack/salt | salt/modules/mac_user.py | chhome | def chhome(name, home, **kwargs):
'''
Change the home directory of the user
CLI Example:
.. code-block:: bash
salt '*' user.chhome foo /Users/foo
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
persist = kwargs.pop('persist', False)
if kwargs:
salt.utils.args.inval... | python | def chhome(name, home, **kwargs):
'''
Change the home directory of the user
CLI Example:
.. code-block:: bash
salt '*' user.chhome foo /Users/foo
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
persist = kwargs.pop('persist', False)
if kwargs:
salt.utils.args.inval... | [
"def",
"chhome",
"(",
"name",
",",
"home",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"persist",
"=",
"kwargs",
".",
"pop",
"(",
"'persist'",
",",
"False",... | Change the home directory of the user
CLI Example:
.. code-block:: bash
salt '*' user.chhome foo /Users/foo | [
"Change",
"the",
"home",
"directory",
"of",
"the",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L268-L298 |
35,189 | saltstack/salt | salt/modules/mac_user.py | chfullname | def chfullname(name, fullname):
'''
Change the user's Full Name
CLI Example:
.. code-block:: bash
salt '*' user.chfullname foo 'Foo Bar'
'''
fullname = salt.utils.data.decode(fullname)
pre_info = info(name)
if not pre_info:
raise CommandExecutionError('User \'{0}\' doe... | python | def chfullname(name, fullname):
'''
Change the user's Full Name
CLI Example:
.. code-block:: bash
salt '*' user.chfullname foo 'Foo Bar'
'''
fullname = salt.utils.data.decode(fullname)
pre_info = info(name)
if not pre_info:
raise CommandExecutionError('User \'{0}\' doe... | [
"def",
"chfullname",
"(",
"name",
",",
"fullname",
")",
":",
"fullname",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"decode",
"(",
"fullname",
")",
"pre_info",
"=",
"info",
"(",
"name",
")",
"if",
"not",
"pre_info",
":",
"raise",
"CommandExecutionError... | Change the user's Full Name
CLI Example:
.. code-block:: bash
salt '*' user.chfullname foo 'Foo Bar' | [
"Change",
"the",
"user",
"s",
"Full",
"Name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L301-L330 |
35,190 | saltstack/salt | salt/modules/mac_user.py | chgroups | def chgroups(name, groups, append=False):
'''
Change the groups to which the user belongs. Note that the user's primary
group does not have to be one of the groups passed, membership in the
user's primary group is automatically assumed.
groups
Groups to which the user should belong, can be ... | python | def chgroups(name, groups, append=False):
'''
Change the groups to which the user belongs. Note that the user's primary
group does not have to be one of the groups passed, membership in the
user's primary group is automatically assumed.
groups
Groups to which the user should belong, can be ... | [
"def",
"chgroups",
"(",
"name",
",",
"groups",
",",
"append",
"=",
"False",
")",
":",
"### NOTE: **args isn't used here but needs to be included in this",
"### function for compatibility with the user.present state",
"uinfo",
"=",
"info",
"(",
"name",
")",
"if",
"not",
"u... | Change the groups to which the user belongs. Note that the user's primary
group does not have to be one of the groups passed, membership in the
user's primary group is automatically assumed.
groups
Groups to which the user should belong, can be passed either as a
python list or a comma-sepa... | [
"Change",
"the",
"groups",
"to",
"which",
"the",
"user",
"belongs",
".",
"Note",
"that",
"the",
"user",
"s",
"primary",
"group",
"does",
"not",
"have",
"to",
"be",
"one",
"of",
"the",
"groups",
"passed",
"membership",
"in",
"the",
"user",
"s",
"primary",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L333-L387 |
35,191 | saltstack/salt | salt/modules/mac_user.py | list_groups | def list_groups(name):
'''
Return a list of groups the named user belongs to.
name
The name of the user for which to list groups. Starting in Salt 2016.11.0,
all groups for the user, including groups beginning with an underscore
will be listed.
.. versionchanged:: 2016.11.... | python | def list_groups(name):
'''
Return a list of groups the named user belongs to.
name
The name of the user for which to list groups. Starting in Salt 2016.11.0,
all groups for the user, including groups beginning with an underscore
will be listed.
.. versionchanged:: 2016.11.... | [
"def",
"list_groups",
"(",
"name",
")",
":",
"groups",
"=",
"[",
"group",
"for",
"group",
"in",
"salt",
".",
"utils",
".",
"user",
".",
"get_group_list",
"(",
"name",
")",
"]",
"return",
"groups"
] | Return a list of groups the named user belongs to.
name
The name of the user for which to list groups. Starting in Salt 2016.11.0,
all groups for the user, including groups beginning with an underscore
will be listed.
.. versionchanged:: 2016.11.0
CLI Example:
.. code-bl... | [
"Return",
"a",
"list",
"of",
"groups",
"the",
"named",
"user",
"belongs",
"to",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L437-L456 |
35,192 | saltstack/salt | salt/modules/apf.py | __apf_cmd | def __apf_cmd(cmd):
'''
Return the apf location
'''
apf_cmd = '{0} {1}'.format(salt.utils.path.which('apf'), cmd)
out = __salt__['cmd.run_all'](apf_cmd)
if out['retcode'] != 0:
if not out['stderr']:
msg = out['stdout']
else:
msg = out['stderr']
ra... | python | def __apf_cmd(cmd):
'''
Return the apf location
'''
apf_cmd = '{0} {1}'.format(salt.utils.path.which('apf'), cmd)
out = __salt__['cmd.run_all'](apf_cmd)
if out['retcode'] != 0:
if not out['stderr']:
msg = out['stdout']
else:
msg = out['stderr']
ra... | [
"def",
"__apf_cmd",
"(",
"cmd",
")",
":",
"apf_cmd",
"=",
"'{0} {1}'",
".",
"format",
"(",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'apf'",
")",
",",
"cmd",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"apf_cmd",
")",
... | Return the apf location | [
"Return",
"the",
"apf",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apf.py#L39-L54 |
35,193 | saltstack/salt | salt/modules/apf.py | _status_apf | def _status_apf():
'''
Return True if apf is running otherwise return False
'''
status = 0
table = iptc.Table(iptc.Table.FILTER)
for chain in table.chains:
if 'sanity' in chain.name.lower():
status = 1
return True if status else False | python | def _status_apf():
'''
Return True if apf is running otherwise return False
'''
status = 0
table = iptc.Table(iptc.Table.FILTER)
for chain in table.chains:
if 'sanity' in chain.name.lower():
status = 1
return True if status else False | [
"def",
"_status_apf",
"(",
")",
":",
"status",
"=",
"0",
"table",
"=",
"iptc",
".",
"Table",
"(",
"iptc",
".",
"Table",
".",
"FILTER",
")",
"for",
"chain",
"in",
"table",
".",
"chains",
":",
"if",
"'sanity'",
"in",
"chain",
".",
"name",
".",
"lower... | Return True if apf is running otherwise return False | [
"Return",
"True",
"if",
"apf",
"is",
"running",
"otherwise",
"return",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apf.py#L57-L66 |
35,194 | saltstack/salt | salt/modules/composer.py | did_composer_install | def did_composer_install(dir):
'''
Test to see if the vendor directory exists in this directory
dir
Directory location of the composer.json file
CLI Example:
.. code-block:: bash
salt '*' composer.did_composer_install /var/www/application
'''
lockFile = "{0}/vendor".forma... | python | def did_composer_install(dir):
'''
Test to see if the vendor directory exists in this directory
dir
Directory location of the composer.json file
CLI Example:
.. code-block:: bash
salt '*' composer.did_composer_install /var/www/application
'''
lockFile = "{0}/vendor".forma... | [
"def",
"did_composer_install",
"(",
"dir",
")",
":",
"lockFile",
"=",
"\"{0}/vendor\"",
".",
"format",
"(",
"dir",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"lockFile",
")",
":",
"return",
"True",
"return",
"False"
] | Test to see if the vendor directory exists in this directory
dir
Directory location of the composer.json file
CLI Example:
.. code-block:: bash
salt '*' composer.did_composer_install /var/www/application | [
"Test",
"to",
"see",
"if",
"the",
"vendor",
"directory",
"exists",
"in",
"this",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L44-L60 |
35,195 | saltstack/salt | salt/modules/composer.py | _run_composer | def _run_composer(action,
directory=None,
composer=None,
php=None,
runas=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimiz... | python | def _run_composer(action,
directory=None,
composer=None,
php=None,
runas=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimiz... | [
"def",
"_run_composer",
"(",
"action",
",",
"directory",
"=",
"None",
",",
"composer",
"=",
"None",
",",
"php",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"prefer_source",
"=",
"None",
",",
"prefer_dist",
"=",
"None",
",",
"no_scripts",
"=",
"None",
... | Run PHP's composer with a specific action.
If composer has not been installed globally making it available in the
system PATH & making it executable, the ``composer`` and ``php`` parameters
will need to be set to the location of the executables.
action
The action to pass to composer ('install'... | [
"Run",
"PHP",
"s",
"composer",
"with",
"a",
"specific",
"action",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L63-L209 |
35,196 | saltstack/salt | salt/modules/composer.py | install | def install(directory,
composer=None,
php=None,
runas=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimize=None,
no_dev=None,
quiet=False,
composer_home='... | python | def install(directory,
composer=None,
php=None,
runas=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
no_plugins=None,
optimize=None,
no_dev=None,
quiet=False,
composer_home='... | [
"def",
"install",
"(",
"directory",
",",
"composer",
"=",
"None",
",",
"php",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"prefer_source",
"=",
"None",
",",
"prefer_dist",
"=",
"None",
",",
"no_scripts",
"=",
"None",
",",
"no_plugins",
"=",
"None",
",... | Install composer dependencies for a directory.
If composer has not been installed globally making it available in the
system PATH & making it executable, the ``composer`` and ``php`` parameters
will need to be set to the location of the executables.
directory
Directory location of the composer... | [
"Install",
"composer",
"dependencies",
"for",
"a",
"directory",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L212-L297 |
35,197 | saltstack/salt | salt/modules/composer.py | selfupdate | def selfupdate(composer=None,
php=None,
runas=None,
quiet=False,
composer_home='/root'):
'''
Update composer itself.
If composer has not been installed globally making it available in the
system PATH & making it executable, the ``composer`` and ``php`` pa... | python | def selfupdate(composer=None,
php=None,
runas=None,
quiet=False,
composer_home='/root'):
'''
Update composer itself.
If composer has not been installed globally making it available in the
system PATH & making it executable, the ``composer`` and ``php`` pa... | [
"def",
"selfupdate",
"(",
"composer",
"=",
"None",
",",
"php",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"composer_home",
"=",
"'/root'",
")",
":",
"result",
"=",
"_run_composer",
"(",
"'selfupdate'",
",",
"extra_flags",
"=... | Update composer itself.
If composer has not been installed globally making it available in the
system PATH & making it executable, the ``composer`` and ``php`` parameters
will need to be set to the location of the executables.
composer
Location of the composer.phar file. If not set composer wi... | [
"Update",
"composer",
"itself",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L392-L435 |
35,198 | saltstack/salt | salt/runners/saltutil.py | sync_all | def sync_all(saltenv='base', extmod_whitelist=None, extmod_blacklist=None):
'''
Sync all custom types
saltenv : base
The fileserver environment from which to sync. To sync from more than
one environment, pass a comma-separated list.
extmod_whitelist : None
dictionary of modules... | python | def sync_all(saltenv='base', extmod_whitelist=None, extmod_blacklist=None):
'''
Sync all custom types
saltenv : base
The fileserver environment from which to sync. To sync from more than
one environment, pass a comma-separated list.
extmod_whitelist : None
dictionary of modules... | [
"def",
"sync_all",
"(",
"saltenv",
"=",
"'base'",
",",
"extmod_whitelist",
"=",
"None",
",",
"extmod_blacklist",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'Syncing all'",
")",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'clouds'",
"]",
"=",
"sync_clouds",... | Sync all custom types
saltenv : base
The fileserver environment from which to sync. To sync from more than
one environment, pass a comma-separated list.
extmod_whitelist : None
dictionary of modules to sync based on type
extmod_blacklist : None
dictionary of modules to bla... | [
"Sync",
"all",
"custom",
"types"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/saltutil.py#L20-L68 |
35,199 | saltstack/salt | salt/cloud/clouds/packet.py | avail_images | def avail_images(call=None):
'''
Return available Packet os images.
CLI Example:
.. code-block:: bash
salt-cloud --list-images packet-provider
salt-cloud -f avail_images packet-provider
'''
if call == 'action':
raise SaltCloudException(
'The avail_images fu... | python | def avail_images(call=None):
'''
Return available Packet os images.
CLI Example:
.. code-block:: bash
salt-cloud --list-images packet-provider
salt-cloud -f avail_images packet-provider
'''
if call == 'action':
raise SaltCloudException(
'The avail_images fu... | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudException",
"(",
"'The avail_images function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"vm_",
"=",
"get_configured_provider",
... | Return available Packet os images.
CLI Example:
.. code-block:: bash
salt-cloud --list-images packet-provider
salt-cloud -f avail_images packet-provider | [
"Return",
"available",
"Packet",
"os",
"images",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L117-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.