partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | winrm_cmd | Wrapper for commands to be run against Windows boxes using WinRM. | salt/utils/cloud.py | def winrm_cmd(session, command, flags, **kwargs):
'''
Wrapper for commands to be run against Windows boxes using WinRM.
'''
log.debug('Executing WinRM command: %s %s', command, flags)
# rebuild the session to ensure we haven't timed out
session.protocol.transport.build_session()
r = session.... | def winrm_cmd(session, command, flags, **kwargs):
'''
Wrapper for commands to be run against Windows boxes using WinRM.
'''
log.debug('Executing WinRM command: %s %s', command, flags)
# rebuild the session to ensure we haven't timed out
session.protocol.transport.build_session()
r = session.... | [
"Wrapper",
"for",
"commands",
"to",
"be",
"run",
"against",
"Windows",
"boxes",
"using",
"WinRM",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2305-L2313 | [
"def",
"winrm_cmd",
"(",
"session",
",",
"command",
",",
"flags",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Executing WinRM command: %s %s'",
",",
"command",
",",
"flags",
")",
"# rebuild the session to ensure we haven't timed out",
"session",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | root_cmd | Wrapper for commands to be run as root | salt/utils/cloud.py | def root_cmd(command, tty, sudo, allow_failure=False, **kwargs):
'''
Wrapper for commands to be run as root
'''
logging_command = command
sudo_password = kwargs.get('sudo_password', None)
if sudo:
if sudo_password is None:
command = 'sudo {0}'.format(command)
log... | def root_cmd(command, tty, sudo, allow_failure=False, **kwargs):
'''
Wrapper for commands to be run as root
'''
logging_command = command
sudo_password = kwargs.get('sudo_password', None)
if sudo:
if sudo_password is None:
command = 'sudo {0}'.format(command)
log... | [
"Wrapper",
"for",
"commands",
"to",
"be",
"run",
"as",
"root"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2316-L2392 | [
"def",
"root_cmd",
"(",
"command",
",",
"tty",
",",
"sudo",
",",
"allow_failure",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"logging_command",
"=",
"command",
"sudo_password",
"=",
"kwargs",
".",
"get",
"(",
"'sudo_password'",
",",
"None",
")",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_auth | This function is called from a multiprocess instance, to wait for a minion
to become available to receive salt commands | salt/utils/cloud.py | def check_auth(name, sock_dir=None, queue=None, timeout=300):
'''
This function is called from a multiprocess instance, to wait for a minion
to become available to receive salt commands
'''
event = salt.utils.event.SaltEvent('master', sock_dir, listen=True)
starttime = time.mktime(time.localtime... | def check_auth(name, sock_dir=None, queue=None, timeout=300):
'''
This function is called from a multiprocess instance, to wait for a minion
to become available to receive salt commands
'''
event = salt.utils.event.SaltEvent('master', sock_dir, listen=True)
starttime = time.mktime(time.localtime... | [
"This",
"function",
"is",
"called",
"from",
"a",
"multiprocess",
"instance",
"to",
"wait",
"for",
"a",
"minion",
"to",
"become",
"available",
"to",
"receive",
"salt",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2395-L2412 | [
"def",
"check_auth",
"(",
"name",
",",
"sock_dir",
"=",
"None",
",",
"queue",
"=",
"None",
",",
"timeout",
"=",
"300",
")",
":",
"event",
"=",
"salt",
".",
"utils",
".",
"event",
".",
"SaltEvent",
"(",
"'master'",
",",
"sock_dir",
",",
"listen",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ip_to_int | Converts an IP address to an integer | salt/utils/cloud.py | def ip_to_int(ip):
'''
Converts an IP address to an integer
'''
ret = 0
for octet in ip.split('.'):
ret = ret * 256 + int(octet)
return ret | def ip_to_int(ip):
'''
Converts an IP address to an integer
'''
ret = 0
for octet in ip.split('.'):
ret = ret * 256 + int(octet)
return ret | [
"Converts",
"an",
"IP",
"address",
"to",
"an",
"integer"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2415-L2422 | [
"def",
"ip_to_int",
"(",
"ip",
")",
":",
"ret",
"=",
"0",
"for",
"octet",
"in",
"ip",
".",
"split",
"(",
"'.'",
")",
":",
"ret",
"=",
"ret",
"*",
"256",
"+",
"int",
"(",
"octet",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_public_ip | Determines whether an IP address falls within one of the private IP ranges | salt/utils/cloud.py | def is_public_ip(ip):
'''
Determines whether an IP address falls within one of the private IP ranges
'''
if ':' in ip:
# ipv6
if ip.startswith('fe80:'):
# ipv6 link local
return False
return True
addr = ip_to_int(ip)
if 167772160 < addr < 184549375... | def is_public_ip(ip):
'''
Determines whether an IP address falls within one of the private IP ranges
'''
if ':' in ip:
# ipv6
if ip.startswith('fe80:'):
# ipv6 link local
return False
return True
addr = ip_to_int(ip)
if 167772160 < addr < 184549375... | [
"Determines",
"whether",
"an",
"IP",
"address",
"falls",
"within",
"one",
"of",
"the",
"private",
"IP",
"ranges"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2425-L2448 | [
"def",
"is_public_ip",
"(",
"ip",
")",
":",
"if",
"':'",
"in",
"ip",
":",
"# ipv6",
"if",
"ip",
".",
"startswith",
"(",
"'fe80:'",
")",
":",
"# ipv6 link local",
"return",
"False",
"return",
"True",
"addr",
"=",
"ip_to_int",
"(",
"ip",
")",
"if",
"1677... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_name | Check whether the specified name contains invalid characters | salt/utils/cloud.py | def check_name(name, safe_chars):
'''
Check whether the specified name contains invalid characters
'''
regexp = re.compile('[^{0}]'.format(safe_chars))
if regexp.search(name):
raise SaltCloudException(
'{0} contains characters not supported by this cloud provider. '
'... | def check_name(name, safe_chars):
'''
Check whether the specified name contains invalid characters
'''
regexp = re.compile('[^{0}]'.format(safe_chars))
if regexp.search(name):
raise SaltCloudException(
'{0} contains characters not supported by this cloud provider. '
'... | [
"Check",
"whether",
"the",
"specified",
"name",
"contains",
"invalid",
"characters"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2451-L2462 | [
"def",
"check_name",
"(",
"name",
",",
"safe_chars",
")",
":",
"regexp",
"=",
"re",
".",
"compile",
"(",
"'[^{0}]'",
".",
"format",
"(",
"safe_chars",
")",
")",
"if",
"regexp",
".",
"search",
"(",
"name",
")",
":",
"raise",
"SaltCloudException",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_sshkey | Remove a host from the known_hosts file | salt/utils/cloud.py | def remove_sshkey(host, known_hosts=None):
'''
Remove a host from the known_hosts file
'''
if known_hosts is None:
if 'HOME' in os.environ:
known_hosts = '{0}/.ssh/known_hosts'.format(os.environ['HOME'])
else:
try:
known_hosts = '{0}/.ssh/known_hos... | def remove_sshkey(host, known_hosts=None):
'''
Remove a host from the known_hosts file
'''
if known_hosts is None:
if 'HOME' in os.environ:
known_hosts = '{0}/.ssh/known_hosts'.format(os.environ['HOME'])
else:
try:
known_hosts = '{0}/.ssh/known_hos... | [
"Remove",
"a",
"host",
"from",
"the",
"known_hosts",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2465-L2489 | [
"def",
"remove_sshkey",
"(",
"host",
",",
"known_hosts",
"=",
"None",
")",
":",
"if",
"known_hosts",
"is",
"None",
":",
"if",
"'HOME'",
"in",
"os",
".",
"environ",
":",
"known_hosts",
"=",
"'{0}/.ssh/known_hosts'",
".",
"format",
"(",
"os",
".",
"environ",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes_select | Return a list of the VMs that are on the provider, with select fields | salt/utils/cloud.py | def list_nodes_select(nodes, selection, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_select function must be called '
'with -f or --function.'
)
if 'e... | def list_nodes_select(nodes, selection, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_select function must be called '
'with -f or --function.'
)
if 'e... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider",
"with",
"select",
"fields"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2565-L2592 | [
"def",
"list_nodes_select",
"(",
"nodes",
",",
"selection",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_select function must be called '",
"'with -f or --function.'",
")",
"if",
"'error... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lock_file | Lock a file; if it is already locked, then wait for it to become available
before locking it.
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms. | salt/utils/cloud.py | def lock_file(filename, interval=.5, timeout=15):
'''
Lock a file; if it is already locked, then wait for it to become available
before locking it.
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms.
'''
log.trace('Attempting to obtain lock for %s',... | def lock_file(filename, interval=.5, timeout=15):
'''
Lock a file; if it is already locked, then wait for it to become available
before locking it.
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms.
'''
log.trace('Attempting to obtain lock for %s',... | [
"Lock",
"a",
"file",
";",
"if",
"it",
"is",
"already",
"locked",
"then",
"wait",
"for",
"it",
"to",
"become",
"available",
"before",
"locking",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2595-L2616 | [
"def",
"lock_file",
"(",
"filename",
",",
"interval",
"=",
".5",
",",
"timeout",
"=",
"15",
")",
":",
"log",
".",
"trace",
"(",
"'Attempting to obtain lock for %s'",
",",
"filename",
")",
"lock",
"=",
"filename",
"+",
"'.lock'",
"start",
"=",
"time",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unlock_file | Unlock a locked file
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms. | salt/utils/cloud.py | def unlock_file(filename):
'''
Unlock a locked file
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms.
'''
log.trace('Removing lock for %s', filename)
lock = filename + '.lock'
try:
os.remove(lock)
except OSError as exc:
log... | def unlock_file(filename):
'''
Unlock a locked file
Note that these locks are only recognized by Salt Cloud, and not other
programs or platforms.
'''
log.trace('Removing lock for %s', filename)
lock = filename + '.lock'
try:
os.remove(lock)
except OSError as exc:
log... | [
"Unlock",
"a",
"locked",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2619-L2631 | [
"def",
"unlock_file",
"(",
"filename",
")",
":",
"log",
".",
"trace",
"(",
"'Removing lock for %s'",
",",
"filename",
")",
"lock",
"=",
"filename",
"+",
"'.lock'",
"try",
":",
"os",
".",
"remove",
"(",
"lock",
")",
"except",
"OSError",
"as",
"exc",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cachedir_index_add | Add an entry to the cachedir index. This generally only needs to happen when
a new instance is created. This entry should contain:
.. code-block:: yaml
- minion_id
- profile used to create the instance
- provider and driver name
The intent of this function is to speed up lookups f... | salt/utils/cloud.py | def cachedir_index_add(minion_id, profile, driver, provider, base=None):
'''
Add an entry to the cachedir index. This generally only needs to happen when
a new instance is created. This entry should contain:
.. code-block:: yaml
- minion_id
- profile used to create the instance
... | def cachedir_index_add(minion_id, profile, driver, provider, base=None):
'''
Add an entry to the cachedir index. This generally only needs to happen when
a new instance is created. This entry should contain:
.. code-block:: yaml
- minion_id
- profile used to create the instance
... | [
"Add",
"an",
"entry",
"to",
"the",
"cachedir",
"index",
".",
"This",
"generally",
"only",
"needs",
"to",
"happen",
"when",
"a",
"new",
"instance",
"is",
"created",
".",
"This",
"entry",
"should",
"contain",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2634-L2677 | [
"def",
"cachedir_index_add",
"(",
"minion_id",
",",
"profile",
",",
"driver",
",",
"provider",
",",
"base",
"=",
"None",
")",
":",
"base",
"=",
"init_cachedir",
"(",
"base",
")",
"index_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"'in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cachedir_index_del | Delete an entry from the cachedir index. This generally only needs to happen
when an instance is deleted. | salt/utils/cloud.py | def cachedir_index_del(minion_id, base=None):
'''
Delete an entry from the cachedir index. This generally only needs to happen
when an instance is deleted.
'''
base = init_cachedir(base)
index_file = os.path.join(base, 'index.p')
lock_file(index_file)
if os.path.exists(index_file):
... | def cachedir_index_del(minion_id, base=None):
'''
Delete an entry from the cachedir index. This generally only needs to happen
when an instance is deleted.
'''
base = init_cachedir(base)
index_file = os.path.join(base, 'index.p')
lock_file(index_file)
if os.path.exists(index_file):
... | [
"Delete",
"an",
"entry",
"from",
"the",
"cachedir",
"index",
".",
"This",
"generally",
"only",
"needs",
"to",
"happen",
"when",
"an",
"instance",
"is",
"deleted",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2680-L2704 | [
"def",
"cachedir_index_del",
"(",
"minion_id",
",",
"base",
"=",
"None",
")",
":",
"base",
"=",
"init_cachedir",
"(",
"base",
")",
"index_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"'index.p'",
")",
"lock_file",
"(",
"index_file",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init_cachedir | Initialize the cachedir needed for Salt Cloud to keep track of minions | salt/utils/cloud.py | def init_cachedir(base=None):
'''
Initialize the cachedir needed for Salt Cloud to keep track of minions
'''
if base is None:
base = __opts__['cachedir']
needed_dirs = (base,
os.path.join(base, 'requested'),
os.path.join(base, 'active'))
for dir_ in ... | def init_cachedir(base=None):
'''
Initialize the cachedir needed for Salt Cloud to keep track of minions
'''
if base is None:
base = __opts__['cachedir']
needed_dirs = (base,
os.path.join(base, 'requested'),
os.path.join(base, 'active'))
for dir_ in ... | [
"Initialize",
"the",
"cachedir",
"needed",
"for",
"Salt",
"Cloud",
"to",
"keep",
"track",
"of",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2707-L2721 | [
"def",
"init_cachedir",
"(",
"base",
"=",
"None",
")",
":",
"if",
"base",
"is",
"None",
":",
"base",
"=",
"__opts__",
"[",
"'cachedir'",
"]",
"needed_dirs",
"=",
"(",
"base",
",",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"'requested'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | request_minion_cachedir | Creates an entry in the requested/ cachedir. This means that Salt Cloud has
made a request to a cloud provider to create an instance, but it has not
yet verified that the instance properly exists.
If the fingerprint is unknown, a raw pubkey can be passed in, and a
fingerprint will be calculated. If bot... | salt/utils/cloud.py | def request_minion_cachedir(
minion_id,
opts=None,
fingerprint='',
pubkey=None,
provider=None,
base=None,
):
'''
Creates an entry in the requested/ cachedir. This means that Salt Cloud has
made a request to a cloud provider to create an instance, but it has no... | def request_minion_cachedir(
minion_id,
opts=None,
fingerprint='',
pubkey=None,
provider=None,
base=None,
):
'''
Creates an entry in the requested/ cachedir. This means that Salt Cloud has
made a request to a cloud provider to create an instance, but it has no... | [
"Creates",
"an",
"entry",
"in",
"the",
"requested",
"/",
"cachedir",
".",
"This",
"means",
"that",
"Salt",
"Cloud",
"has",
"made",
"a",
"request",
"to",
"a",
"cloud",
"provider",
"to",
"create",
"an",
"instance",
"but",
"it",
"has",
"not",
"yet",
"verifi... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2725-L2760 | [
"def",
"request_minion_cachedir",
"(",
"minion_id",
",",
"opts",
"=",
"None",
",",
"fingerprint",
"=",
"''",
",",
"pubkey",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"base",
"=",
"None",
",",
")",
":",
"if",
"base",
"is",
"None",
":",
"base",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | change_minion_cachedir | Changes the info inside a minion's cachedir entry. The type of cachedir
must be specified (i.e., 'requested' or 'active'). A dict is also passed in
which contains the data to be changed.
Example:
change_minion_cachedir(
'myminion',
'requested',
{'fingerprint': '... | salt/utils/cloud.py | def change_minion_cachedir(
minion_id,
cachedir,
data=None,
base=None,
):
'''
Changes the info inside a minion's cachedir entry. The type of cachedir
must be specified (i.e., 'requested' or 'active'). A dict is also passed in
which contains the data to be changed.
Ex... | def change_minion_cachedir(
minion_id,
cachedir,
data=None,
base=None,
):
'''
Changes the info inside a minion's cachedir entry. The type of cachedir
must be specified (i.e., 'requested' or 'active'). A dict is also passed in
which contains the data to be changed.
Ex... | [
"Changes",
"the",
"info",
"inside",
"a",
"minion",
"s",
"cachedir",
"entry",
".",
"The",
"type",
"of",
"cachedir",
"must",
"be",
"specified",
"(",
"i",
".",
"e",
".",
"requested",
"or",
"active",
")",
".",
"A",
"dict",
"is",
"also",
"passed",
"in",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2763-L2798 | [
"def",
"change_minion_cachedir",
"(",
"minion_id",
",",
"cachedir",
",",
"data",
"=",
"None",
",",
"base",
"=",
"None",
",",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"return",
"False",
"if",
"base",
"is",
"None",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | activate_minion_cachedir | Moves a minion from the requested/ cachedir into the active/ cachedir. This
means that Salt Cloud has verified that a requested instance properly
exists, and should be expected to exist from here on out. | salt/utils/cloud.py | def activate_minion_cachedir(minion_id, base=None):
'''
Moves a minion from the requested/ cachedir into the active/ cachedir. This
means that Salt Cloud has verified that a requested instance properly
exists, and should be expected to exist from here on out.
'''
if base is None:
base = ... | def activate_minion_cachedir(minion_id, base=None):
'''
Moves a minion from the requested/ cachedir into the active/ cachedir. This
means that Salt Cloud has verified that a requested instance properly
exists, and should be expected to exist from here on out.
'''
if base is None:
base = ... | [
"Moves",
"a",
"minion",
"from",
"the",
"requested",
"/",
"cachedir",
"into",
"the",
"active",
"/",
"cachedir",
".",
"This",
"means",
"that",
"Salt",
"Cloud",
"has",
"verified",
"that",
"a",
"requested",
"instance",
"properly",
"exists",
"and",
"should",
"be"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2801-L2813 | [
"def",
"activate_minion_cachedir",
"(",
"minion_id",
",",
"base",
"=",
"None",
")",
":",
"if",
"base",
"is",
"None",
":",
"base",
"=",
"__opts__",
"[",
"'cachedir'",
"]",
"fname",
"=",
"'{0}.p'",
".",
"format",
"(",
"minion_id",
")",
"src",
"=",
"os",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_minion_cachedir | Deletes a minion's entry from the cloud cachedir. It will search through
all cachedirs to find the minion's cache file.
Needs `update_cachedir` set to True. | salt/utils/cloud.py | def delete_minion_cachedir(minion_id, provider, opts, base=None):
'''
Deletes a minion's entry from the cloud cachedir. It will search through
all cachedirs to find the minion's cache file.
Needs `update_cachedir` set to True.
'''
if isinstance(opts, dict):
__opts__.update(opts)
if ... | def delete_minion_cachedir(minion_id, provider, opts, base=None):
'''
Deletes a minion's entry from the cloud cachedir. It will search through
all cachedirs to find the minion's cache file.
Needs `update_cachedir` set to True.
'''
if isinstance(opts, dict):
__opts__.update(opts)
if ... | [
"Deletes",
"a",
"minion",
"s",
"entry",
"from",
"the",
"cloud",
"cachedir",
".",
"It",
"will",
"search",
"through",
"all",
"cachedirs",
"to",
"find",
"the",
"minion",
"s",
"cache",
"file",
".",
"Needs",
"update_cachedir",
"set",
"to",
"True",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2816-L2837 | [
"def",
"delete_minion_cachedir",
"(",
"minion_id",
",",
"provider",
",",
"opts",
",",
"base",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"opts",
",",
"dict",
")",
":",
"__opts__",
".",
"update",
"(",
"opts",
")",
"if",
"__opts__",
".",
"get",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_cache_nodes_full | Return a list of minion data from the cloud cache, rather from the cloud
providers themselves. This is the cloud cache version of list_nodes_full(). | salt/utils/cloud.py | def list_cache_nodes_full(opts=None, provider=None, base=None):
'''
Return a list of minion data from the cloud cache, rather from the cloud
providers themselves. This is the cloud cache version of list_nodes_full().
'''
if opts is None:
opts = __opts__
if opts.get('update_cachedir', Fal... | def list_cache_nodes_full(opts=None, provider=None, base=None):
'''
Return a list of minion data from the cloud cache, rather from the cloud
providers themselves. This is the cloud cache version of list_nodes_full().
'''
if opts is None:
opts = __opts__
if opts.get('update_cachedir', Fal... | [
"Return",
"a",
"list",
"of",
"minion",
"data",
"from",
"the",
"cloud",
"cache",
"rather",
"from",
"the",
"cloud",
"providers",
"themselves",
".",
"This",
"is",
"the",
"cloud",
"cache",
"version",
"of",
"list_nodes_full",
"()",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2840-L2875 | [
"def",
"list_cache_nodes_full",
"(",
"opts",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"base",
"=",
"None",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"__opts__",
"if",
"opts",
".",
"get",
"(",
"'update_cachedir'",
",",
"False",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_bootstrap | Update the salt-bootstrap script
url can be one of:
- The URL to fetch the bootstrap script from
- The absolute path to the bootstrap
- The content of the bootstrap script | salt/utils/cloud.py | def update_bootstrap(config, url=None):
'''
Update the salt-bootstrap script
url can be one of:
- The URL to fetch the bootstrap script from
- The absolute path to the bootstrap
- The content of the bootstrap script
'''
default_url = config.get('bootstrap_script_url',
... | def update_bootstrap(config, url=None):
'''
Update the salt-bootstrap script
url can be one of:
- The URL to fetch the bootstrap script from
- The absolute path to the bootstrap
- The content of the bootstrap script
'''
default_url = config.get('bootstrap_script_url',
... | [
"Update",
"the",
"salt",
"-",
"bootstrap",
"script"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L2878-L3007 | [
"def",
"update_bootstrap",
"(",
"config",
",",
"url",
"=",
"None",
")",
":",
"default_url",
"=",
"config",
".",
"get",
"(",
"'bootstrap_script_url'",
",",
"'https://bootstrap.saltstack.com'",
")",
"if",
"not",
"url",
":",
"url",
"=",
"default_url",
"if",
"not"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_node_list | If configured to do so, update the cloud cachedir with the current list of
nodes. Also fires configured events pertaining to the node list.
.. versionadded:: 2014.7.0 | salt/utils/cloud.py | def cache_node_list(nodes, provider, opts):
'''
If configured to do so, update the cloud cachedir with the current list of
nodes. Also fires configured events pertaining to the node list.
.. versionadded:: 2014.7.0
'''
if 'update_cachedir' not in opts or not opts['update_cachedir']:
ret... | def cache_node_list(nodes, provider, opts):
'''
If configured to do so, update the cloud cachedir with the current list of
nodes. Also fires configured events pertaining to the node list.
.. versionadded:: 2014.7.0
'''
if 'update_cachedir' not in opts or not opts['update_cachedir']:
ret... | [
"If",
"configured",
"to",
"do",
"so",
"update",
"the",
"cloud",
"cachedir",
"with",
"the",
"current",
"list",
"of",
"nodes",
".",
"Also",
"fires",
"configured",
"events",
"pertaining",
"to",
"the",
"node",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3010-L3034 | [
"def",
"cache_node_list",
"(",
"nodes",
",",
"provider",
",",
"opts",
")",
":",
"if",
"'update_cachedir'",
"not",
"in",
"opts",
"or",
"not",
"opts",
"[",
"'update_cachedir'",
"]",
":",
"return",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"init_cac... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cache_node | Cache node individually
.. versionadded:: 2014.7.0 | salt/utils/cloud.py | def cache_node(node, provider, opts):
'''
Cache node individually
.. versionadded:: 2014.7.0
'''
if isinstance(opts, dict):
__opts__.update(opts)
if 'update_cachedir' not in __opts__ or not __opts__['update_cachedir']:
return
if not os.path.exists(os.path.join(__opts__['ca... | def cache_node(node, provider, opts):
'''
Cache node individually
.. versionadded:: 2014.7.0
'''
if isinstance(opts, dict):
__opts__.update(opts)
if 'update_cachedir' not in __opts__ or not __opts__['update_cachedir']:
return
if not os.path.exists(os.path.join(__opts__['ca... | [
"Cache",
"node",
"individually"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3037-L3060 | [
"def",
"cache_node",
"(",
"node",
",",
"provider",
",",
"opts",
")",
":",
"if",
"isinstance",
"(",
"opts",
",",
"dict",
")",
":",
"__opts__",
".",
"update",
"(",
"opts",
")",
"if",
"'update_cachedir'",
"not",
"in",
"__opts__",
"or",
"not",
"__opts__",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | missing_node_cache | Check list of nodes to see if any nodes which were previously known about
in the cache have been removed from the node list.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/salt/cloud).
.. code-block:: yaml
diff_cache_events: True
... | salt/utils/cloud.py | def missing_node_cache(prov_dir, node_list, provider, opts):
'''
Check list of nodes to see if any nodes which were previously known about
in the cache have been removed from the node list.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/s... | def missing_node_cache(prov_dir, node_list, provider, opts):
'''
Check list of nodes to see if any nodes which were previously known about
in the cache have been removed from the node list.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/s... | [
"Check",
"list",
"of",
"nodes",
"to",
"see",
"if",
"any",
"nodes",
"which",
"were",
"previously",
"known",
"about",
"in",
"the",
"cache",
"have",
"been",
"removed",
"from",
"the",
"node",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3063-L3094 | [
"def",
"missing_node_cache",
"(",
"prov_dir",
",",
"node_list",
",",
"provider",
",",
"opts",
")",
":",
"cached_nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"os",
".",
"listdir",
"(",
"prov_dir",
")",
":",
"cached_nodes",
".",
"append",
"(",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | diff_node_cache | Check new node data against current cache. If data differ, fire an event
which consists of the new node data.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/salt/cloud).
.. code-block:: yaml
diff_cache_events: True
.. versionad... | salt/utils/cloud.py | def diff_node_cache(prov_dir, node, new_data, opts):
'''
Check new node data against current cache. If data differ, fire an event
which consists of the new node data.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/salt/cloud).
.. cod... | def diff_node_cache(prov_dir, node, new_data, opts):
'''
Check new node data against current cache. If data differ, fire an event
which consists of the new node data.
This function will only run if configured to do so in the main Salt Cloud
configuration file (normally /etc/salt/cloud).
.. cod... | [
"Check",
"new",
"node",
"data",
"against",
"current",
"cache",
".",
"If",
"data",
"differ",
"fire",
"an",
"event",
"which",
"consists",
"of",
"the",
"new",
"node",
"data",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3097-L3158 | [
"def",
"diff_node_cache",
"(",
"prov_dir",
",",
"node",
",",
"new_data",
",",
"opts",
")",
":",
"if",
"'diff_cache_events'",
"not",
"in",
"opts",
"or",
"not",
"opts",
"[",
"'diff_cache_events'",
"]",
":",
"return",
"if",
"node",
"is",
"None",
":",
"return"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _strip_cache_events | Strip out user-configured sensitive event data. The fields to be stripped
are configured in the main Salt Cloud configuration file, usually
``/etc/salt/cloud``.
.. code-block: yaml
cache_event_strip_fields:
- password
- priv_key
.. versionadded:: 2014.7.0 | salt/utils/cloud.py | def _strip_cache_events(data, opts):
'''
Strip out user-configured sensitive event data. The fields to be stripped
are configured in the main Salt Cloud configuration file, usually
``/etc/salt/cloud``.
.. code-block: yaml
cache_event_strip_fields:
- password
- priv_key
... | def _strip_cache_events(data, opts):
'''
Strip out user-configured sensitive event data. The fields to be stripped
are configured in the main Salt Cloud configuration file, usually
``/etc/salt/cloud``.
.. code-block: yaml
cache_event_strip_fields:
- password
- priv_key
... | [
"Strip",
"out",
"user",
"-",
"configured",
"sensitive",
"event",
"data",
".",
"The",
"fields",
"to",
"be",
"stripped",
"are",
"configured",
"in",
"the",
"main",
"Salt",
"Cloud",
"configuration",
"file",
"usually",
"/",
"etc",
"/",
"salt",
"/",
"cloud",
"."... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3161-L3181 | [
"def",
"_strip_cache_events",
"(",
"data",
",",
"opts",
")",
":",
"event_data",
"=",
"copy",
".",
"deepcopy",
"(",
"data",
")",
"strip_fields",
"=",
"opts",
".",
"get",
"(",
"'cache_event_strip_fields'",
",",
"[",
"]",
")",
"for",
"field",
"in",
"strip_fie... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _salt_cloud_force_ascii | Helper method to try its best to convert any Unicode text into ASCII
without stack tracing since salt internally does not handle Unicode strings
This method is not supposed to be used directly. Once
`py:module: salt.utils.cloud` is imported this method register's with
python's codecs module for proper ... | salt/utils/cloud.py | def _salt_cloud_force_ascii(exc):
'''
Helper method to try its best to convert any Unicode text into ASCII
without stack tracing since salt internally does not handle Unicode strings
This method is not supposed to be used directly. Once
`py:module: salt.utils.cloud` is imported this method register... | def _salt_cloud_force_ascii(exc):
'''
Helper method to try its best to convert any Unicode text into ASCII
without stack tracing since salt internally does not handle Unicode strings
This method is not supposed to be used directly. Once
`py:module: salt.utils.cloud` is imported this method register... | [
"Helper",
"method",
"to",
"try",
"its",
"best",
"to",
"convert",
"any",
"Unicode",
"text",
"into",
"ASCII",
"without",
"stack",
"tracing",
"since",
"salt",
"internally",
"does",
"not",
"handle",
"Unicode",
"strings"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3184-L3208 | [
"def",
"_salt_cloud_force_ascii",
"(",
"exc",
")",
":",
"if",
"not",
"isinstance",
"(",
"exc",
",",
"(",
"UnicodeEncodeError",
",",
"UnicodeTranslateError",
")",
")",
":",
"raise",
"TypeError",
"(",
"'Can\\'t handle {0}'",
".",
"format",
"(",
"exc",
")",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | retrieve_password_from_keyring | Retrieve particular user's password for a specified credential set from system keyring. | salt/utils/cloud.py | def retrieve_password_from_keyring(credential_id, username):
'''
Retrieve particular user's password for a specified credential set from system keyring.
'''
try:
import keyring # pylint: disable=import-error
return keyring.get_password(credential_id, username)
except ImportError:
... | def retrieve_password_from_keyring(credential_id, username):
'''
Retrieve particular user's password for a specified credential set from system keyring.
'''
try:
import keyring # pylint: disable=import-error
return keyring.get_password(credential_id, username)
except ImportError:
... | [
"Retrieve",
"particular",
"user",
"s",
"password",
"for",
"a",
"specified",
"credential",
"set",
"from",
"system",
"keyring",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3214-L3223 | [
"def",
"retrieve_password_from_keyring",
"(",
"credential_id",
",",
"username",
")",
":",
"try",
":",
"import",
"keyring",
"# pylint: disable=import-error",
"return",
"keyring",
".",
"get_password",
"(",
"credential_id",
",",
"username",
")",
"except",
"ImportError",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _save_password_in_keyring | Saves provider password in system keyring | salt/utils/cloud.py | def _save_password_in_keyring(credential_id, username, password):
'''
Saves provider password in system keyring
'''
try:
import keyring # pylint: disable=import-error
return keyring.set_password(credential_id, username, password)
except ImportError:
log.error('Tried to store... | def _save_password_in_keyring(credential_id, username, password):
'''
Saves provider password in system keyring
'''
try:
import keyring # pylint: disable=import-error
return keyring.set_password(credential_id, username, password)
except ImportError:
log.error('Tried to store... | [
"Saves",
"provider",
"password",
"in",
"system",
"keyring"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3226-L3235 | [
"def",
"_save_password_in_keyring",
"(",
"credential_id",
",",
"username",
",",
"password",
")",
":",
"try",
":",
"import",
"keyring",
"# pylint: disable=import-error",
"return",
"keyring",
".",
"set_password",
"(",
"credential_id",
",",
"username",
",",
"password",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | store_password_in_keyring | Interactively prompts user for a password and stores it in system keyring | salt/utils/cloud.py | def store_password_in_keyring(credential_id, username, password=None):
'''
Interactively prompts user for a password and stores it in system keyring
'''
try:
# pylint: disable=import-error
import keyring
import keyring.errors
# pylint: enable=import-error
if passw... | def store_password_in_keyring(credential_id, username, password=None):
'''
Interactively prompts user for a password and stores it in system keyring
'''
try:
# pylint: disable=import-error
import keyring
import keyring.errors
# pylint: enable=import-error
if passw... | [
"Interactively",
"prompts",
"user",
"for",
"a",
"password",
"and",
"stores",
"it",
"in",
"system",
"keyring"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3238-L3265 | [
"def",
"store_password_in_keyring",
"(",
"credential_id",
",",
"username",
",",
"password",
"=",
"None",
")",
":",
"try",
":",
"# pylint: disable=import-error",
"import",
"keyring",
"import",
"keyring",
".",
"errors",
"# pylint: enable=import-error",
"if",
"password",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _unwrap_dict | Accepts index in form of a string
Returns final value
Example: dictionary = {'a': {'b': {'c': 'foobar'}}}
index_string = 'a,b,c'
returns 'foobar' | salt/utils/cloud.py | def _unwrap_dict(dictionary, index_string):
'''
Accepts index in form of a string
Returns final value
Example: dictionary = {'a': {'b': {'c': 'foobar'}}}
index_string = 'a,b,c'
returns 'foobar'
'''
index = index_string.split(',')
for k in index:
dictionary =... | def _unwrap_dict(dictionary, index_string):
'''
Accepts index in form of a string
Returns final value
Example: dictionary = {'a': {'b': {'c': 'foobar'}}}
index_string = 'a,b,c'
returns 'foobar'
'''
index = index_string.split(',')
for k in index:
dictionary =... | [
"Accepts",
"index",
"in",
"form",
"of",
"a",
"string",
"Returns",
"final",
"value",
"Example",
":",
"dictionary",
"=",
"{",
"a",
":",
"{",
"b",
":",
"{",
"c",
":",
"foobar",
"}}}",
"index_string",
"=",
"a",
"b",
"c",
"returns",
"foobar"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3268-L3279 | [
"def",
"_unwrap_dict",
"(",
"dictionary",
",",
"index_string",
")",
":",
"index",
"=",
"index_string",
".",
"split",
"(",
"','",
")",
"for",
"k",
"in",
"index",
":",
"dictionary",
"=",
"dictionary",
"[",
"k",
"]",
"return",
"dictionary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_func_until_ret_arg | Waits until the function retrieves some required argument.
NOTE: Tested with ec2 describe_volumes and describe_snapshots only. | salt/utils/cloud.py | def run_func_until_ret_arg(fun, kwargs, fun_call=None,
argument_being_watched=None, required_argument_response=None):
'''
Waits until the function retrieves some required argument.
NOTE: Tested with ec2 describe_volumes and describe_snapshots only.
'''
status = None
wh... | def run_func_until_ret_arg(fun, kwargs, fun_call=None,
argument_being_watched=None, required_argument_response=None):
'''
Waits until the function retrieves some required argument.
NOTE: Tested with ec2 describe_volumes and describe_snapshots only.
'''
status = None
wh... | [
"Waits",
"until",
"the",
"function",
"retrieves",
"some",
"required",
"argument",
".",
"NOTE",
":",
"Tested",
"with",
"ec2",
"describe_volumes",
"and",
"describe_snapshots",
"only",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3282-L3305 | [
"def",
"run_func_until_ret_arg",
"(",
"fun",
",",
"kwargs",
",",
"fun_call",
"=",
"None",
",",
"argument_being_watched",
"=",
"None",
",",
"required_argument_response",
"=",
"None",
")",
":",
"status",
"=",
"None",
"while",
"status",
"!=",
"required_argument_respo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_salt_interface | Return the salt_interface type to connect to. Either 'public_ips' (default)
or 'private_ips'. | salt/utils/cloud.py | def get_salt_interface(vm_, opts):
'''
Return the salt_interface type to connect to. Either 'public_ips' (default)
or 'private_ips'.
'''
salt_host = salt.config.get_cloud_config_value(
'salt_interface', vm_, opts, default=False,
search_global=False
)
if salt_host is False:
... | def get_salt_interface(vm_, opts):
'''
Return the salt_interface type to connect to. Either 'public_ips' (default)
or 'private_ips'.
'''
salt_host = salt.config.get_cloud_config_value(
'salt_interface', vm_, opts, default=False,
search_global=False
)
if salt_host is False:
... | [
"Return",
"the",
"salt_interface",
"type",
"to",
"connect",
"to",
".",
"Either",
"public_ips",
"(",
"default",
")",
"or",
"private_ips",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3308-L3324 | [
"def",
"get_salt_interface",
"(",
"vm_",
",",
"opts",
")",
":",
"salt_host",
"=",
"salt",
".",
"config",
".",
"get_cloud_config_value",
"(",
"'salt_interface'",
",",
"vm_",
",",
"opts",
",",
"default",
"=",
"False",
",",
"search_global",
"=",
"False",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_key_path_and_mode | Checks that the key_path exists and the key_mode is either 0400 or 0600.
Returns True or False.
.. versionadded:: 2016.3.0
provider
The provider name that the key_path to check belongs to.
key_path
The key_path to ensure that it exists and to check adequate permissions
agains... | salt/utils/cloud.py | def check_key_path_and_mode(provider, key_path):
'''
Checks that the key_path exists and the key_mode is either 0400 or 0600.
Returns True or False.
.. versionadded:: 2016.3.0
provider
The provider name that the key_path to check belongs to.
key_path
The key_path to ensure th... | def check_key_path_and_mode(provider, key_path):
'''
Checks that the key_path exists and the key_mode is either 0400 or 0600.
Returns True or False.
.. versionadded:: 2016.3.0
provider
The provider name that the key_path to check belongs to.
key_path
The key_path to ensure th... | [
"Checks",
"that",
"the",
"key_path",
"exists",
"and",
"the",
"key_mode",
"is",
"either",
"0400",
"or",
"0600",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3327-L3357 | [
"def",
"check_key_path_and_mode",
"(",
"provider",
",",
"key_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"key_path",
")",
":",
"log",
".",
"error",
"(",
"'The key file \\'%s\\' used in the \\'%s\\' provider configuration '",
"'does not exist.\... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | userdata_template | Use the configured templating engine to template the userdata file | salt/utils/cloud.py | def userdata_template(opts, vm_, userdata):
'''
Use the configured templating engine to template the userdata file
'''
# No userdata, no need to template anything
if userdata is None:
return userdata
userdata_template = salt.config.get_cloud_config_value(
'userdata_template', vm... | def userdata_template(opts, vm_, userdata):
'''
Use the configured templating engine to template the userdata file
'''
# No userdata, no need to template anything
if userdata is None:
return userdata
userdata_template = salt.config.get_cloud_config_value(
'userdata_template', vm... | [
"Use",
"the",
"configured",
"templating",
"engine",
"to",
"template",
"the",
"userdata",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L3360-L3405 | [
"def",
"userdata_template",
"(",
"opts",
",",
"vm_",
",",
"userdata",
")",
":",
"# No userdata, no need to template anything",
"if",
"userdata",
"is",
"None",
":",
"return",
"userdata",
"userdata_template",
"=",
"salt",
".",
"config",
".",
"get_cloud_config_value",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Client.remove_service | Removes the PAExec service and executable that was created as part of
the create_service function. This does not remove any older executables
or services from previous runs, use cleanup() instead for that purpose. | salt/utils/cloud.py | def remove_service(self, wait_timeout=10, sleep_wait=1):
'''
Removes the PAExec service and executable that was created as part of
the create_service function. This does not remove any older executables
or services from previous runs, use cleanup() instead for that purpose.
'''
... | def remove_service(self, wait_timeout=10, sleep_wait=1):
'''
Removes the PAExec service and executable that was created as part of
the create_service function. This does not remove any older executables
or services from previous runs, use cleanup() instead for that purpose.
'''
... | [
"Removes",
"the",
"PAExec",
"service",
"and",
"executable",
"that",
"was",
"created",
"as",
"part",
"of",
"the",
"create_service",
"function",
".",
"This",
"does",
"not",
"remove",
"any",
"older",
"executables",
"or",
"services",
"from",
"previous",
"runs",
"u... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/cloud.py#L893-L935 | [
"def",
"remove_service",
"(",
"self",
",",
"wait_timeout",
"=",
"10",
",",
"sleep_wait",
"=",
"1",
")",
":",
"# Stops/remove the PAExec service and removes the executable",
"log",
".",
"debug",
"(",
"\"Deleting PAExec service at the end of the process\"",
")",
"wait_start",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | dropfile | Set an AES dropfile to request the master update the publish session key | salt/crypt.py | def dropfile(cachedir, user=None):
'''
Set an AES dropfile to request the master update the publish session key
'''
dfn = os.path.join(cachedir, '.dfn')
# set a mask (to avoid a race condition on file creation) and store original.
with salt.utils.files.set_umask(0o277):
log.info('Rotatin... | def dropfile(cachedir, user=None):
'''
Set an AES dropfile to request the master update the publish session key
'''
dfn = os.path.join(cachedir, '.dfn')
# set a mask (to avoid a race condition on file creation) and store original.
with salt.utils.files.set_umask(0o277):
log.info('Rotatin... | [
"Set",
"an",
"AES",
"dropfile",
"to",
"request",
"the",
"master",
"update",
"the",
"publish",
"session",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L82-L105 | [
"def",
"dropfile",
"(",
"cachedir",
",",
"user",
"=",
"None",
")",
":",
"dfn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"'.dfn'",
")",
"# set a mask (to avoid a race condition on file creation) and store original.",
"with",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | gen_keys | Generate a RSA public keypair for use with salt
:param str keydir: The directory to write the keypair to
:param str keyname: The type of salt server for whom this key should be written. (i.e. 'master' or 'minion')
:param int keysize: The number of bits in the key
:param str user: The user on the system... | salt/crypt.py | def gen_keys(keydir, keyname, keysize, user=None, passphrase=None):
'''
Generate a RSA public keypair for use with salt
:param str keydir: The directory to write the keypair to
:param str keyname: The type of salt server for whom this key should be written. (i.e. 'master' or 'minion')
:param int ke... | def gen_keys(keydir, keyname, keysize, user=None, passphrase=None):
'''
Generate a RSA public keypair for use with salt
:param str keydir: The directory to write the keypair to
:param str keyname: The type of salt server for whom this key should be written. (i.e. 'master' or 'minion')
:param int ke... | [
"Generate",
"a",
"RSA",
"public",
"keypair",
"for",
"use",
"with",
"salt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L108-L168 | [
"def",
"gen_keys",
"(",
"keydir",
",",
"keyname",
",",
"keysize",
",",
"user",
"=",
"None",
",",
"passphrase",
"=",
"None",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"keydir",
",",
"keyname",
")",
"priv",
"=",
"'{0}.pem'",
".",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_key_with_evict | Load a private key from disk. `timestamp` above is intended to be the
timestamp of the file's last modification. This fn is memoized so if it is
called with the same path and timestamp (the file's last modified time) the
second time the result is returned from the memoiziation. If the file gets
modifi... | salt/crypt.py | def _get_key_with_evict(path, timestamp, passphrase):
'''
Load a private key from disk. `timestamp` above is intended to be the
timestamp of the file's last modification. This fn is memoized so if it is
called with the same path and timestamp (the file's last modified time) the
second time the resu... | def _get_key_with_evict(path, timestamp, passphrase):
'''
Load a private key from disk. `timestamp` above is intended to be the
timestamp of the file's last modification. This fn is memoized so if it is
called with the same path and timestamp (the file's last modified time) the
second time the resu... | [
"Load",
"a",
"private",
"key",
"from",
"disk",
".",
"timestamp",
"above",
"is",
"intended",
"to",
"be",
"the",
"timestamp",
"of",
"the",
"file",
"s",
"last",
"modification",
".",
"This",
"fn",
"is",
"memoized",
"so",
"if",
"it",
"is",
"called",
"with",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L172-L186 | [
"def",
"_get_key_with_evict",
"(",
"path",
",",
"timestamp",
",",
"passphrase",
")",
":",
"log",
".",
"debug",
"(",
"'salt.crypt._get_key_with_evict: Loading private key'",
")",
"if",
"HAS_M2",
":",
"key",
"=",
"RSA",
".",
"load_key",
"(",
"path",
",",
"lambda",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_rsa_key | Read a private key off the disk. Poor man's simple cache in effect here,
we memoize the result of calling _get_rsa_with_evict. This means the first
time _get_key_with_evict is called with a path and a timestamp the result
is cached. If the file (the private key) does not change then its
timestamp wil... | salt/crypt.py | def get_rsa_key(path, passphrase):
'''
Read a private key off the disk. Poor man's simple cache in effect here,
we memoize the result of calling _get_rsa_with_evict. This means the first
time _get_key_with_evict is called with a path and a timestamp the result
is cached. If the file (the private ... | def get_rsa_key(path, passphrase):
'''
Read a private key off the disk. Poor man's simple cache in effect here,
we memoize the result of calling _get_rsa_with_evict. This means the first
time _get_key_with_evict is called with a path and a timestamp the result
is cached. If the file (the private ... | [
"Read",
"a",
"private",
"key",
"off",
"the",
"disk",
".",
"Poor",
"man",
"s",
"simple",
"cache",
"in",
"effect",
"here",
"we",
"memoize",
"the",
"result",
"of",
"calling",
"_get_rsa_with_evict",
".",
"This",
"means",
"the",
"first",
"time",
"_get_key_with_ev... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L189-L201 | [
"def",
"get_rsa_key",
"(",
"path",
",",
"passphrase",
")",
":",
"log",
".",
"debug",
"(",
"'salt.crypt.get_rsa_key: Loading private key'",
")",
"return",
"_get_key_with_evict",
"(",
"path",
",",
"six",
".",
"text_type",
"(",
"os",
".",
"path",
".",
"getmtime",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_rsa_pub_key | Read a public key off the disk. | salt/crypt.py | def get_rsa_pub_key(path):
'''
Read a public key off the disk.
'''
log.debug('salt.crypt.get_rsa_pub_key: Loading public key')
if HAS_M2:
with salt.utils.files.fopen(path, 'rb') as f:
data = f.read().replace(b'RSA ', b'')
bio = BIO.MemoryBuffer(data)
key = RSA.loa... | def get_rsa_pub_key(path):
'''
Read a public key off the disk.
'''
log.debug('salt.crypt.get_rsa_pub_key: Loading public key')
if HAS_M2:
with salt.utils.files.fopen(path, 'rb') as f:
data = f.read().replace(b'RSA ', b'')
bio = BIO.MemoryBuffer(data)
key = RSA.loa... | [
"Read",
"a",
"public",
"key",
"off",
"the",
"disk",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L204-L217 | [
"def",
"get_rsa_pub_key",
"(",
"path",
")",
":",
"log",
".",
"debug",
"(",
"'salt.crypt.get_rsa_pub_key: Loading public key'",
")",
"if",
"HAS_M2",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sign_message | Use Crypto.Signature.PKCS1_v1_5 to sign a message. Returns the signature. | salt/crypt.py | def sign_message(privkey_path, message, passphrase=None):
'''
Use Crypto.Signature.PKCS1_v1_5 to sign a message. Returns the signature.
'''
key = get_rsa_key(privkey_path, passphrase)
log.debug('salt.crypt.sign_message: Signing message.')
if HAS_M2:
md = EVP.MessageDigest('sha1')
... | def sign_message(privkey_path, message, passphrase=None):
'''
Use Crypto.Signature.PKCS1_v1_5 to sign a message. Returns the signature.
'''
key = get_rsa_key(privkey_path, passphrase)
log.debug('salt.crypt.sign_message: Signing message.')
if HAS_M2:
md = EVP.MessageDigest('sha1')
... | [
"Use",
"Crypto",
".",
"Signature",
".",
"PKCS1_v1_5",
"to",
"sign",
"a",
"message",
".",
"Returns",
"the",
"signature",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L220-L233 | [
"def",
"sign_message",
"(",
"privkey_path",
",",
"message",
",",
"passphrase",
"=",
"None",
")",
":",
"key",
"=",
"get_rsa_key",
"(",
"privkey_path",
",",
"passphrase",
")",
"log",
".",
"debug",
"(",
"'salt.crypt.sign_message: Signing message.'",
")",
"if",
"HAS... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | verify_signature | Use Crypto.Signature.PKCS1_v1_5 to verify the signature on a message.
Returns True for valid signature. | salt/crypt.py | def verify_signature(pubkey_path, message, signature):
'''
Use Crypto.Signature.PKCS1_v1_5 to verify the signature on a message.
Returns True for valid signature.
'''
log.debug('salt.crypt.verify_signature: Loading public key')
pubkey = get_rsa_pub_key(pubkey_path)
log.debug('salt.crypt.veri... | def verify_signature(pubkey_path, message, signature):
'''
Use Crypto.Signature.PKCS1_v1_5 to verify the signature on a message.
Returns True for valid signature.
'''
log.debug('salt.crypt.verify_signature: Loading public key')
pubkey = get_rsa_pub_key(pubkey_path)
log.debug('salt.crypt.veri... | [
"Use",
"Crypto",
".",
"Signature",
".",
"PKCS1_v1_5",
"to",
"verify",
"the",
"signature",
"on",
"a",
"message",
".",
"Returns",
"True",
"for",
"valid",
"signature",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L236-L251 | [
"def",
"verify_signature",
"(",
"pubkey_path",
",",
"message",
",",
"signature",
")",
":",
"log",
".",
"debug",
"(",
"'salt.crypt.verify_signature: Loading public key'",
")",
"pubkey",
"=",
"get_rsa_pub_key",
"(",
"pubkey_path",
")",
"log",
".",
"debug",
"(",
"'sa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | gen_signature | creates a signature for the given public-key with
the given private key and writes it to sign_path | salt/crypt.py | def gen_signature(priv_path, pub_path, sign_path, passphrase=None):
'''
creates a signature for the given public-key with
the given private key and writes it to sign_path
'''
with salt.utils.files.fopen(pub_path) as fp_:
mpub_64 = fp_.read()
mpub_sig = sign_message(priv_path, mpub_64, ... | def gen_signature(priv_path, pub_path, sign_path, passphrase=None):
'''
creates a signature for the given public-key with
the given private key and writes it to sign_path
'''
with salt.utils.files.fopen(pub_path) as fp_:
mpub_64 = fp_.read()
mpub_sig = sign_message(priv_path, mpub_64, ... | [
"creates",
"a",
"signature",
"for",
"the",
"given",
"public",
"-",
"key",
"with",
"the",
"given",
"private",
"key",
"and",
"writes",
"it",
"to",
"sign_path"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L254-L281 | [
"def",
"gen_signature",
"(",
"priv_path",
",",
"pub_path",
",",
"sign_path",
",",
"passphrase",
"=",
"None",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"pub_path",
")",
"as",
"fp_",
":",
"mpub_64",
"=",
"fp_",
".",
"read",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | private_encrypt | Generate an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA key object
:param str message: The message to sign
:rtype: str
:return: The signature, or an empty string if the signature operation failed | salt/crypt.py | def private_encrypt(key, message):
'''
Generate an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA key object
:param str message: The message to sign
:rtype: str
:return: The signature, or an empty string if the signature operation failed
'''
if HAS_M2:
... | def private_encrypt(key, message):
'''
Generate an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA key object
:param str message: The message to sign
:rtype: str
:return: The signature, or an empty string if the signature operation failed
'''
if HAS_M2:
... | [
"Generate",
"an",
"M2Crypto",
"-",
"compatible",
"signature"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L284-L297 | [
"def",
"private_encrypt",
"(",
"key",
",",
"message",
")",
":",
"if",
"HAS_M2",
":",
"return",
"key",
".",
"private_encrypt",
"(",
"message",
",",
"salt",
".",
"utils",
".",
"rsax931",
".",
"RSA_X931_PADDING",
")",
"else",
":",
"signer",
"=",
"salt",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | public_decrypt | Verify an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA public key object
:param str message: The signed message to verify
:rtype: str
:return: The message (or digest) recovered from the signature, or an
empty string if the verification failed | salt/crypt.py | def public_decrypt(pub, message):
'''
Verify an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA public key object
:param str message: The signed message to verify
:rtype: str
:return: The message (or digest) recovered from the signature, or an
empty string... | def public_decrypt(pub, message):
'''
Verify an M2Crypto-compatible signature
:param Crypto.PublicKey.RSA._RSAobj key: The RSA public key object
:param str message: The signed message to verify
:rtype: str
:return: The message (or digest) recovered from the signature, or an
empty string... | [
"Verify",
"an",
"M2Crypto",
"-",
"compatible",
"signature"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L300-L314 | [
"def",
"public_decrypt",
"(",
"pub",
",",
"message",
")",
":",
"if",
"HAS_M2",
":",
"return",
"pub",
".",
"public_decrypt",
"(",
"message",
",",
"salt",
".",
"utils",
".",
"rsax931",
".",
"RSA_X931_PADDING",
")",
"else",
":",
"verifier",
"=",
"salt",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MasterKeys.__get_keys | Returns a key object for a key in the pki-dir | salt/crypt.py | def __get_keys(self, name='master', passphrase=None):
'''
Returns a key object for a key in the pki-dir
'''
path = os.path.join(self.opts['pki_dir'],
name + '.pem')
if not os.path.exists(path):
log.info('Generating %s keys: %s', name, self.... | def __get_keys(self, name='master', passphrase=None):
'''
Returns a key object for a key in the pki-dir
'''
path = os.path.join(self.opts['pki_dir'],
name + '.pem')
if not os.path.exists(path):
log.info('Generating %s keys: %s', name, self.... | [
"Returns",
"a",
"key",
"object",
"for",
"a",
"key",
"in",
"the",
"pki",
"-",
"dir"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L383-L407 | [
"def",
"__get_keys",
"(",
"self",
",",
"name",
"=",
"'master'",
",",
"passphrase",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"name",
"+",
"'.pem'",
")",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | MasterKeys.get_pub_str | Return the string representation of a public key
in the pki-directory | salt/crypt.py | def get_pub_str(self, name='master'):
'''
Return the string representation of a public key
in the pki-directory
'''
path = os.path.join(self.opts['pki_dir'],
name + '.pub')
if not os.path.isfile(path):
key = self.__get_keys()
... | def get_pub_str(self, name='master'):
'''
Return the string representation of a public key
in the pki-directory
'''
path = os.path.join(self.opts['pki_dir'],
name + '.pub')
if not os.path.isfile(path):
key = self.__get_keys()
... | [
"Return",
"the",
"string",
"representation",
"of",
"a",
"public",
"key",
"in",
"the",
"pki",
"-",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L409-L424 | [
"def",
"get_pub_str",
"(",
"self",
",",
"name",
"=",
"'master'",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"name",
"+",
"'.pub'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.authenticate | Ask for this client to reconnect to the origin
This function will de-dupe all calls here and return a *single* future
for the sign-in-- whis way callers can all assume there aren't others | salt/crypt.py | def authenticate(self, callback=None):
'''
Ask for this client to reconnect to the origin
This function will de-dupe all calls here and return a *single* future
for the sign-in-- whis way callers can all assume there aren't others
'''
# if an auth is in flight-- and not ... | def authenticate(self, callback=None):
'''
Ask for this client to reconnect to the origin
This function will de-dupe all calls here and return a *single* future
for the sign-in-- whis way callers can all assume there aren't others
'''
# if an auth is in flight-- and not ... | [
"Ask",
"for",
"this",
"client",
"to",
"reconnect",
"to",
"the",
"origin"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L558-L579 | [
"def",
"authenticate",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"# if an auth is in flight-- and not done-- just pass that back as the future to wait on",
"if",
"hasattr",
"(",
"self",
",",
"'_authenticate_future'",
")",
"and",
"not",
"self",
".",
"_authentica... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth._authenticate | Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES key.
:rtype: Crypticle
:returns: A crypticle used for encryption... | salt/crypt.py | def _authenticate(self):
'''
Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES key.
:rtype: Crypticle
... | def _authenticate(self):
'''
Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES key.
:rtype: Crypticle
... | [
"Authenticate",
"with",
"the",
"master",
"this",
"method",
"breaks",
"the",
"functional",
"paradigm",
"it",
"will",
"update",
"the",
"master",
"information",
"from",
"a",
"fresh",
"sign",
"in",
"signing",
"in",
"can",
"occur",
"as",
"often",
"as",
"needed",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L582-L661 | [
"def",
"_authenticate",
"(",
"self",
")",
":",
"acceptance_wait_time",
"=",
"self",
".",
"opts",
"[",
"'acceptance_wait_time'",
"]",
"acceptance_wait_time_max",
"=",
"self",
".",
"opts",
"[",
"'acceptance_wait_time_max'",
"]",
"if",
"not",
"acceptance_wait_time_max",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.sign_in | Send a sign in request to the master, sets the key information and
returns a dict containing the master publish interface to bind to
and the decrypted aes key for transport decryption.
:param int timeout: Number of seconds to wait before timing out the sign-in request
:param bool safe: ... | salt/crypt.py | def sign_in(self, timeout=60, safe=True, tries=1, channel=None):
'''
Send a sign in request to the master, sets the key information and
returns a dict containing the master publish interface to bind to
and the decrypted aes key for transport decryption.
:param int timeout: Numbe... | def sign_in(self, timeout=60, safe=True, tries=1, channel=None):
'''
Send a sign in request to the master, sets the key information and
returns a dict containing the master publish interface to bind to
and the decrypted aes key for transport decryption.
:param int timeout: Numbe... | [
"Send",
"a",
"sign",
"in",
"request",
"to",
"the",
"master",
"sets",
"the",
"key",
"information",
"and",
"returns",
"a",
"dict",
"containing",
"the",
"master",
"publish",
"interface",
"to",
"bind",
"to",
"and",
"the",
"decrypted",
"aes",
"key",
"for",
"tra... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L664-L782 | [
"def",
"sign_in",
"(",
"self",
",",
"timeout",
"=",
"60",
",",
"safe",
"=",
"True",
",",
"tries",
"=",
"1",
",",
"channel",
"=",
"None",
")",
":",
"auth",
"=",
"{",
"}",
"auth_timeout",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'auth_timeout'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.get_keys | Return keypair object for the minion.
:rtype: Crypto.PublicKey.RSA._RSAobj
:return: The RSA keypair | salt/crypt.py | def get_keys(self):
'''
Return keypair object for the minion.
:rtype: Crypto.PublicKey.RSA._RSAobj
:return: The RSA keypair
'''
# Make sure all key parent directories are accessible
user = self.opts.get('user', 'root')
salt.utils.verify.check_path_travers... | def get_keys(self):
'''
Return keypair object for the minion.
:rtype: Crypto.PublicKey.RSA._RSAobj
:return: The RSA keypair
'''
# Make sure all key parent directories are accessible
user = self.opts.get('user', 'root')
salt.utils.verify.check_path_travers... | [
"Return",
"keypair",
"object",
"for",
"the",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L784-L803 | [
"def",
"get_keys",
"(",
"self",
")",
":",
"# Make sure all key parent directories are accessible",
"user",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'user'",
",",
"'root'",
")",
"salt",
".",
"utils",
".",
"verify",
".",
"check_path_traversal",
"(",
"self",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.minion_sign_in_payload | Generates the payload used to authenticate with the master
server. This payload consists of the passed in id_ and the ssh
public key to encrypt the AES key sent back from the master.
:return: Payload dictionary
:rtype: dict | salt/crypt.py | def minion_sign_in_payload(self):
'''
Generates the payload used to authenticate with the master
server. This payload consists of the passed in id_ and the ssh
public key to encrypt the AES key sent back from the master.
:return: Payload dictionary
:rtype: dict
'... | def minion_sign_in_payload(self):
'''
Generates the payload used to authenticate with the master
server. This payload consists of the passed in id_ and the ssh
public key to encrypt the AES key sent back from the master.
:return: Payload dictionary
:rtype: dict
'... | [
"Generates",
"the",
"payload",
"used",
"to",
"authenticate",
"with",
"the",
"master",
"server",
".",
"This",
"payload",
"consists",
"of",
"the",
"passed",
"in",
"id_",
"and",
"the",
"ssh",
"public",
"key",
"to",
"encrypt",
"the",
"AES",
"key",
"sent",
"bac... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L816-L845 | [
"def",
"minion_sign_in_payload",
"(",
"self",
")",
":",
"payload",
"=",
"{",
"}",
"payload",
"[",
"'cmd'",
"]",
"=",
"'_auth'",
"payload",
"[",
"'id'",
"]",
"=",
"self",
".",
"opts",
"[",
"'id'",
"]",
"if",
"'autosign_grains'",
"in",
"self",
".",
"opts... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.decrypt_aes | This function is used to decrypt the AES seed phrase returned from
the master server. The seed phrase is decrypted with the SSH RSA
host key.
Pass in the encrypted AES key.
Returns the decrypted AES seed key, a string
:param dict payload: The incoming payload. This is a diction... | salt/crypt.py | def decrypt_aes(self, payload, master_pub=True):
'''
This function is used to decrypt the AES seed phrase returned from
the master server. The seed phrase is decrypted with the SSH RSA
host key.
Pass in the encrypted AES key.
Returns the decrypted AES seed key, a string
... | def decrypt_aes(self, payload, master_pub=True):
'''
This function is used to decrypt the AES seed phrase returned from
the master server. The seed phrase is decrypted with the SSH RSA
host key.
Pass in the encrypted AES key.
Returns the decrypted AES seed key, a string
... | [
"This",
"function",
"is",
"used",
"to",
"decrypt",
"the",
"AES",
"seed",
"phrase",
"returned",
"from",
"the",
"master",
"server",
".",
"The",
"seed",
"phrase",
"is",
"decrypted",
"with",
"the",
"SSH",
"RSA",
"host",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L847-L915 | [
"def",
"decrypt_aes",
"(",
"self",
",",
"payload",
",",
"master_pub",
"=",
"True",
")",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'auth_trb'",
",",
"False",
")",
":",
"log",
".",
"warning",
"(",
"'Auth Called: %s'",
",",
"''",
".",
"join",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.verify_pubkey_sig | Wraps the verify_signature method so we have
additional checks.
:rtype: bool
:return: Success or failure of public key verification | salt/crypt.py | def verify_pubkey_sig(self, message, sig):
'''
Wraps the verify_signature method so we have
additional checks.
:rtype: bool
:return: Success or failure of public key verification
'''
if self.opts['master_sign_key_name']:
path = os.path.join(self.opts[... | def verify_pubkey_sig(self, message, sig):
'''
Wraps the verify_signature method so we have
additional checks.
:rtype: bool
:return: Success or failure of public key verification
'''
if self.opts['master_sign_key_name']:
path = os.path.join(self.opts[... | [
"Wraps",
"the",
"verify_signature",
"method",
"so",
"we",
"have",
"additional",
"checks",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L917-L956 | [
"def",
"verify_pubkey_sig",
"(",
"self",
",",
"message",
",",
"sig",
")",
":",
"if",
"self",
".",
"opts",
"[",
"'master_sign_key_name'",
"]",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"sel... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.check_auth_deps | Checks if both master and minion either sign (master) and
verify (minion). If one side does not, it should fail.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key
'enc': The format of the message. ('clear... | salt/crypt.py | def check_auth_deps(self, payload):
'''
Checks if both master and minion either sign (master) and
verify (minion). If one side does not, it should fail.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES k... | def check_auth_deps(self, payload):
'''
Checks if both master and minion either sign (master) and
verify (minion). If one side does not, it should fail.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES k... | [
"Checks",
"if",
"both",
"master",
"and",
"minion",
"either",
"sign",
"(",
"master",
")",
"and",
"verify",
"(",
"minion",
")",
".",
"If",
"one",
"side",
"does",
"not",
"it",
"should",
"fail",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L984-L1016 | [
"def",
"check_auth_deps",
"(",
"self",
",",
"payload",
")",
":",
"# master and minion sign and verify",
"if",
"'pub_sig'",
"in",
"payload",
"and",
"self",
".",
"opts",
"[",
"'verify_master_pubkey_sign'",
"]",
":",
"return",
"True",
"# master and minion do NOT sign and d... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.extract_aes | Return the AES key received from the master after the minion has been
successfully authenticated.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key
'enc': The format of the message. ('clear', 'pub', etc)
... | salt/crypt.py | def extract_aes(self, payload, master_pub=True):
'''
Return the AES key received from the master after the minion has been
successfully authenticated.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key... | def extract_aes(self, payload, master_pub=True):
'''
Return the AES key received from the master after the minion has been
successfully authenticated.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key... | [
"Return",
"the",
"AES",
"key",
"received",
"from",
"the",
"master",
"after",
"the",
"minion",
"has",
"been",
"successfully",
"authenticated",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1018-L1049 | [
"def",
"extract_aes",
"(",
"self",
",",
"payload",
",",
"master_pub",
"=",
"True",
")",
":",
"if",
"master_pub",
":",
"try",
":",
"aes",
",",
"token",
"=",
"self",
".",
"decrypt_aes",
"(",
"payload",
",",
"master_pub",
")",
"if",
"token",
"!=",
"self",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | AsyncAuth.verify_master | Verify that the master is the same one that was previously accepted.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key
'enc': The format of the message. ('clear', 'pub', etc)
'publish_port': The TCP p... | salt/crypt.py | def verify_master(self, payload, master_pub=True):
'''
Verify that the master is the same one that was previously accepted.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key
'enc': The format of t... | def verify_master(self, payload, master_pub=True):
'''
Verify that the master is the same one that was previously accepted.
:param dict payload: The incoming payload. This is a dictionary which may have the following keys:
'aes': The shared AES key
'enc': The format of t... | [
"Verify",
"that",
"the",
"master",
"is",
"the",
"same",
"one",
"that",
"was",
"previously",
"accepted",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1051-L1127 | [
"def",
"verify_master",
"(",
"self",
",",
"payload",
",",
"master_pub",
"=",
"True",
")",
":",
"m_pub_fn",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"opts",
"[",
"'pki_dir'",
"]",
",",
"self",
".",
"mpub",
")",
"m_pub_exists",
"=",
"os",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SAuth.authenticate | Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES key.
:rtype: Crypticle
:returns: A crypticle used for encryption... | salt/crypt.py | def authenticate(self, _=None): # TODO: remove unused var
'''
Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES ke... | def authenticate(self, _=None): # TODO: remove unused var
'''
Authenticate with the master, this method breaks the functional
paradigm, it will update the master information from a fresh sign
in, signing in can occur as often as needed to keep up with the
revolving master AES ke... | [
"Authenticate",
"with",
"the",
"master",
"this",
"method",
"breaks",
"the",
"functional",
"paradigm",
"it",
"will",
"update",
"the",
"master",
"information",
"from",
"a",
"fresh",
"sign",
"in",
"signing",
"in",
"can",
"occur",
"as",
"often",
"as",
"needed",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1214-L1256 | [
"def",
"authenticate",
"(",
"self",
",",
"_",
"=",
"None",
")",
":",
"# TODO: remove unused var",
"acceptance_wait_time",
"=",
"self",
".",
"opts",
"[",
"'acceptance_wait_time'",
"]",
"acceptance_wait_time_max",
"=",
"self",
".",
"opts",
"[",
"'acceptance_wait_time_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Crypticle.encrypt | encrypt data with AES-CBC and sign it with HMAC-SHA256 | salt/crypt.py | def encrypt(self, data):
'''
encrypt data with AES-CBC and sign it with HMAC-SHA256
'''
aes_key, hmac_key = self.keys
pad = self.AES_BLOCK_SIZE - len(data) % self.AES_BLOCK_SIZE
if six.PY2:
data = data + pad * chr(pad)
else:
data = data + s... | def encrypt(self, data):
'''
encrypt data with AES-CBC and sign it with HMAC-SHA256
'''
aes_key, hmac_key = self.keys
pad = self.AES_BLOCK_SIZE - len(data) % self.AES_BLOCK_SIZE
if six.PY2:
data = data + pad * chr(pad)
else:
data = data + s... | [
"encrypt",
"data",
"with",
"AES",
"-",
"CBC",
"and",
"sign",
"it",
"with",
"HMAC",
"-",
"SHA256"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1406-L1426 | [
"def",
"encrypt",
"(",
"self",
",",
"data",
")",
":",
"aes_key",
",",
"hmac_key",
"=",
"self",
".",
"keys",
"pad",
"=",
"self",
".",
"AES_BLOCK_SIZE",
"-",
"len",
"(",
"data",
")",
"%",
"self",
".",
"AES_BLOCK_SIZE",
"if",
"six",
".",
"PY2",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Crypticle.decrypt | verify HMAC-SHA256 signature and decrypt data with AES-CBC | salt/crypt.py | def decrypt(self, data):
'''
verify HMAC-SHA256 signature and decrypt data with AES-CBC
'''
aes_key, hmac_key = self.keys
sig = data[-self.SIG_SIZE:]
data = data[:-self.SIG_SIZE]
if six.PY3 and not isinstance(data, bytes):
data = salt.utils.stringutils... | def decrypt(self, data):
'''
verify HMAC-SHA256 signature and decrypt data with AES-CBC
'''
aes_key, hmac_key = self.keys
sig = data[-self.SIG_SIZE:]
data = data[:-self.SIG_SIZE]
if six.PY3 and not isinstance(data, bytes):
data = salt.utils.stringutils... | [
"verify",
"HMAC",
"-",
"SHA256",
"signature",
"and",
"decrypt",
"data",
"with",
"AES",
"-",
"CBC"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1428-L1464 | [
"def",
"decrypt",
"(",
"self",
",",
"data",
")",
":",
"aes_key",
",",
"hmac_key",
"=",
"self",
".",
"keys",
"sig",
"=",
"data",
"[",
"-",
"self",
".",
"SIG_SIZE",
":",
"]",
"data",
"=",
"data",
"[",
":",
"-",
"self",
".",
"SIG_SIZE",
"]",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Crypticle.dumps | Serialize and encrypt a python object | salt/crypt.py | def dumps(self, obj):
'''
Serialize and encrypt a python object
'''
return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj)) | def dumps(self, obj):
'''
Serialize and encrypt a python object
'''
return self.encrypt(self.PICKLE_PAD + self.serial.dumps(obj)) | [
"Serialize",
"and",
"encrypt",
"a",
"python",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1466-L1470 | [
"def",
"dumps",
"(",
"self",
",",
"obj",
")",
":",
"return",
"self",
".",
"encrypt",
"(",
"self",
".",
"PICKLE_PAD",
"+",
"self",
".",
"serial",
".",
"dumps",
"(",
"obj",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Crypticle.loads | Decrypt and un-serialize a python object | salt/crypt.py | def loads(self, data, raw=False):
'''
Decrypt and un-serialize a python object
'''
data = self.decrypt(data)
# simple integrity check to verify that we got meaningful data
if not data.startswith(self.PICKLE_PAD):
return {}
load = self.serial.loads(data... | def loads(self, data, raw=False):
'''
Decrypt and un-serialize a python object
'''
data = self.decrypt(data)
# simple integrity check to verify that we got meaningful data
if not data.startswith(self.PICKLE_PAD):
return {}
load = self.serial.loads(data... | [
"Decrypt",
"and",
"un",
"-",
"serialize",
"a",
"python",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/crypt.py#L1472-L1481 | [
"def",
"loads",
"(",
"self",
",",
"data",
",",
"raw",
"=",
"False",
")",
":",
"data",
"=",
"self",
".",
"decrypt",
"(",
"data",
")",
"# simple integrity check to verify that we got meaningful data",
"if",
"not",
"data",
".",
"startswith",
"(",
"self",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Execute hiera and return the data | salt/pillar/hiera.py | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf):
'''
Execute hiera and return the data
'''
cmd = 'hiera -c {0}'.format(conf)
for key, val in six.iteritems(__grains__):
if isinstance(val, six.string_types):
cm... | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
conf):
'''
Execute hiera and return the data
'''
cmd = 'hiera -c {0}'.format(conf)
for key, val in six.iteritems(__grains__):
if isinstance(val, six.string_types):
cm... | [
"Execute",
"hiera",
"and",
"return",
"the",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/hiera.py#L29-L44 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"conf",
")",
":",
"cmd",
"=",
"'hiera -c {0}'",
".",
"format",
"(",
"conf",
")",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _gluster_output_cleanup | Gluster versions prior to 6 have a bug that requires tricking
isatty. This adds "gluster> " to the output. Strip it off and
produce clean xml for ElementTree. | salt/modules/glusterfs.py | def _gluster_output_cleanup(result):
'''
Gluster versions prior to 6 have a bug that requires tricking
isatty. This adds "gluster> " to the output. Strip it off and
produce clean xml for ElementTree.
'''
ret = ''
for line in result.splitlines():
if line.startswith('gluster>'):
... | def _gluster_output_cleanup(result):
'''
Gluster versions prior to 6 have a bug that requires tricking
isatty. This adds "gluster> " to the output. Strip it off and
produce clean xml for ElementTree.
'''
ret = ''
for line in result.splitlines():
if line.startswith('gluster>'):
... | [
"Gluster",
"versions",
"prior",
"to",
"6",
"have",
"a",
"bug",
"that",
"requires",
"tricking",
"isatty",
".",
"This",
"adds",
"gluster",
">",
"to",
"the",
"output",
".",
"Strip",
"it",
"off",
"and",
"produce",
"clean",
"xml",
"for",
"ElementTree",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L51-L66 | [
"def",
"_gluster_output_cleanup",
"(",
"result",
")",
":",
"ret",
"=",
"''",
"for",
"line",
"in",
"result",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"'gluster>'",
")",
":",
"ret",
"+=",
"line",
"[",
"9",
":",
"]",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _gluster_xml | Perform a gluster --xml command and log result. | salt/modules/glusterfs.py | def _gluster_xml(cmd):
'''
Perform a gluster --xml command and log result.
'''
# We will pass the command string as stdin to allow for much longer
# command strings. This is especially useful for creating large volumes
# where the list of bricks exceeds 128 characters.
if _get_version() < (3... | def _gluster_xml(cmd):
'''
Perform a gluster --xml command and log result.
'''
# We will pass the command string as stdin to allow for much longer
# command strings. This is especially useful for creating large volumes
# where the list of bricks exceeds 128 characters.
if _get_version() < (3... | [
"Perform",
"a",
"gluster",
"--",
"xml",
"command",
"and",
"log",
"result",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L69-L103 | [
"def",
"_gluster_xml",
"(",
"cmd",
")",
":",
"# We will pass the command string as stdin to allow for much longer",
"# command strings. This is especially useful for creating large volumes",
"# where the list of bricks exceeds 128 characters.",
"if",
"_get_version",
"(",
")",
"<",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _iter | Checks for python2.6 or python2.7 | salt/modules/glusterfs.py | def _iter(root, term):
'''
Checks for python2.6 or python2.7
'''
if sys.version_info < (2, 7):
return root.getiterator(term)
else:
return root.iter(term) | def _iter(root, term):
'''
Checks for python2.6 or python2.7
'''
if sys.version_info < (2, 7):
return root.getiterator(term)
else:
return root.iter(term) | [
"Checks",
"for",
"python2",
".",
"6",
"or",
"python2",
".",
"7"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L120-L127 | [
"def",
"_iter",
"(",
"root",
",",
"term",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"2",
",",
"7",
")",
":",
"return",
"root",
".",
"getiterator",
"(",
"term",
")",
"else",
":",
"return",
"root",
".",
"iter",
"(",
"term",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | peer_status | Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to be used first in peering.
C... | salt/modules/glusterfs.py | def peer_status():
'''
Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to b... | def peer_status():
'''
Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to b... | [
"Return",
"peer",
"status",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L130-L181 | [
"def",
"peer_status",
"(",
")",
":",
"root",
"=",
"_gluster_xml",
"(",
"'peer status'",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None",
"result",
"=",
"{",
"}",
"for",
"peer",
"in",
"_iter",
"(",
"root",
",",
"'peer'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | peer | Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLUSTER CLI 3.4.4 return exampl... | salt/modules/glusterfs.py | def peer(name):
'''
Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLU... | def peer(name):
'''
Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLU... | [
"Add",
"another",
"node",
"into",
"the",
"peer",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L184-L219 | [
"def",
"peer",
"(",
"name",
")",
":",
"if",
"salt",
".",
"utils",
".",
"cloud",
".",
"check_name",
"(",
"name",
",",
"'a-zA-Z0-9._-'",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Invalid characters in peer name \"{0}\"'",
".",
"format",
"(",
"name",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_volume | Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. For \
multiple bricks use list format: '["<peer1>:<brick1>", \
"<peer2>:<brick2>"]'
stripe
Stripe count, the number of bricks should be a m... | salt/modules/glusterfs.py | def create_volume(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False, arbiter=False):
'''
Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. F... | def create_volume(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False, arbiter=False):
'''
Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. F... | [
"Create",
"a",
"glusterfs",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L222-L320 | [
"def",
"create_volume",
"(",
"name",
",",
"bricks",
",",
"stripe",
"=",
"False",
",",
"replica",
"=",
"False",
",",
"device_vg",
"=",
"False",
",",
"transport",
"=",
"'tcp'",
",",
"start",
"=",
"False",
",",
"force",
"=",
"False",
",",
"arbiter",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_volumes | List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes | salt/modules/glusterfs.py | def list_volumes():
'''
List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes
'''
root = _gluster_xml('volume list')
if not _gluster_ok(root):
return None
results = [x.text for x in _iter(root, 'volume')]
return results | def list_volumes():
'''
List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes
'''
root = _gluster_xml('volume list')
if not _gluster_ok(root):
return None
results = [x.text for x in _iter(root, 'volume')]
return results | [
"List",
"configured",
"volumes"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L323-L338 | [
"def",
"list_volumes",
"(",
")",
":",
"root",
"=",
"_gluster_xml",
"(",
"'volume list'",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None",
"results",
"=",
"[",
"x",
".",
"text",
"for",
"x",
"in",
"_iter",
"(",
"root",
",",
"'v... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume | salt/modules/glusterfs.py | def status(name):
'''
Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume
'''
# Get volume status
root = _gluster_xml('volume status {0}'.format(name))
if not _gluster_ok(root):
# Most... | def status(name):
'''
Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume
'''
# Get volume status
root = _gluster_xml('volume status {0}'.format(name))
if not _gluster_ok(root):
# Most... | [
"Check",
"the",
"status",
"of",
"a",
"gluster",
"volume",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L341-L392 | [
"def",
"status",
"(",
"name",
")",
":",
"# Get volume status",
"root",
"=",
"_gluster_xml",
"(",
"'volume status {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"# Most probably non-existing volume, the error output is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | .. versionadded:: 2015.8.4
Return gluster volume info.
name
Optional name to retrieve only information of one volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.info | salt/modules/glusterfs.py | def info(name=None):
'''
.. versionadded:: 2015.8.4
Return gluster volume info.
name
Optional name to retrieve only information of one volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.info
'''
cmd = 'volume info'
if name is not None:
cmd += ' '... | def info(name=None):
'''
.. versionadded:: 2015.8.4
Return gluster volume info.
name
Optional name to retrieve only information of one volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.info
'''
cmd = 'volume info'
if name is not None:
cmd += ' '... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"4"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L395-L439 | [
"def",
"info",
"(",
"name",
"=",
"None",
")",
":",
"cmd",
"=",
"'volume info'",
"if",
"name",
"is",
"not",
"None",
":",
"cmd",
"+=",
"' '",
"+",
"name",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start_volume | Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster | salt/modules/glusterfs.py | def start_volume(name, force=False):
'''
Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster
'''
cmd = 'volu... | def start_volume(name, force=False):
'''
Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster
'''
cmd = 'volu... | [
"Start",
"a",
"gluster",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L442-L472 | [
"def",
"start_volume",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"cmd",
"=",
"'volume start {0}'",
".",
"format",
"(",
"name",
")",
"if",
"force",
":",
"cmd",
"=",
"'{0} force'",
".",
"format",
"(",
"cmd",
")",
"volinfo",
"=",
"info",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop_volume | Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster | salt/modules/glusterfs.py | def stop_volume(name, force=False):
'''
Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster
'''
volinfo = info()
if name not in v... | def stop_volume(name, force=False):
'''
Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster
'''
volinfo = info()
if name not in v... | [
"Stop",
"a",
"gluster",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L475-L505 | [
"def",
"stop_volume",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"volinfo",
"=",
"info",
"(",
")",
"if",
"name",
"not",
"in",
"volinfo",
":",
"log",
".",
"error",
"(",
"'Cannot stop non-existing volume %s'",
",",
"name",
")",
"return",
"False",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_volume | Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume> | salt/modules/glusterfs.py | def delete_volume(target, stop=True):
'''
Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume>
'''
volinfo = info()
if target not in... | def delete_volume(target, stop=True):
'''
Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume>
'''
volinfo = info()
if target not in... | [
"Deletes",
"a",
"gluster",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L508-L542 | [
"def",
"delete_volume",
"(",
"target",
",",
"stop",
"=",
"True",
")",
":",
"volinfo",
"=",
"info",
"(",
")",
"if",
"target",
"not",
"in",
"volinfo",
":",
"log",
".",
"error",
"(",
"'Cannot delete non-existing volume %s'",
",",
"target",
")",
"return",
"Fal... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_volume_bricks | Add brick(s) to an existing volume
name
Volume name
bricks
List of bricks to add to the volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.add_volume_bricks <volume> <bricks> | salt/modules/glusterfs.py | def add_volume_bricks(name, bricks):
'''
Add brick(s) to an existing volume
name
Volume name
bricks
List of bricks to add to the volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.add_volume_bricks <volume> <bricks>
'''
volinfo = info()
if name ... | def add_volume_bricks(name, bricks):
'''
Add brick(s) to an existing volume
name
Volume name
bricks
List of bricks to add to the volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.add_volume_bricks <volume> <bricks>
'''
volinfo = info()
if name ... | [
"Add",
"brick",
"(",
"s",
")",
"to",
"an",
"existing",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L545-L589 | [
"def",
"add_volume_bricks",
"(",
"name",
",",
"bricks",
")",
":",
"volinfo",
"=",
"info",
"(",
")",
"if",
"name",
"not",
"in",
"volinfo",
":",
"log",
".",
"error",
"(",
"'Volume %s does not exist, cannot add bricks'",
",",
"name",
")",
"return",
"False",
"ne... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_quota_volume | Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up restriction
CLI Example:
.. code-block:: bash
salt '*'... | salt/modules/glusterfs.py | def set_quota_volume(name, path, size, enable_quota=False):
'''
Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up r... | def set_quota_volume(name, path, size, enable_quota=False):
'''
Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up r... | [
"Set",
"quota",
"to",
"glusterfs",
"volume",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L632-L665 | [
"def",
"set_quota_volume",
"(",
"name",
",",
"path",
",",
"size",
",",
"enable_quota",
"=",
"False",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"if",
"path",
":",
"cmd",
"+=",
"' limit-usage {0}'",
".",
"format",
"(",
"p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unset_quota_volume | Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path> | salt/modules/glusterfs.py | def unset_quota_volume(name, path):
'''
Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path>
'''
cmd = 'volume quota ... | def unset_quota_volume(name, path):
'''
Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path>
'''
cmd = 'volume quota ... | [
"Unset",
"quota",
"on",
"glusterfs",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L668-L690 | [
"def",
"unset_quota_volume",
"(",
"name",
",",
"path",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"if",
"path",
":",
"cmd",
"+=",
"' remove {0}'",
".",
"format",
"(",
"path",
")",
"if",
"not",
"_gluster",
"(",
"cmd",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_quota_volume | List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume> | salt/modules/glusterfs.py | def list_quota_volume(name):
'''
List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume>
'''
cmd = 'volume quota {0}'.format(name)
cmd += ' list'
root = _gluster_xml(cmd)
... | def list_quota_volume(name):
'''
List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume>
'''
cmd = 'volume quota {0}'.format(name)
cmd += ' list'
root = _gluster_xml(cmd)
... | [
"List",
"quotas",
"of",
"glusterfs",
"volume"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L693-L718 | [
"def",
"list_quota_volume",
"(",
"name",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"cmd",
"+=",
"' list'",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_op_version | .. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume> | salt/modules/glusterfs.py | def get_op_version(name):
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume>
'''
cmd = 'volume get {0} cluster.op-version'.format(name)... | def get_op_version(name):
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume>
'''
cmd = 'volume get {0} cluster.op-version'.format(name)... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L721-L753 | [
"def",
"get_op_version",
"(",
"name",
")",
":",
"cmd",
"=",
"'volume get {0} cluster.op-version'",
".",
"format",
"(",
"name",
")",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"False",
",",
"ro... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_max_op_version | .. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version | salt/modules/glusterfs.py | def get_max_op_version():
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version
'''
if _get_version() < (3, 10,):
return False, 'Gluste... | def get_max_op_version():
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version
'''
if _get_version() < (3, 10,):
return False, 'Gluste... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L756-L787 | [
"def",
"get_max_op_version",
"(",
")",
":",
"if",
"_get_version",
"(",
")",
"<",
"(",
"3",
",",
"10",
",",
")",
":",
"return",
"False",
",",
"'Glusterfs version must be 3.10+. Your version is {0}.'",
".",
"format",
"(",
"str",
"(",
"'.'",
".",
"join",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_op_version | .. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume> | salt/modules/glusterfs.py | def set_op_version(version):
'''
.. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume>
'''
cmd = 'volume set all cluster.op-v... | def set_op_version(version):
'''
.. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume>
'''
cmd = 'volume set all cluster.op-v... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L790-L812 | [
"def",
"set_op_version",
"(",
"version",
")",
":",
"cmd",
"=",
"'volume set all cluster.op-version {0}'",
".",
"format",
"(",
"version",
")",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"False",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_valid_version | Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3. | salt/modules/bower.py | def _check_valid_version():
'''
Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3.
'''
# pylint: disable=no-member
bower_version = _LooseVersion(
__salt__['cmd.run']('bower --version'))
valid_version = _LooseVersion('1.3')
# ... | def _check_valid_version():
'''
Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3.
'''
# pylint: disable=no-member
bower_version = _LooseVersion(
__salt__['cmd.run']('bower --version'))
valid_version = _LooseVersion('1.3')
# ... | [
"Check",
"the",
"version",
"of",
"Bower",
"to",
"ensure",
"this",
"module",
"will",
"work",
".",
"Currently",
"bower",
"must",
"be",
"at",
"least",
"version",
"1",
".",
"3",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L41-L57 | [
"def",
"_check_valid_version",
"(",
")",
":",
"# pylint: disable=no-member",
"bower_version",
"=",
"_LooseVersion",
"(",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'bower --version'",
")",
")",
"valid_version",
"=",
"_LooseVersion",
"(",
"'1.3'",
")",
"# pylint: enable=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _construct_bower_command | Create bower command line string | salt/modules/bower.py | def _construct_bower_command(bower_command):
'''
Create bower command line string
'''
if not bower_command:
raise CommandExecutionError(
'bower_command, e.g. install, must be specified')
cmd = ['bower'] + shlex.split(bower_command)
cmd.extend(['--config.analytics', 'false',
... | def _construct_bower_command(bower_command):
'''
Create bower command line string
'''
if not bower_command:
raise CommandExecutionError(
'bower_command, e.g. install, must be specified')
cmd = ['bower'] + shlex.split(bower_command)
cmd.extend(['--config.analytics', 'false',
... | [
"Create",
"bower",
"command",
"line",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L60-L72 | [
"def",
"_construct_bower_command",
"(",
"bower_command",
")",
":",
"if",
"not",
"bower_command",
":",
"raise",
"CommandExecutionError",
"(",
"'bower_command, e.g. install, must be specified'",
")",
"cmd",
"=",
"[",
"'bower'",
"]",
"+",
"shlex",
".",
"split",
"(",
"b... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | install | Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format accepted by Bower, including a version
identifier
dir
The target directory in which to install the ... | salt/modules/bower.py | def install(pkg,
dir,
pkgs=None,
runas=None,
env=None):
'''
Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format acce... | def install(pkg,
dir,
pkgs=None,
runas=None,
env=None):
'''
Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format acce... | [
"Install",
"a",
"Bower",
"package",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L75-L133 | [
"def",
"install",
"(",
"pkg",
",",
"dir",
",",
"pkgs",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"_check_valid_version",
"(",
")",
"cmd",
"=",
"_construct_bower_command",
"(",
"'install'",
")",
"if",
"pkg",
":",
"cmd",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | default_config | Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d/99-salt.conf``.
CLI Example:... | salt/modules/linux_sysctl.py | def default_config():
'''
Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d... | def default_config():
'''
Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d... | [
"Linux",
"hosts",
"using",
"systemd",
"207",
"or",
"later",
"ignore",
"/",
"etc",
"/",
"sysctl",
".",
"conf",
"and",
"only",
"load",
"from",
"/",
"etc",
"/",
"sysctl",
".",
"d",
"/",
"*",
".",
"conf",
".",
"This",
"function",
"will",
"do",
"the",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L40-L56 | [
"def",
"default_config",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"systemd",
".",
"booted",
"(",
"__context__",
")",
"and",
"salt",
".",
"utils",
".",
"systemd",
".",
"version",
"(",
"__context__",
")",
">=",
"207",
":",
"return",
"'/etc/sysctl.d/... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show | Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show | salt/modules/linux_sysctl.py | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
ret = {}
if config_file:
# If the ... | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
ret = {}
if config_file:
# If the ... | [
"Return",
"a",
"list",
"of",
"sysctl",
"parameters",
"for",
"this",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L59-L102 | [
"def",
"show",
"(",
"config_file",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"config_file",
":",
"# If the file doesn't exist, return an empty list",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_file",
")",
":",
"return",
"[",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | assign | Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1 | salt/modules/linux_sysctl.py | def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1
'''
value = six.text_type(value)
if six.PY3:
tran_tab = name.translate(''.maketrans('./', '/.'))
else:
... | def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1
'''
value = six.text_type(value)
if six.PY3:
tran_tab = name.translate(''.maketrans('./', '/.'))
else:
... | [
"Assign",
"a",
"single",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L120-L164 | [
"def",
"assign",
"(",
"name",
",",
"value",
")",
":",
"value",
"=",
"six",
".",
"text_type",
"(",
"value",
")",
"if",
"six",
".",
"PY3",
":",
"tran_tab",
"=",
"name",
".",
"translate",
"(",
"''",
".",
"maketrans",
"(",
"'./'",
",",
"'/.'",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | persist | Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
salt '*' sysctl.persist net.ipv4.ip_forward 1 | salt/modules/linux_sysctl.py | def persist(name, value, config=None):
'''
Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
s... | def persist(name, value, config=None):
'''
Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
s... | [
"Assign",
"and",
"persist",
"a",
"simple",
"sysctl",
"parameter",
"for",
"this",
"minion",
".",
"If",
"config",
"is",
"not",
"specified",
"a",
"sensible",
"default",
"will",
"be",
"chosen",
"using",
":",
"mod",
":",
"sysctl",
".",
"default_config",
"<salt",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L167-L256 | [
"def",
"persist",
"(",
"name",
",",
"value",
",",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"config",
"=",
"default_config",
"(",
")",
"edited",
"=",
"False",
"# If the sysctl.conf is not present, add it",
"if",
"not",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Connect to a mongo database and read per-node pillar information.
Parameters:
* `collection`: The mongodb collection to read data from. Defaults to
``'pillar'``.
* `id_field`: The field in the collection that represents an individual
minion id. Defaults to ``'_id'``.
* `... | salt/pillar/mongo.py | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
collection='pillar',
id_field='_id',
re_pattern=None,
re_replace='',
fields=None):
'''
Connect to a mongo database and read per-node pillar information.
Param... | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
collection='pillar',
id_field='_id',
re_pattern=None,
re_replace='',
fields=None):
'''
Connect to a mongo database and read per-node pillar information.
Param... | [
"Connect",
"to",
"a",
"mongo",
"database",
"and",
"read",
"per",
"-",
"node",
"pillar",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mongo.py#L89-L165 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"collection",
"=",
"'pillar'",
",",
"id_field",
"=",
"'_id'",
",",
"re_pattern",
"=",
"None",
",",
"re_replace",
"=",
"''",
",",
"fields",
"=",
"None",
")",
":",
"host",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _conv_name | If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag". | salt/utils/xmlutil.py | def _conv_name(x):
'''
If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag".
'''
if '}' in x:
comps = x.split('}')
name = comps[1]
return name
return x | def _conv_name(x):
'''
If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag".
'''
if '}' in x:
comps = x.split('}')
name = comps[1]
return name
return x | [
"If",
"this",
"XML",
"tree",
"has",
"an",
"xmlns",
"attribute",
"then",
"etree",
"will",
"add",
"it",
"to",
"the",
"beginning",
"of",
"the",
"tag",
"like",
":",
"{",
"http",
":",
"//",
"path",
"}",
"tag",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L10-L19 | [
"def",
"_conv_name",
"(",
"x",
")",
":",
"if",
"'}'",
"in",
"x",
":",
"comps",
"=",
"x",
".",
"split",
"(",
"'}'",
")",
"name",
"=",
"comps",
"[",
"1",
"]",
"return",
"name",
"return",
"x"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _to_dict | Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this. | salt/utils/xmlutil.py | def _to_dict(xmltree):
'''
Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this.
'''
# If this object has no children, the for..loop below will ret... | def _to_dict(xmltree):
'''
Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this.
'''
# If this object has no children, the for..loop below will ret... | [
"Converts",
"an",
"XML",
"ElementTree",
"to",
"a",
"dictionary",
"that",
"only",
"contains",
"items",
".",
"This",
"is",
"the",
"default",
"behavior",
"in",
"version",
"2017",
".",
"7",
".",
"This",
"will",
"default",
"to",
"prevent",
"unexpected",
"parsing"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L22-L50 | [
"def",
"_to_dict",
"(",
"xmltree",
")",
":",
"# If this object has no children, the for..loop below will return nothing",
"# for it, so just return a single dict representing it.",
"if",
"not",
"xmltree",
".",
"getchildren",
"(",
")",
":",
"name",
"=",
"_conv_name",
"(",
"xml... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _to_full_dict | Returns the full XML dictionary including attributes. | salt/utils/xmlutil.py | def _to_full_dict(xmltree):
'''
Returns the full XML dictionary including attributes.
'''
xmldict = {}
for attrName, attrValue in xmltree.attrib.items():
xmldict[attrName] = attrValue
if not xmltree.getchildren():
if not xmldict:
# If we don't have attributes, we sh... | def _to_full_dict(xmltree):
'''
Returns the full XML dictionary including attributes.
'''
xmldict = {}
for attrName, attrValue in xmltree.attrib.items():
xmldict[attrName] = attrValue
if not xmltree.getchildren():
if not xmldict:
# If we don't have attributes, we sh... | [
"Returns",
"the",
"full",
"XML",
"dictionary",
"including",
"attributes",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L53-L86 | [
"def",
"_to_full_dict",
"(",
"xmltree",
")",
":",
"xmldict",
"=",
"{",
"}",
"for",
"attrName",
",",
"attrValue",
"in",
"xmltree",
".",
"attrib",
".",
"items",
"(",
")",
":",
"xmldict",
"[",
"attrName",
"]",
"=",
"attrValue",
"if",
"not",
"xmltree",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _no_op | No-op state to support state config via the stateconf renderer. | salt/states/stateconf.py | def _no_op(name, **kwargs):
'''
No-op state to support state config via the stateconf renderer.
'''
return dict(name=name, result=True, changes={}, comment='') | def _no_op(name, **kwargs):
'''
No-op state to support state config via the stateconf renderer.
'''
return dict(name=name, result=True, changes={}, comment='') | [
"No",
"-",
"op",
"state",
"to",
"support",
"state",
"config",
"via",
"the",
"stateconf",
"renderer",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/stateconf.py#L13-L17 | [
"def",
"_no_op",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"dict",
"(",
"name",
"=",
"name",
",",
"result",
"=",
"True",
",",
"changes",
"=",
"{",
"}",
",",
"comment",
"=",
"''",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_state | Helper for deriving the current state of the container from the inspect
results. | salt/modules/dockermod.py | def _get_state(inspect_results):
'''
Helper for deriving the current state of the container from the inspect
results.
'''
if inspect_results.get('State', {}).get('Paused', False):
return 'paused'
elif inspect_results.get('State', {}).get('Running', False):
return 'running'
el... | def _get_state(inspect_results):
'''
Helper for deriving the current state of the container from the inspect
results.
'''
if inspect_results.get('State', {}).get('Paused', False):
return 'paused'
elif inspect_results.get('State', {}).get('Running', False):
return 'running'
el... | [
"Helper",
"for",
"deriving",
"the",
"current",
"state",
"of",
"the",
"container",
"from",
"the",
"inspect",
"results",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L395-L405 | [
"def",
"_get_state",
"(",
"inspect_results",
")",
":",
"if",
"inspect_results",
".",
"get",
"(",
"'State'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'Paused'",
",",
"False",
")",
":",
"return",
"'paused'",
"elif",
"inspect_results",
".",
"get",
"(",
"'State... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _docker_client | Decorator to run a function that requires the use of a docker.Client()
instance. | salt/modules/dockermod.py | def _docker_client(wrapped):
'''
Decorator to run a function that requires the use of a docker.Client()
instance.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
Ensure that the client is present
'''
kwargs = __utils__['args.clean_kwargs'](**kwargs... | def _docker_client(wrapped):
'''
Decorator to run a function that requires the use of a docker.Client()
instance.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
Ensure that the client is present
'''
kwargs = __utils__['args.clean_kwargs'](**kwargs... | [
"Decorator",
"to",
"run",
"a",
"function",
"that",
"requires",
"the",
"use",
"of",
"a",
"docker",
".",
"Client",
"()",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L409-L436 | [
"def",
"_docker_client",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n Ensure that the client is present\n '''",
"kwargs",
"=",
"__utils_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _refresh_mine_cache | Decorator to trigger a refresh of salt mine data. | salt/modules/dockermod.py | def _refresh_mine_cache(wrapped):
'''
Decorator to trigger a refresh of salt mine data.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
refresh salt mine on exit.
'''
returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs))
if _che... | def _refresh_mine_cache(wrapped):
'''
Decorator to trigger a refresh of salt mine data.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
refresh salt mine on exit.
'''
returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs))
if _che... | [
"Decorator",
"to",
"trigger",
"a",
"refresh",
"of",
"salt",
"mine",
"data",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L439-L453 | [
"def",
"_refresh_mine_cache",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n refresh salt mine on exit.\n '''",
"returned",
"=",
"wrapped"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _change_state | Change the state of a container | salt/modules/dockermod.py | def _change_state(name, action, expected, *args, **kwargs):
'''
Change the state of a container
'''
pre = state(name)
if action != 'restart' and pre == expected:
return {'result': False,
'state': {'old': expected, 'new': expected},
'comment': ('Container \'{0}... | def _change_state(name, action, expected, *args, **kwargs):
'''
Change the state of a container
'''
pre = state(name)
if action != 'restart' and pre == expected:
return {'result': False,
'state': {'old': expected, 'new': expected},
'comment': ('Container \'{0}... | [
"Change",
"the",
"state",
"of",
"a",
"container"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L466-L485 | [
"def",
"_change_state",
"(",
"name",
",",
"action",
",",
"expected",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pre",
"=",
"state",
"(",
"name",
")",
"if",
"action",
"!=",
"'restart'",
"and",
"pre",
"==",
"expected",
":",
"return",
"{",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_md5 | Get the MD5 checksum of a file from a container | salt/modules/dockermod.py | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name,
'md5sum {0}'.format(pipes.quote(path)),
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# Destination ... | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name,
'md5sum {0}'.format(pipes.quote(path)),
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# Destination ... | [
"Get",
"the",
"MD5",
"checksum",
"of",
"a",
"file",
"from",
"a",
"container"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L507-L518 | [
"def",
"_get_md5",
"(",
"name",
",",
"path",
")",
":",
"output",
"=",
"run_stdout",
"(",
"name",
",",
"'md5sum {0}'",
".",
"format",
"(",
"pipes",
".",
"quote",
"(",
"path",
")",
")",
",",
"ignore_retcode",
"=",
"True",
")",
"try",
":",
"return",
"ou... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_exec_driver | Get the method to be used in shell commands | salt/modules/dockermod.py | def _get_exec_driver():
'''
Get the method to be used in shell commands
'''
contextkey = 'docker.exec_driver'
if contextkey not in __context__:
from_config = __salt__['config.get'](contextkey, None)
# This if block can be removed once we make docker-exec a default
# option, a... | def _get_exec_driver():
'''
Get the method to be used in shell commands
'''
contextkey = 'docker.exec_driver'
if contextkey not in __context__:
from_config = __salt__['config.get'](contextkey, None)
# This if block can be removed once we make docker-exec a default
# option, a... | [
"Get",
"the",
"method",
"to",
"be",
"used",
"in",
"shell",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L521-L556 | [
"def",
"_get_exec_driver",
"(",
")",
":",
"contextkey",
"=",
"'docker.exec_driver'",
"if",
"contextkey",
"not",
"in",
"__context__",
":",
"from_config",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"contextkey",
",",
"None",
")",
"# This if block can be removed o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_top_level_images | Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned. | salt/modules/dockermod.py | def _get_top_level_images(imagedata, subset=None):
'''
Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned.
'''
try:
parents = [im... | def _get_top_level_images(imagedata, subset=None):
'''
Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned.
'''
try:
parents = [im... | [
"Returns",
"a",
"list",
"of",
"the",
"top",
"-",
"level",
"images",
"(",
"those",
"which",
"are",
"not",
"parents",
")",
".",
"If",
"subset",
"(",
"an",
"iterable",
")",
"is",
"passed",
"the",
"top",
"-",
"level",
"images",
"in",
"the",
"subset",
"wi... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L559-L573 | [
"def",
"_get_top_level_images",
"(",
"imagedata",
",",
"subset",
"=",
"None",
")",
":",
"try",
":",
"parents",
"=",
"[",
"imagedata",
"[",
"x",
"]",
"[",
"'ParentId'",
"]",
"for",
"x",
"in",
"imagedata",
"]",
"filter_",
"=",
"subset",
"if",
"subset",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.