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 | update | Recursive version of the default dict.update
Merges upd recursively into dest
If recursive_update=False, will use the classic dict.update, or fall back
on a manual merge (helpful for non-dict types like FunctionWrapper)
If merge_lists=True, will aggregate list object types instead of replace.
The... | salt/utils/dictupdate.py | def update(dest, upd, recursive_update=True, merge_lists=False):
'''
Recursive version of the default dict.update
Merges upd recursively into dest
If recursive_update=False, will use the classic dict.update, or fall back
on a manual merge (helpful for non-dict types like FunctionWrapper)
If m... | def update(dest, upd, recursive_update=True, merge_lists=False):
'''
Recursive version of the default dict.update
Merges upd recursively into dest
If recursive_update=False, will use the classic dict.update, or fall back
on a manual merge (helpful for non-dict types like FunctionWrapper)
If m... | [
"Recursive",
"version",
"of",
"the",
"default",
"dict",
".",
"update"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L30-L82 | [
"def",
"update",
"(",
"dest",
",",
"upd",
",",
"recursive_update",
"=",
"True",
",",
"merge_lists",
"=",
"False",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"dest",
",",
"Mapping",
")",
")",
"or",
"(",
"not",
"isinstance",
"(",
"upd",
",",
"Mappi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ensure_dict_key | Ensures that in_dict contains the series of recursive keys defined in keys.
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more keys.
:param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
:param bool ordered_dict: Create OrderedDicts if ke... | salt/utils/dictupdate.py | def ensure_dict_key(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more key... | def ensure_dict_key(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more key... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L142-L166 | [
"def",
"ensure_dict_key",
"(",
"in_dict",
",",
"keys",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"if",
"delimiter",
"in",
"keys",
":",
"a_keys",
"=",
"keys",
".",
"split",
"(",
"delimiter",
")",
"else",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _dict_rpartition | Helper function to:
- Ensure all but the last key in `keys` exist recursively in `in_dict`.
- Return the dict at the one-to-last key, and the last key
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more keys.
:param str delimiter: The delimiter to use ... | salt/utils/dictupdate.py | def _dict_rpartition(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Helper function to:
- Ensure all but the last key in `keys` exist recursively in `in_dict`.
- Return the dict at the one-to-last key, and the last key
:param dict in_dict: T... | def _dict_rpartition(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Helper function to:
- Ensure all but the last key in `keys` exist recursively in `in_dict`.
- Return the dict at the one-to-last key, and the last key
:param dict in_dict: T... | [
"Helper",
"function",
"to",
":",
"-",
"Ensure",
"all",
"but",
"the",
"last",
"key",
"in",
"keys",
"exist",
"recursively",
"in",
"in_dict",
".",
"-",
"Return",
"the",
"dict",
"at",
"the",
"one",
"-",
"to",
"-",
"last",
"key",
"and",
"the",
"last",
"ke... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L169-L200 | [
"def",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"if",
"delimiter",
"in",
"keys",
":",
"all_but_last_keys",
",",
"_",
",",
"last_key",
"=",
"keys",
".",
"rpart... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_dict_key_value | Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The value to assign... | salt/utils/dictupdate.py | def set_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.
:par... | def set_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.
:par... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
".",
"Also",
"sets",
"whatever",
"is",
"at",
"the",
"end",
"of",
"in_dict",
"traversed",
"with",
"keys",
"to",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L204-L228 | [
"def",
"set_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"del... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_dict_key_value | Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
with `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The... | salt/utils/dictupdate.py | def update_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
with... | def update_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
with... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
".",
"Also",
"updates",
"the",
"dict",
"that",
"is",
"at",
"the",
"end",
"of",
"in_dict",
"traversed",
"with",
"keys",
"with",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L232-L266 | [
"def",
"update_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | append_dict_key_value | Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends `value` to the list that is at the end of `in_dict` traversed
with `keys`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The val... | salt/utils/dictupdate.py | def append_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends `value` to the list that is at the end of `in_dict` traversed
with `k... | def append_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends `value` to the list that is at the end of `in_dict` traversed
with `k... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
".",
"Also",
"appends",
"value",
"to",
"the",
"list",
"that",
"is",
"at",
"the",
"end",
"of",
"in_dict",
"traversed",
"with",
"keys",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L270-L301 | [
"def",
"append_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | extend_dict_key_value | Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of `in_dict` traversed with `keys`,
with `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The... | salt/utils/dictupdate.py | def extend_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of `in_dict` traversed with `keys`,
with... | def extend_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of `in_dict` traversed with `keys`,
with... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
".",
"Also",
"extends",
"the",
"list",
"that",
"is",
"at",
"the",
"end",
"of",
"in_dict",
"traversed",
"with",
"keys",
"with",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L305-L340 | [
"def",
"extend_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_bnum | Return the active number of minions to maintain | salt/cli/batch.py | def get_bnum(opts, minions, quiet):
'''
Return the active number of minions to maintain
'''
partition = lambda x: float(x) / 100.0 * len(minions)
try:
if '%' in opts['batch']:
res = partition(float(opts['batch'].strip('%')))
if res < 1:
return int(math... | def get_bnum(opts, minions, quiet):
'''
Return the active number of minions to maintain
'''
partition = lambda x: float(x) / 100.0 * len(minions)
try:
if '%' in opts['batch']:
res = partition(float(opts['batch'].strip('%')))
if res < 1:
return int(math... | [
"Return",
"the",
"active",
"number",
"of",
"minions",
"to",
"maintain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L29-L46 | [
"def",
"get_bnum",
"(",
"opts",
",",
"minions",
",",
"quiet",
")",
":",
"partition",
"=",
"lambda",
"x",
":",
"float",
"(",
"x",
")",
"/",
"100.0",
"*",
"len",
"(",
"minions",
")",
"try",
":",
"if",
"'%'",
"in",
"opts",
"[",
"'batch'",
"]",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Batch.__gather_minions | Return a list of minions to use for the batch run | salt/cli/batch.py | def __gather_minions(self):
'''
Return a list of minions to use for the batch run
'''
args = [self.opts['tgt'],
'test.ping',
[],
self.opts['timeout'],
]
selected_target_option = self.opts.get('selected_target_option... | def __gather_minions(self):
'''
Return a list of minions to use for the batch run
'''
args = [self.opts['tgt'],
'test.ping',
[],
self.opts['timeout'],
]
selected_target_option = self.opts.get('selected_target_option... | [
"Return",
"a",
"list",
"of",
"minions",
"to",
"use",
"for",
"the",
"batch",
"run"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L115-L153 | [
"def",
"__gather_minions",
"(",
"self",
")",
":",
"args",
"=",
"[",
"self",
".",
"opts",
"[",
"'tgt'",
"]",
",",
"'test.ping'",
",",
"[",
"]",
",",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
",",
"]",
"selected_target_option",
"=",
"self",
".",
"opt... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Batch.run | Execute the batch run | salt/cli/batch.py | def run(self):
'''
Execute the batch run
'''
args = [[],
self.opts['fun'],
self.opts['arg'],
self.opts['timeout'],
'list',
]
bnum = self.get_bnum()
# No targets to run
if not self.mini... | def run(self):
'''
Execute the batch run
'''
args = [[],
self.opts['fun'],
self.opts['arg'],
self.opts['timeout'],
'list',
]
bnum = self.get_bnum()
# No targets to run
if not self.mini... | [
"Execute",
"the",
"batch",
"run"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L166-L349 | [
"def",
"run",
"(",
"self",
")",
":",
"args",
"=",
"[",
"[",
"]",
",",
"self",
".",
"opts",
"[",
"'fun'",
"]",
",",
"self",
".",
"opts",
"[",
"'arg'",
"]",
",",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
",",
"'list'",
",",
"]",
"bnum",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the status for a service via dummy, returns a bool
whether the service is running.
.. versionadded:: 2016.11.3
CLI Example:
.. code-block:: bash
salt '*' service.status <service name> | salt/modules/dummyproxy_service.py | def status(name, sig=None):
'''
Return the status for a service via dummy, returns a bool
whether the service is running.
.. versionadded:: 2016.11.3
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
proxy_fn = 'dummy.service_status'
resp = __p... | def status(name, sig=None):
'''
Return the status for a service via dummy, returns a bool
whether the service is running.
.. versionadded:: 2016.11.3
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
proxy_fn = 'dummy.service_status'
resp = __p... | [
"Return",
"the",
"status",
"for",
"a",
"service",
"via",
"dummy",
"returns",
"a",
"bool",
"whether",
"the",
"service",
"is",
"running",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dummyproxy_service.py#L127-L146 | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"proxy_fn",
"=",
"'dummy.service_status'",
"resp",
"=",
"__proxy__",
"[",
"proxy_fn",
"]",
"(",
"name",
")",
"if",
"resp",
"[",
"'comment'",
"]",
"==",
"'stopped'",
":",
"return",
"False",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send_msg | Send a message to an XMPP user
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipient: admins@xmpp.example.com/salt
name
The message to send to the XMPP user | salt/states/xmpp.py | def send_msg(name, recipient, profile):
'''
Send a message to an XMPP user
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipient: admins@xmpp.example.com/salt
... | def send_msg(name, recipient, profile):
'''
Send a message to an XMPP user
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipient: admins@xmpp.example.com/salt
... | [
"Send",
"a",
"message",
"to",
"an",
"XMPP",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L31-L63 | [
"def",
"send_msg",
"(",
"name",
",",
"recipient",
",",
"profile",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"__opts__",
"[",
"'test'",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send_msg_multi | Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipients:
- admins@xmpp.example.com/salt
- rooms:
... | salt/states/xmpp.py | def send_msg_multi(name,
profile,
recipients=None,
rooms=None):
'''
Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'... | def send_msg_multi(name,
profile,
recipients=None,
rooms=None):
'''
Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'... | [
"Send",
"a",
"message",
"to",
"an",
"list",
"of",
"recipients",
"or",
"rooms"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L66-L116 | [
"def",
"send_msg_multi",
"(",
"name",
",",
"profile",
",",
"recipients",
"=",
"None",
",",
"rooms",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | zone_present | Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str`` | salt/states/libcloud_dns.py | def zone_present(domain, type, profile):
'''
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str``
... | def zone_present(domain, type, profile):
'''
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str``
... | [
"Ensures",
"a",
"record",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L74-L95 | [
"def",
"zone_present",
"(",
"domain",
",",
"type",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"if",
"not",
"type",
":",
"type",
"=",
"'master'",
"matching_zone",
"=",
"[",
"z",
"for",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | zone_absent | Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str`` | salt/states/libcloud_dns.py | def zone_absent(domain, profile):
'''
Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
'''
zones = __salt__['libcloud_dns.list_zones'](profile)
matching_zone = [z for z in zones... | def zone_absent(domain, profile):
'''
Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
'''
zones = __salt__['libcloud_dns.list_zones'](profile)
matching_zone = [z for z in zones... | [
"Ensures",
"a",
"record",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L98-L114 | [
"def",
"zone_absent",
"(",
"domain",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"zones",
"if",
"z",
"[",
"'domain'",
"]",
"==",
"domain... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | record_present | Ensures a record is present.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument.
:type name: ``str``
:param zone: Zone where the... | salt/states/libcloud_dns.py | def record_present(name, zone, type, data, profile):
'''
Ensures a record is present.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
ar... | def record_present(name, zone, type, data, profile):
'''
Ensures a record is present.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
ar... | [
"Ensures",
"a",
"record",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L117-L155 | [
"def",
"record_present",
"(",
"name",
",",
"zone",
",",
"type",
",",
"data",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"try",
":",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | record_absent | Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument.
:type name: ``str``
:param zone: Zone where the ... | salt/states/libcloud_dns.py | def record_absent(name, zone, type, data, profile):
'''
Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argu... | def record_absent(name, zone, type, data, profile):
'''
Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argu... | [
"Ensures",
"a",
"record",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L158-L199 | [
"def",
"record_absent",
"(",
"name",
",",
"zone",
",",
"type",
",",
"data",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"try",
":",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"z... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | hash | .. versionadded:: 2014.7.0
Encodes a value with the specified encoder.
value
The value to be hashed.
algorithm : sha512
The algorithm to use. May be any valid algorithm supported by
hashlib.
CLI Example:
.. code-block:: bash
salt '*' random.hash 'I am a string' ... | salt/modules/mod_random.py | def hash(value, algorithm='sha512'):
'''
.. versionadded:: 2014.7.0
Encodes a value with the specified encoder.
value
The value to be hashed.
algorithm : sha512
The algorithm to use. May be any valid algorithm supported by
hashlib.
CLI Example:
.. code-block:: ba... | def hash(value, algorithm='sha512'):
'''
.. versionadded:: 2014.7.0
Encodes a value with the specified encoder.
value
The value to be hashed.
algorithm : sha512
The algorithm to use. May be any valid algorithm supported by
hashlib.
CLI Example:
.. code-block:: ba... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L46-L80 | [
"def",
"hash",
"(",
"value",
",",
"algorithm",
"=",
"'sha512'",
")",
":",
"if",
"six",
".",
"PY3",
"and",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"# Under Python 3 we must work with bytes",
"value",
"=",
"value",
".",
"encode",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | str_encode | .. versionadded:: 2014.7.0
value
The value to be encoded.
encoder : base64
The encoder to use on the subsequent string.
CLI Example:
.. code-block:: bash
salt '*' random.str_encode 'I am a new string' base64 | salt/modules/mod_random.py | def str_encode(value, encoder='base64'):
'''
.. versionadded:: 2014.7.0
value
The value to be encoded.
encoder : base64
The encoder to use on the subsequent string.
CLI Example:
.. code-block:: bash
salt '*' random.str_encode 'I am a new string' base64
'''
if... | def str_encode(value, encoder='base64'):
'''
.. versionadded:: 2014.7.0
value
The value to be encoded.
encoder : base64
The encoder to use on the subsequent string.
CLI Example:
.. code-block:: bash
salt '*' random.str_encode 'I am a new string' base64
'''
if... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L83-L122 | [
"def",
"str_encode",
"(",
"value",
",",
"encoder",
"=",
"'base64'",
")",
":",
"if",
"six",
".",
"PY2",
":",
"try",
":",
"out",
"=",
"value",
".",
"encode",
"(",
"encoder",
")",
"except",
"LookupError",
":",
"raise",
"SaltInvocationError",
"(",
"'You must... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | shadow_hash | Generates a salted hash suitable for /etc/shadow.
crypt_salt : None
Salt to be used in the generation of the hash. If one is not
provided, a random salt will be generated.
password : None
Value to be salted and hashed. If one is not provided, a random
password will be generated... | salt/modules/mod_random.py | def shadow_hash(crypt_salt=None, password=None, algorithm='sha512'):
'''
Generates a salted hash suitable for /etc/shadow.
crypt_salt : None
Salt to be used in the generation of the hash. If one is not
provided, a random salt will be generated.
password : None
Value to be salte... | def shadow_hash(crypt_salt=None, password=None, algorithm='sha512'):
'''
Generates a salted hash suitable for /etc/shadow.
crypt_salt : None
Salt to be used in the generation of the hash. If one is not
provided, a random salt will be generated.
password : None
Value to be salte... | [
"Generates",
"a",
"salted",
"hash",
"suitable",
"for",
"/",
"etc",
"/",
"shadow",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L143-L164 | [
"def",
"shadow_hash",
"(",
"crypt_salt",
"=",
"None",
",",
"password",
"=",
"None",
",",
"algorithm",
"=",
"'sha512'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"pycrypto",
".",
"gen_hash",
"(",
"crypt_salt",
",",
"password",
",",
"algorithm",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rand_int | Returns a random integer number between the start and end number.
.. versionadded: 2015.5.3
start : 1
Any valid integer number
end : 10
Any valid integer number
seed :
Optional hashable object
.. versionchanged:: 2019.2.0
Added seed argument. Will return the same... | salt/modules/mod_random.py | def rand_int(start=1, end=10, seed=None):
'''
Returns a random integer number between the start and end number.
.. versionadded: 2015.5.3
start : 1
Any valid integer number
end : 10
Any valid integer number
seed :
Optional hashable object
.. versionchanged:: 2019... | def rand_int(start=1, end=10, seed=None):
'''
Returns a random integer number between the start and end number.
.. versionadded: 2015.5.3
start : 1
Any valid integer number
end : 10
Any valid integer number
seed :
Optional hashable object
.. versionchanged:: 2019... | [
"Returns",
"a",
"random",
"integer",
"number",
"between",
"the",
"start",
"and",
"end",
"number",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L167-L194 | [
"def",
"rand_int",
"(",
"start",
"=",
"1",
",",
"end",
"=",
"10",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"not",
"None",
":",
"random",
".",
"seed",
"(",
"seed",
")",
"return",
"random",
".",
"randint",
"(",
"start",
",",
"end",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | seed | Returns a random number within a range. Optional hash argument can
be any hashable object. If hash is omitted or None, the id of the minion is used.
.. versionadded: 2015.8.0
hash: None
Any hashable object.
range: 10
Any valid integer number
CLI Example:
.. code-block:: bash... | salt/modules/mod_random.py | def seed(range=10, hash=None):
'''
Returns a random number within a range. Optional hash argument can
be any hashable object. If hash is omitted or None, the id of the minion is used.
.. versionadded: 2015.8.0
hash: None
Any hashable object.
range: 10
Any valid integer number
... | def seed(range=10, hash=None):
'''
Returns a random number within a range. Optional hash argument can
be any hashable object. If hash is omitted or None, the id of the minion is used.
.. versionadded: 2015.8.0
hash: None
Any hashable object.
range: 10
Any valid integer number
... | [
"Returns",
"a",
"random",
"number",
"within",
"a",
"range",
".",
"Optional",
"hash",
"argument",
"can",
"be",
"any",
"hashable",
"object",
".",
"If",
"hash",
"is",
"omitted",
"or",
"None",
"the",
"id",
"of",
"the",
"minion",
"is",
"used",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L197-L220 | [
"def",
"seed",
"(",
"range",
"=",
"10",
",",
"hash",
"=",
"None",
")",
":",
"if",
"hash",
"is",
"None",
":",
"hash",
"=",
"__grains__",
"[",
"'id'",
"]",
"random",
".",
"seed",
"(",
"hash",
")",
"return",
"random",
".",
"randrange",
"(",
"range",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __get_connection_info | Grab MySQL Connection Details | salt/auth/mysql.py | def __get_connection_info():
'''
Grab MySQL Connection Details
'''
conn_info = {}
try:
conn_info['hostname'] = __opts__['mysql_auth']['hostname']
conn_info['username'] = __opts__['mysql_auth']['username']
conn_info['password'] = __opts__['mysql_auth']['password']
con... | def __get_connection_info():
'''
Grab MySQL Connection Details
'''
conn_info = {}
try:
conn_info['hostname'] = __opts__['mysql_auth']['hostname']
conn_info['username'] = __opts__['mysql_auth']['username']
conn_info['password'] = __opts__['mysql_auth']['password']
con... | [
"Grab",
"MySQL",
"Connection",
"Details"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L83-L100 | [
"def",
"__get_connection_info",
"(",
")",
":",
"conn_info",
"=",
"{",
"}",
"try",
":",
"conn_info",
"[",
"'hostname'",
"]",
"=",
"__opts__",
"[",
"'mysql_auth'",
"]",
"[",
"'hostname'",
"]",
"conn_info",
"[",
"'username'",
"]",
"=",
"__opts__",
"[",
"'mysq... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | auth | Authenticate using a MySQL user table | salt/auth/mysql.py | def auth(username, password):
'''
Authenticate using a MySQL user table
'''
_info = __get_connection_info()
if _info is None:
return False
try:
conn = MySQLdb.connect(_info['hostname'],
_info['username'],
_info['pass... | def auth(username, password):
'''
Authenticate using a MySQL user table
'''
_info = __get_connection_info()
if _info is None:
return False
try:
conn = MySQLdb.connect(_info['hostname'],
_info['username'],
_info['pass... | [
"Authenticate",
"using",
"a",
"MySQL",
"user",
"table"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L103-L127 | [
"def",
"auth",
"(",
"username",
",",
"password",
")",
":",
"_info",
"=",
"__get_connection_info",
"(",
")",
"if",
"_info",
"is",
"None",
":",
"return",
"False",
"try",
":",
"conn",
"=",
"MySQLdb",
".",
"connect",
"(",
"_info",
"[",
"'hostname'",
"]",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a check on a given URL.
Additional parameters can be used and are passed to API (for
example interval, maxTime, etc). See the documentation
https://github.com/fzaninotto/uptime for a full list of the
parameters.
CLI Example:
.. code-block:: bash
salt '*' uptime.create http://e... | salt/modules/uptime.py | def create(name, **params):
'''Create a check on a given URL.
Additional parameters can be used and are passed to API (for
example interval, maxTime, etc). See the documentation
https://github.com/fzaninotto/uptime for a full list of the
parameters.
CLI Example:
.. code-block:: bash
... | def create(name, **params):
'''Create a check on a given URL.
Additional parameters can be used and are passed to API (for
example interval, maxTime, etc). See the documentation
https://github.com/fzaninotto/uptime for a full list of the
parameters.
CLI Example:
.. code-block:: bash
... | [
"Create",
"a",
"check",
"on",
"a",
"given",
"URL",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L32-L60 | [
"def",
"create",
"(",
"name",
",",
"*",
"*",
"params",
")",
":",
"if",
"check_exists",
"(",
"name",
")",
":",
"msg",
"=",
"'Trying to create check that already exists : {0}'",
".",
"format",
"(",
"name",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org | salt/modules/uptime.py | def delete(name):
'''
Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org
'''
if not check_exists(name):
msg = "Trying to delete check that doesn't exists : {0}".format(name)
log.error(msg)
raise CommandExec... | def delete(name):
'''
Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org
'''
if not check_exists(name):
msg = "Trying to delete check that doesn't exists : {0}".format(name)
log.error(msg)
raise CommandExec... | [
"Delete",
"a",
"check",
"on",
"a",
"given",
"URL"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L63-L87 | [
"def",
"delete",
"(",
"name",
")",
":",
"if",
"not",
"check_exists",
"(",
"name",
")",
":",
"msg",
"=",
"\"Trying to delete check that doesn't exists : {0}\"",
".",
"format",
"(",
"name",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"CommandExecutionErr... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | checks_list | List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list | salt/modules/uptime.py | def checks_list():
'''
List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list
'''
application_url = _get_application_url()
log.debug('[uptime] get checks')
jcontent = requests.get('{0}/api/checks'.format(application_url)).json()
return [x[... | def checks_list():
'''
List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list
'''
application_url = _get_application_url()
log.debug('[uptime] get checks')
jcontent = requests.get('{0}/api/checks'.format(application_url)).json()
return [x[... | [
"List",
"URL",
"checked",
"by",
"uptime"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L103-L116 | [
"def",
"checks_list",
"(",
")",
":",
"application_url",
"=",
"_get_application_url",
"(",
")",
"log",
".",
"debug",
"(",
"'[uptime] get checks'",
")",
"jcontent",
"=",
"requests",
".",
"get",
"(",
"'{0}/api/checks'",
".",
"format",
"(",
"application_url",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cert | Obtain/renew a certificate from an ACME CA, probably Let's Encrypt.
:param name: Common Name of the certificate (DNS name of certificate)
:param aliases: subjectAltNames (Additional DNS names on certificate)
:param email: e-mail address for interaction with ACME provider
:param webroot: True or a full ... | salt/states/acme.py | def cert(name,
aliases=None,
email=None,
webroot=None,
test_cert=False,
renew=None,
keysize=None,
server=None,
owner='root',
group='root',
mode='0640',
certname=None,
preferred_challenges=None,
tls_sni_0... | def cert(name,
aliases=None,
email=None,
webroot=None,
test_cert=False,
renew=None,
keysize=None,
server=None,
owner='root',
group='root',
mode='0640',
certname=None,
preferred_challenges=None,
tls_sni_0... | [
"Obtain",
"/",
"renew",
"a",
"certificate",
"from",
"an",
"ACME",
"CA",
"probably",
"Let",
"s",
"Encrypt",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/acme.py#L42-L161 | [
"def",
"cert",
"(",
"name",
",",
"aliases",
"=",
"None",
",",
"email",
"=",
"None",
",",
"webroot",
"=",
"None",
",",
"test_cert",
"=",
"False",
",",
"renew",
"=",
"None",
",",
"keysize",
"=",
"None",
",",
"server",
"=",
"None",
",",
"owner",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _vagrant_call | Helper to call the vagrant functions. Wildcards supported.
:param node: The Salt-id or wildcard
:param function: the vagrant submodule to call
:param section: the name for the state call.
:param comment: what the state reply should say
:param status_when_done: the Vagrant status expected for this s... | salt/states/vagrant.py | def _vagrant_call(node, function, section, comment, status_when_done=None, **kwargs):
'''
Helper to call the vagrant functions. Wildcards supported.
:param node: The Salt-id or wildcard
:param function: the vagrant submodule to call
:param section: the name for the state call.
:param comment: w... | def _vagrant_call(node, function, section, comment, status_when_done=None, **kwargs):
'''
Helper to call the vagrant functions. Wildcards supported.
:param node: The Salt-id or wildcard
:param function: the vagrant submodule to call
:param section: the name for the state call.
:param comment: w... | [
"Helper",
"to",
"call",
"the",
"vagrant",
"functions",
".",
"Wildcards",
"supported",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L77-L127 | [
"def",
"_vagrant_call",
"(",
"node",
",",
"function",
",",
"section",
",",
"comment",
",",
"status_when_done",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"node",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | running | r'''
Defines and starts a new VM with specified arguments, or restart a
VM (or group of VMs). (Runs ``vagrant up``.)
:param name: the Salt_id node name you wish your VM to have.
If ``name`` contains a "?" or "*" then it will re-start a group of VMs
which have been paused or stopped.
Each mac... | salt/states/vagrant.py | def running(name, **kwargs):
r'''
Defines and starts a new VM with specified arguments, or restart a
VM (or group of VMs). (Runs ``vagrant up``.)
:param name: the Salt_id node name you wish your VM to have.
If ``name`` contains a "?" or "*" then it will re-start a group of VMs
which have been... | def running(name, **kwargs):
r'''
Defines and starts a new VM with specified arguments, or restart a
VM (or group of VMs). (Runs ``vagrant up``.)
:param name: the Salt_id node name you wish your VM to have.
If ``name`` contains a "?" or "*" then it will re-start a group of VMs
which have been... | [
"r",
"Defines",
"and",
"starts",
"a",
"new",
"VM",
"with",
"specified",
"arguments",
"or",
"restart",
"a",
"VM",
"(",
"or",
"group",
"of",
"VMs",
")",
".",
"(",
"Runs",
"vagrant",
"up",
".",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L130-L194 | [
"def",
"running",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'*'",
"in",
"name",
"or",
"'?'",
"in",
"name",
":",
"return",
"_vagrant_call",
"(",
"name",
",",
"'start'",
",",
"'restarted'",
",",
"\"Machine has been restarted\"",
",",
"\"running\... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_init_change | look for changes from any previous init of machine.
:return: modified ret and kwargs | salt/states/vagrant.py | def _find_init_change(name, ret, **kwargs):
'''
look for changes from any previous init of machine.
:return: modified ret and kwargs
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
if 'vm' in kwargs:
kwargs.update(kwargs.pop('vm'))
# the state processing eats 'runas' so we renam... | def _find_init_change(name, ret, **kwargs):
'''
look for changes from any previous init of machine.
:return: modified ret and kwargs
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
if 'vm' in kwargs:
kwargs.update(kwargs.pop('vm'))
# the state processing eats 'runas' so we renam... | [
"look",
"for",
"changes",
"from",
"any",
"previous",
"init",
"of",
"machine",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L197-L223 | [
"def",
"_find_init_change",
"(",
"name",
",",
"ret",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'vm'",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | initialized | r'''
Defines a new VM with specified arguments, but does not start it.
:param name: the Salt_id node name you wish your VM to have.
Each machine must be initialized individually using this function
or the "vagrant.running" function, or the vagrant.init execution module call.
This command will not... | salt/states/vagrant.py | def initialized(name, **kwargs):
r'''
Defines a new VM with specified arguments, but does not start it.
:param name: the Salt_id node name you wish your VM to have.
Each machine must be initialized individually using this function
or the "vagrant.running" function, or the vagrant.init execution mo... | def initialized(name, **kwargs):
r'''
Defines a new VM with specified arguments, but does not start it.
:param name: the Salt_id node name you wish your VM to have.
Each machine must be initialized individually using this function
or the "vagrant.running" function, or the vagrant.init execution mo... | [
"r",
"Defines",
"a",
"new",
"VM",
"with",
"specified",
"arguments",
"but",
"does",
"not",
"start",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L226-L280 | [
"def",
"initialized",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'The VM is already correctly defined'",
"}",
"# define a ma... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_gecos | Retrieve GECOS field info and return it in dictionary form | salt/modules/pw_user.py | def _get_gecos(name):
'''
Retrieve GECOS field info and return it in dictionary form
'''
try:
gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3)
except KeyError:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if not gecos_field:... | def _get_gecos(name):
'''
Retrieve GECOS field info and return it in dictionary form
'''
try:
gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3)
except KeyError:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if not gecos_field:... | [
"Retrieve",
"GECOS",
"field",
"info",
"and",
"return",
"it",
"in",
"dictionary",
"form"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L70-L89 | [
"def",
"_get_gecos",
"(",
"name",
")",
":",
"try",
":",
"gecos_field",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
".",
"pw_gecos",
".",
"split",
"(",
"','",
",",
"3",
")",
"except",
"KeyError",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add | Add a user to the minion
CLI Example:
.. code-block:: bash
salt '*' user.add name <uid> <gid> <groups> <home> <shell> | salt/modules/pw_user.py | def add(name,
uid=None,
gid=None,
groups=None,
home=None,
shell=None,
unique=True,
fullname='',
roomnumber='',
workphone='',
homephone='',
createhome=True,
loginclass=None,
**kwargs):
'''
Add a user to the mi... | def add(name,
uid=None,
gid=None,
groups=None,
home=None,
shell=None,
unique=True,
fullname='',
roomnumber='',
workphone='',
homephone='',
createhome=True,
loginclass=None,
**kwargs):
'''
Add a user to the mi... | [
"Add",
"a",
"user",
"to",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L122-L176 | [
"def",
"add",
"(",
"name",
",",
"uid",
"=",
"None",
",",
"gid",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"home",
"=",
"None",
",",
"shell",
"=",
"None",
",",
"unique",
"=",
"True",
",",
"fullname",
"=",
"''",
",",
"roomnumber",
"=",
"''",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | getent | Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent | salt/modules/pw_user.py | def getent(refresh=False):
'''
Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent
'''
if 'user.getent' in __context__ and not refresh:
return __context__['user.getent']
ret = []
for data in pwd.getpwall():
ret.appe... | def getent(refresh=False):
'''
Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent
'''
if 'user.getent' in __context__ and not refresh:
return __context__['user.getent']
ret = []
for data in pwd.getpwall():
ret.appe... | [
"Return",
"the",
"list",
"of",
"all",
"info",
"for",
"all",
"users"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L199-L216 | [
"def",
"getent",
"(",
"refresh",
"=",
"False",
")",
":",
"if",
"'user.getent'",
"in",
"__context__",
"and",
"not",
"refresh",
":",
"return",
"__context__",
"[",
"'user.getent'",
"]",
"ret",
"=",
"[",
"]",
"for",
"data",
"in",
"pwd",
".",
"getpwall",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chuid | Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376 | salt/modules/pw_user.py | def chuid(name, uid):
'''
Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376
'''
pre_info = info(name)
if not pre_info:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if uid == p... | def chuid(name, uid):
'''
Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376
'''
pre_info = info(name)
if not pre_info:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if uid == p... | [
"Change",
"the",
"uid",
"for",
"a",
"named",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L219-L238 | [
"def",
"chuid",
"(",
"name",
",",
"uid",
")",
":",
"pre_info",
"=",
"info",
"(",
"name",
")",
"if",
"not",
"pre_info",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0}\\' does not exist'",
".",
"format",
"(",
"name",
")",
")",
"if",
"uid",
"==",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | chloginclass | Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff | salt/modules/pw_user.py | def chloginclass(name, loginclass, root=None):
'''
Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff
'''
if loginclass == get_loginclass(name):
return True
cmd = ['pw', 'usermo... | def chloginclass(name, loginclass, root=None):
'''
Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff
'''
if loginclass == get_loginclass(name):
return True
cmd = ['pw', 'usermo... | [
"Change",
"the",
"default",
"login",
"class",
"of",
"the",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L405-L425 | [
"def",
"chloginclass",
"(",
"name",
",",
"loginclass",
",",
"root",
"=",
"None",
")",
":",
"if",
"loginclass",
"==",
"get_loginclass",
"(",
"name",
")",
":",
"return",
"True",
"cmd",
"=",
"[",
"'pw'",
",",
"'usermod'",
",",
"'-L'",
",",
"'{0}'",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root | salt/modules/pw_user.py | def info(name):
'''
Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root
'''
ret = {}
try:
data = pwd.getpwnam(name)
ret['gid'] = data.pw_gid
ret['groups'] = list_groups(name)
ret['home'] = data.pw_dir
ret['name'... | def info(name):
'''
Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root
'''
ret = {}
try:
data = pwd.getpwnam(name)
ret['gid'] = data.pw_gid
ret['groups'] = list_groups(name)
ret['home'] = data.pw_dir
ret['name'... | [
"Return",
"user",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L428-L459 | [
"def",
"info",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
"ret",
"[",
"'gid'",
"]",
"=",
"data",
".",
"pw_gid",
"ret",
"[",
"'groups'",
"]",
"=",
"list_groups",
"(",
"name",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_loginclass | Get the login class of the user
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' user.get_loginclass foo | salt/modules/pw_user.py | def get_loginclass(name):
'''
Get the login class of the user
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' user.get_loginclass foo
'''
userinfo = __salt__['cmd.run_stdout'](['pw', 'usershow', '-n', name])
userinfo = userinfo.split(':')
return u... | def get_loginclass(name):
'''
Get the login class of the user
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' user.get_loginclass foo
'''
userinfo = __salt__['cmd.run_stdout'](['pw', 'usershow', '-n', name])
userinfo = userinfo.split(':')
return u... | [
"Get",
"the",
"login",
"class",
"of",
"the",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L462-L479 | [
"def",
"get_loginclass",
"(",
"name",
")",
":",
"userinfo",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"[",
"'pw'",
",",
"'usershow'",
",",
"'-n'",
",",
"name",
"]",
")",
"userinfo",
"=",
"userinfo",
".",
"split",
"(",
"':'",
")",
"return",
"u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rename | Change the username for a named user
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name | salt/modules/pw_user.py | def rename(name, new_name):
'''
Change the username for a named user
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
current_info = info(name)
if not current_info:
raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
new_info... | def rename(name, new_name):
'''
Change the username for a named user
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
current_info = info(name)
if not current_info:
raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
new_info... | [
"Change",
"the",
"username",
"for",
"a",
"named",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L508-L531 | [
"def",
"rename",
"(",
"name",
",",
"new_name",
")",
":",
"current_info",
"=",
"info",
"(",
"name",
")",
"if",
"not",
"current_info",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0}\\' does not exist'",
".",
"format",
"(",
"name",
")",
")",
"new_info"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init | Open the connection to the Nexsu switch over the NX-API.
As the communication is HTTP based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
which doesn't come with ... | salt/proxy/nxos_api.py | def init(opts):
'''
Open the connection to the Nexsu switch over the NX-API.
As the communication is HTTP based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
... | def init(opts):
'''
Open the connection to the Nexsu switch over the NX-API.
As the communication is HTTP based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
... | [
"Open",
"the",
"connection",
"to",
"the",
"Nexsu",
"switch",
"over",
"the",
"NX",
"-",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L142-L167 | [
"def",
"init",
"(",
"opts",
")",
":",
"proxy_dict",
"=",
"opts",
".",
"get",
"(",
"'proxy'",
",",
"{",
"}",
")",
"conn_args",
"=",
"copy",
".",
"deepcopy",
"(",
"proxy_dict",
")",
"conn_args",
".",
"pop",
"(",
"'proxytype'",
",",
"None",
")",
"opts",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rpc | Executes an RPC request over the NX-API. | salt/proxy/nxos_api.py | def rpc(commands, method='cli', **kwargs):
'''
Executes an RPC request over the NX-API.
'''
conn_args = nxos_device['conn_args']
conn_args.update(kwargs)
return __utils__['nxos_api.rpc'](commands, method=method, **conn_args) | def rpc(commands, method='cli', **kwargs):
'''
Executes an RPC request over the NX-API.
'''
conn_args = nxos_device['conn_args']
conn_args.update(kwargs)
return __utils__['nxos_api.rpc'](commands, method=method, **conn_args) | [
"Executes",
"an",
"RPC",
"request",
"over",
"the",
"NX",
"-",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L203-L209 | [
"def",
"rpc",
"(",
"commands",
",",
"method",
"=",
"'cli'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"nxos_device",
"[",
"'conn_args'",
"]",
"conn_args",
".",
"update",
"(",
"kwargs",
")",
"return",
"__utils__",
"[",
"'nxos_api.rpc'",
"]",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | communicator | Warning, this is a picklable decorator ! | salt/cloud/__init__.py | def communicator(func):
'''Warning, this is a picklable decorator !'''
def _call(queue, args, kwargs):
'''called with [queue, args, kwargs] as first optional arg'''
kwargs['queue'] = queue
ret = None
try:
ret = func(*args, **kwargs)
queue.put('END')
... | def communicator(func):
'''Warning, this is a picklable decorator !'''
def _call(queue, args, kwargs):
'''called with [queue, args, kwargs] as first optional arg'''
kwargs['queue'] = queue
ret = None
try:
ret = func(*args, **kwargs)
queue.put('END')
... | [
"Warning",
"this",
"is",
"a",
"picklable",
"decorator",
"!"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L60-L85 | [
"def",
"communicator",
"(",
"func",
")",
":",
"def",
"_call",
"(",
"queue",
",",
"args",
",",
"kwargs",
")",
":",
"'''called with [queue, args, kwargs] as first optional arg'''",
"kwargs",
"[",
"'queue'",
"]",
"=",
"queue",
"ret",
"=",
"None",
"try",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enter_mainloop | Manage a multiprocessing pool
- If the queue does not output anything, the pool runs indefinitely
- If the queue returns KEYBOARDINT or ERROR, this will kill the pool
totally calling terminate & join and ands with a SaltCloudSystemExit
exception notifying callers from the abnormal termination
... | salt/cloud/__init__.py | def enter_mainloop(target,
mapped_args=None,
args=None,
kwargs=None,
pool=None,
pool_size=None,
callback=None,
queue=None):
'''
Manage a multiprocessing pool
- If the queue d... | def enter_mainloop(target,
mapped_args=None,
args=None,
kwargs=None,
pool=None,
pool_size=None,
callback=None,
queue=None):
'''
Manage a multiprocessing pool
- If the queue d... | [
"Manage",
"a",
"multiprocessing",
"pool"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L88-L182 | [
"def",
"enter_mainloop",
"(",
"target",
",",
"mapped_args",
"=",
"None",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"pool",
"=",
"None",
",",
"pool_size",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"queue",
"=",
"None",
")",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_multiprocessing | This function will be called from another process when running a map in
parallel mode. The result from the create is always a json object. | salt/cloud/__init__.py | def create_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the create is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
cloud = Cloud(p... | def create_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the create is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
cloud = Cloud(p... | [
"This",
"function",
"will",
"be",
"called",
"from",
"another",
"process",
"when",
"running",
"a",
"map",
"in",
"parallel",
"mode",
".",
"The",
"result",
"from",
"the",
"create",
"is",
"always",
"a",
"json",
"object",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2304-L2330 | [
"def",
"create_multiprocessing",
"(",
"parallel_data",
",",
"queue",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"crypt",
".",
"reinit_crypto",
"(",
")",
"parallel_data",
"[",
"'opts'",
"]",
"[",
"'output'",
"]",
"=",
"'json'",
"cloud",
"=",
"Cloud",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | destroy_multiprocessing | This function will be called from another process when running a map in
parallel mode. The result from the destroy is always a json object. | salt/cloud/__init__.py | def destroy_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the destroy is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
clouds = salt... | def destroy_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the destroy is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
clouds = salt... | [
"This",
"function",
"will",
"be",
"called",
"from",
"another",
"process",
"when",
"running",
"a",
"map",
"in",
"parallel",
"mode",
".",
"The",
"result",
"from",
"the",
"destroy",
"is",
"always",
"a",
"json",
"object",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2333-L2363 | [
"def",
"destroy_multiprocessing",
"(",
"parallel_data",
",",
"queue",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"crypt",
".",
"reinit_crypto",
"(",
")",
"parallel_data",
"[",
"'opts'",
"]",
"[",
"'output'",
"]",
"=",
"'json'",
"clouds",
"=",
"salt"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_parallel_map_providers_query | This function will be called from another process when building the
providers map. | salt/cloud/__init__.py | def run_parallel_map_providers_query(data, queue=None):
'''
This function will be called from another process when building the
providers map.
'''
salt.utils.crypt.reinit_crypto()
cloud = Cloud(data['opts'])
try:
with salt.utils.context.func_globals_inject(
cloud.clouds[... | def run_parallel_map_providers_query(data, queue=None):
'''
This function will be called from another process when building the
providers map.
'''
salt.utils.crypt.reinit_crypto()
cloud = Cloud(data['opts'])
try:
with salt.utils.context.func_globals_inject(
cloud.clouds[... | [
"This",
"function",
"will",
"be",
"called",
"from",
"another",
"process",
"when",
"building",
"the",
"providers",
"map",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2366-L2395 | [
"def",
"run_parallel_map_providers_query",
"(",
"data",
",",
"queue",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"crypt",
".",
"reinit_crypto",
"(",
")",
"cloud",
"=",
"Cloud",
"(",
"data",
"[",
"'opts'",
"]",
")",
"try",
":",
"with",
"salt",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient._opts_defaults | Set the opts dict to defaults and allow for opts to be overridden in
the kwargs | salt/cloud/__init__.py | def _opts_defaults(self, **kwargs):
'''
Set the opts dict to defaults and allow for opts to be overridden in
the kwargs
'''
# Let's start with the default salt cloud configuration
opts = salt.config.DEFAULT_CLOUD_OPTS.copy()
# Update it with the loaded configurati... | def _opts_defaults(self, **kwargs):
'''
Set the opts dict to defaults and allow for opts to be overridden in
the kwargs
'''
# Let's start with the default salt cloud configuration
opts = salt.config.DEFAULT_CLOUD_OPTS.copy()
# Update it with the loaded configurati... | [
"Set",
"the",
"opts",
"dict",
"to",
"defaults",
"and",
"allow",
"for",
"opts",
"to",
"be",
"overridden",
"in",
"the",
"kwargs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L219-L257 | [
"def",
"_opts_defaults",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Let's start with the default salt cloud configuration",
"opts",
"=",
"salt",
".",
"config",
".",
"DEFAULT_CLOUD_OPTS",
".",
"copy",
"(",
")",
"# Update it with the loaded configuration",
"opts",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.low | Pass the cloud function and low data structure to run | salt/cloud/__init__.py | def low(self, fun, low):
'''
Pass the cloud function and low data structure to run
'''
l_fun = getattr(self, fun)
f_call = salt.utils.args.format_call(l_fun, low)
return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {})) | def low(self, fun, low):
'''
Pass the cloud function and low data structure to run
'''
l_fun = getattr(self, fun)
f_call = salt.utils.args.format_call(l_fun, low)
return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {})) | [
"Pass",
"the",
"cloud",
"function",
"and",
"low",
"data",
"structure",
"to",
"run"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L259-L265 | [
"def",
"low",
"(",
"self",
",",
"fun",
",",
"low",
")",
":",
"l_fun",
"=",
"getattr",
"(",
"self",
",",
"fun",
")",
"f_call",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"format_call",
"(",
"l_fun",
",",
"low",
")",
"return",
"l_fun",
"(",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.list_sizes | List all available sizes in configured cloud systems | salt/cloud/__init__.py | def list_sizes(self, provider=None):
'''
List all available sizes in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.size_list(provider)
) | def list_sizes(self, provider=None):
'''
List all available sizes in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.size_list(provider)
) | [
"List",
"all",
"available",
"sizes",
"in",
"configured",
"cloud",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L267-L274 | [
"def",
"list_sizes",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.list_images | List all available images in configured cloud systems | salt/cloud/__init__.py | def list_images(self, provider=None):
'''
List all available images in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.image_list(provider)
) | def list_images(self, provider=None):
'''
List all available images in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.image_list(provider)
) | [
"List",
"all",
"available",
"images",
"in",
"configured",
"cloud",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L276-L283 | [
"def",
"list_images",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.list_locations | List all available locations in configured cloud systems | salt/cloud/__init__.py | def list_locations(self, provider=None):
'''
List all available locations in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.location_list(provider)
) | def list_locations(self, provider=None):
'''
List all available locations in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.location_list(provider)
) | [
"List",
"all",
"available",
"locations",
"in",
"configured",
"cloud",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L285-L292 | [
"def",
"list_locations",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.min_query | Query select instance information | salt/cloud/__init__.py | def min_query(self, query_type='list_nodes_min'):
'''
Query select instance information
'''
mapper = salt.cloud.Map(self._opts_defaults())
mapper.opts['selected_query_option'] = 'list_nodes_min'
return mapper.map_providers_parallel(query_type) | def min_query(self, query_type='list_nodes_min'):
'''
Query select instance information
'''
mapper = salt.cloud.Map(self._opts_defaults())
mapper.opts['selected_query_option'] = 'list_nodes_min'
return mapper.map_providers_parallel(query_type) | [
"Query",
"select",
"instance",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L318-L324 | [
"def",
"min_query",
"(",
"self",
",",
"query_type",
"=",
"'list_nodes_min'",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"mapper",
".",
"opts",
"[",
"'selected_query_option'",
"]",
"=",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.profile | Pass in a profile to create, names is a list of vm names to allocate
vm_overrides is a special dict that will be per node options
overrides
Example:
.. code-block:: python
>>> client= salt.cloud.CloudClient(path='/etc/salt/cloud')
>>> client.profile('d... | salt/cloud/__init__.py | def profile(self, profile, names, vm_overrides=None, **kwargs):
'''
Pass in a profile to create, names is a list of vm names to allocate
vm_overrides is a special dict that will be per node options
overrides
Example:
.. code-block:: python
>>> clie... | def profile(self, profile, names, vm_overrides=None, **kwargs):
'''
Pass in a profile to create, names is a list of vm names to allocate
vm_overrides is a special dict that will be per node options
overrides
Example:
.. code-block:: python
>>> clie... | [
"Pass",
"in",
"a",
"profile",
"to",
"create",
"names",
"is",
"a",
"list",
"of",
"vm",
"names",
"to",
"allocate"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L326-L366 | [
"def",
"profile",
"(",
"self",
",",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"vm_overrides",
":",
"vm_overrides",
"=",
"{",
"}",
"kwargs",
"[",
"'profile'",
"]",
"=",
"profile",
"mapper"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.map_run | To execute a map | salt/cloud/__init__.py | def map_run(self, path=None, **kwargs):
'''
To execute a map
'''
kwarg = {}
if path:
kwarg['map'] = path
kwarg.update(kwargs)
mapper = salt.cloud.Map(self._opts_defaults(**kwarg))
dmap = mapper.map_data()
return salt.utils.data.simple_t... | def map_run(self, path=None, **kwargs):
'''
To execute a map
'''
kwarg = {}
if path:
kwarg['map'] = path
kwarg.update(kwargs)
mapper = salt.cloud.Map(self._opts_defaults(**kwarg))
dmap = mapper.map_data()
return salt.utils.data.simple_t... | [
"To",
"execute",
"a",
"map"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L368-L380 | [
"def",
"map_run",
"(",
"self",
",",
"path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwarg",
"=",
"{",
"}",
"if",
"path",
":",
"kwarg",
"[",
"'map'",
"]",
"=",
"path",
"kwarg",
".",
"update",
"(",
"kwargs",
")",
"mapper",
"=",
"salt",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.destroy | Destroy the named VMs | salt/cloud/__init__.py | def destroy(self, names):
'''
Destroy the named VMs
'''
mapper = salt.cloud.Map(self._opts_defaults(destroy=True))
if isinstance(names, six.string_types):
names = names.split(',')
return salt.utils.data.simple_types_filter(
mapper.destroy(names)
... | def destroy(self, names):
'''
Destroy the named VMs
'''
mapper = salt.cloud.Map(self._opts_defaults(destroy=True))
if isinstance(names, six.string_types):
names = names.split(',')
return salt.utils.data.simple_types_filter(
mapper.destroy(names)
... | [
"Destroy",
"the",
"named",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L382-L391 | [
"def",
"destroy",
"(",
"self",
",",
"names",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
"destroy",
"=",
"True",
")",
")",
"if",
"isinstance",
"(",
"names",
",",
"six",
".",
"string_types",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.create | Create the named VMs, without using a profile
Example:
.. code-block:: python
client.create(provider='my-ec2-config', names=['myinstance'],
image='ami-1624987f', size='t1.micro', ssh_username='ec2-user',
securitygroup='default', delvol_on_destroy=True) | salt/cloud/__init__.py | def create(self, provider, names, **kwargs):
'''
Create the named VMs, without using a profile
Example:
.. code-block:: python
client.create(provider='my-ec2-config', names=['myinstance'],
image='ami-1624987f', size='t1.micro', ssh_username='ec2-user',
... | def create(self, provider, names, **kwargs):
'''
Create the named VMs, without using a profile
Example:
.. code-block:: python
client.create(provider='my-ec2-config', names=['myinstance'],
image='ami-1624987f', size='t1.micro', ssh_username='ec2-user',
... | [
"Create",
"the",
"named",
"VMs",
"without",
"using",
"a",
"profile"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L393-L430 | [
"def",
"create",
"(",
"self",
",",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"providers",
"=",
"self",
".",
"opts",
"[",
"'provid... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.extra_action | Perform actions with block storage devices
Example:
.. code-block:: python
client.extra_action(names=['myblock'], action='volume_create',
provider='my-nova', kwargs={'voltype': 'SSD', 'size': 1000}
)
client.extra_action(names=['salt-net'], action='n... | salt/cloud/__init__.py | def extra_action(self, names, provider, action, **kwargs):
'''
Perform actions with block storage devices
Example:
.. code-block:: python
client.extra_action(names=['myblock'], action='volume_create',
provider='my-nova', kwargs={'voltype': 'SSD', 'size': 10... | def extra_action(self, names, provider, action, **kwargs):
'''
Perform actions with block storage devices
Example:
.. code-block:: python
client.extra_action(names=['myblock'], action='volume_create',
provider='my-nova', kwargs={'voltype': 'SSD', 'size': 10... | [
"Perform",
"actions",
"with",
"block",
"storage",
"devices"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L432-L466 | [
"def",
"extra_action",
"(",
"self",
",",
"names",
",",
"provider",
",",
"action",
",",
"*",
"*",
"kwargs",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"providers",
"=",
"mapper",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | CloudClient.action | Execute a single action via the cloud plugin backend
Examples:
.. code-block:: python
client.action(fun='show_instance', names=['myinstance'])
client.action(fun='show_image', provider='my-ec2-config',
kwargs={'image': 'ami-10314d79'}
) | salt/cloud/__init__.py | def action(
self,
fun=None,
cloudmap=None,
names=None,
provider=None,
instance=None,
kwargs=None
):
'''
Execute a single action via the cloud plugin backend
Examples:
.. code-block:: python
client.action(fun='show... | def action(
self,
fun=None,
cloudmap=None,
names=None,
provider=None,
instance=None,
kwargs=None
):
'''
Execute a single action via the cloud plugin backend
Examples:
.. code-block:: python
client.action(fun='show... | [
"Execute",
"a",
"single",
"action",
"via",
"the",
"cloud",
"plugin",
"backend"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L468-L518 | [
"def",
"action",
"(",
"self",
",",
"fun",
"=",
"None",
",",
"cloudmap",
"=",
"None",
",",
"names",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"instance",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.get_configured_providers | Return the configured providers | salt/cloud/__init__.py | def get_configured_providers(self):
'''
Return the configured providers
'''
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
if len(drivers) > 1:
for driver in drivers:
providers.add('{0}:{1}'.format(al... | def get_configured_providers(self):
'''
Return the configured providers
'''
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
if len(drivers) > 1:
for driver in drivers:
providers.add('{0}:{1}'.format(al... | [
"Return",
"the",
"configured",
"providers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L532-L543 | [
"def",
"get_configured_providers",
"(",
"self",
")",
":",
"providers",
"=",
"set",
"(",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
"[",
"'providers'",
"]",
")",
":",
"if",
"len",
"(",
"drivers",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.lookup_providers | Get a dict describing the configured providers | salt/cloud/__init__.py | def lookup_providers(self, lookup):
'''
Get a dict describing the configured providers
'''
if lookup is None:
lookup = 'all'
if lookup == 'all':
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
for ... | def lookup_providers(self, lookup):
'''
Get a dict describing the configured providers
'''
if lookup is None:
lookup = 'all'
if lookup == 'all':
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
for ... | [
"Get",
"a",
"dict",
"describing",
"the",
"configured",
"providers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L545-L587 | [
"def",
"lookup_providers",
"(",
"self",
",",
"lookup",
")",
":",
"if",
"lookup",
"is",
"None",
":",
"lookup",
"=",
"'all'",
"if",
"lookup",
"==",
"'all'",
":",
"providers",
"=",
"set",
"(",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iter... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.lookup_profiles | Return a dictionary describing the configured profiles | salt/cloud/__init__.py | def lookup_profiles(self, provider, lookup):
'''
Return a dictionary describing the configured profiles
'''
if provider is None:
provider = 'all'
if lookup is None:
lookup = 'all'
if lookup == 'all':
profiles = set()
provid... | def lookup_profiles(self, provider, lookup):
'''
Return a dictionary describing the configured profiles
'''
if provider is None:
provider = 'all'
if lookup is None:
lookup = 'all'
if lookup == 'all':
profiles = set()
provid... | [
"Return",
"a",
"dictionary",
"describing",
"the",
"configured",
"profiles"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L589-L621 | [
"def",
"lookup_profiles",
"(",
"self",
",",
"provider",
",",
"lookup",
")",
":",
"if",
"provider",
"is",
"None",
":",
"provider",
"=",
"'all'",
"if",
"lookup",
"is",
"None",
":",
"lookup",
"=",
"'all'",
"if",
"lookup",
"==",
"'all'",
":",
"profiles",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.map_providers | Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs | salt/cloud/__init__.py | def map_providers(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
'''
if cached is True and query in self.__cached_provider_queries:
retur... | def map_providers(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
'''
if cached is True and query in self.__cached_provider_queries:
retur... | [
"Return",
"a",
"mapping",
"of",
"what",
"named",
"VMs",
"are",
"running",
"on",
"what",
"VM",
"providers",
"based",
"on",
"what",
"providers",
"are",
"defined",
"in",
"the",
"configuration",
"and",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L623-L657 | [
"def",
"map_providers",
"(",
"self",
",",
"query",
"=",
"'list_nodes'",
",",
"cached",
"=",
"False",
")",
":",
"if",
"cached",
"is",
"True",
"and",
"query",
"in",
"self",
".",
"__cached_provider_queries",
":",
"return",
"self",
".",
"__cached_provider_queries"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.map_providers_parallel | Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
Same as map_providers but query in parallel. | salt/cloud/__init__.py | def map_providers_parallel(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
Same as map_providers but query in parallel.
'''
if cached is True... | def map_providers_parallel(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
Same as map_providers but query in parallel.
'''
if cached is True... | [
"Return",
"a",
"mapping",
"of",
"what",
"named",
"VMs",
"are",
"running",
"on",
"what",
"VM",
"providers",
"based",
"on",
"what",
"providers",
"are",
"defined",
"in",
"the",
"configuration",
"and",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L659-L715 | [
"def",
"map_providers_parallel",
"(",
"self",
",",
"query",
"=",
"'list_nodes'",
",",
"cached",
"=",
"False",
")",
":",
"if",
"cached",
"is",
"True",
"and",
"query",
"in",
"self",
".",
"__cached_provider_queries",
":",
"return",
"self",
".",
"__cached_provider... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud._optimize_providers | Return an optimized mapping of available providers | salt/cloud/__init__.py | def _optimize_providers(self, providers):
'''
Return an optimized mapping of available providers
'''
new_providers = {}
provider_by_driver = {}
for alias, driver in six.iteritems(providers):
for name, data in six.iteritems(driver):
if name not... | def _optimize_providers(self, providers):
'''
Return an optimized mapping of available providers
'''
new_providers = {}
provider_by_driver = {}
for alias, driver in six.iteritems(providers):
for name, data in six.iteritems(driver):
if name not... | [
"Return",
"an",
"optimized",
"mapping",
"of",
"available",
"providers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L763-L795 | [
"def",
"_optimize_providers",
"(",
"self",
",",
"providers",
")",
":",
"new_providers",
"=",
"{",
"}",
"provider_by_driver",
"=",
"{",
"}",
"for",
"alias",
",",
"driver",
"in",
"six",
".",
"iteritems",
"(",
"providers",
")",
":",
"for",
"name",
",",
"dat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.image_list | Return a mapping of all image data for available providers | salt/cloud/__init__.py | def image_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
fun = '{0}.avail_images'.fo... | def image_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
fun = '{0}.avail_images'.fo... | [
"Return",
"a",
"mapping",
"of",
"all",
"image",
"data",
"for",
"available",
"providers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L836-L872 | [
"def",
"image_list",
"(",
"self",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_providers",
"(",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for",
"alias",
",",
"driver",
"in",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.provider_list | Return a mapping of all image data for available providers | salt/cloud/__init__.py | def provider_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:
... | def provider_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:
... | [
"Return",
"a",
"mapping",
"of",
"all",
"image",
"data",
"for",
"available",
"providers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L912-L926 | [
"def",
"provider_list",
"(",
"self",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_providers",
"(",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for",
"alias",
",",
"driver",
"in",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.profile_list | Return a mapping of all configured profiles | salt/cloud/__init__.py | def profile_list(self, provider, lookup='all'):
'''
Return a mapping of all configured profiles
'''
data = {}
lookups = self.lookup_profiles(provider, lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:... | def profile_list(self, provider, lookup='all'):
'''
Return a mapping of all configured profiles
'''
data = {}
lookups = self.lookup_profiles(provider, lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:... | [
"Return",
"a",
"mapping",
"of",
"all",
"configured",
"profiles"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L928-L943 | [
"def",
"profile_list",
"(",
"self",
",",
"provider",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_profiles",
"(",
"provider",
",",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.create_all | Create/Verify the VMs in the VM data | salt/cloud/__init__.py | def create_all(self):
'''
Create/Verify the VMs in the VM data
'''
ret = []
for vm_name, vm_details in six.iteritems(self.opts['profiles']):
ret.append(
{vm_name: self.create(vm_details)}
)
return ret | def create_all(self):
'''
Create/Verify the VMs in the VM data
'''
ret = []
for vm_name, vm_details in six.iteritems(self.opts['profiles']):
ret.append(
{vm_name: self.create(vm_details)}
)
return ret | [
"Create",
"/",
"Verify",
"the",
"VMs",
"in",
"the",
"VM",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L945-L956 | [
"def",
"create_all",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"vm_name",
",",
"vm_details",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
"[",
"'profiles'",
"]",
")",
":",
"ret",
".",
"append",
"(",
"{",
"vm_name",
":",
"self"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.destroy | Destroy the named VMs | salt/cloud/__init__.py | def destroy(self, names, cached=False):
'''
Destroy the named VMs
'''
processed = {}
names = set(names)
matching = self.get_running_by_names(names, cached=cached)
vms_to_destroy = set()
parallel_data = []
for alias, drivers in six.iteritems(matchin... | def destroy(self, names, cached=False):
'''
Destroy the named VMs
'''
processed = {}
names = set(names)
matching = self.get_running_by_names(names, cached=cached)
vms_to_destroy = set()
parallel_data = []
for alias, drivers in six.iteritems(matchin... | [
"Destroy",
"the",
"named",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L958-L1138 | [
"def",
"destroy",
"(",
"self",
",",
"names",
",",
"cached",
"=",
"False",
")",
":",
"processed",
"=",
"{",
"}",
"names",
"=",
"set",
"(",
"names",
")",
"matching",
"=",
"self",
".",
"get_running_by_names",
"(",
"names",
",",
"cached",
"=",
"cached",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.reboot | Reboot the named VMs | salt/cloud/__init__.py | def reboot(self, names):
'''
Reboot the named VMs
'''
ret = []
pmap = self.map_providers_parallel()
acts = {}
for prov, nodes in six.iteritems(pmap):
acts[prov] = []
for node in nodes:
if node in names:
a... | def reboot(self, names):
'''
Reboot the named VMs
'''
ret = []
pmap = self.map_providers_parallel()
acts = {}
for prov, nodes in six.iteritems(pmap):
acts[prov] = []
for node in nodes:
if node in names:
a... | [
"Reboot",
"the",
"named",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1140-L1159 | [
"def",
"reboot",
"(",
"self",
",",
"names",
")",
":",
"ret",
"=",
"[",
"]",
"pmap",
"=",
"self",
".",
"map_providers_parallel",
"(",
")",
"acts",
"=",
"{",
"}",
"for",
"prov",
",",
"nodes",
"in",
"six",
".",
"iteritems",
"(",
"pmap",
")",
":",
"a... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.create | Create a single VM | salt/cloud/__init__.py | def create(self, vm_, local_master=True):
'''
Create a single VM
'''
output = {}
minion_dict = salt.config.get_cloud_config_value(
'minion', vm_, self.opts, default={}
)
alias, driver = vm_['provider'].split(':')
fun = '{0}.create'.format(dri... | def create(self, vm_, local_master=True):
'''
Create a single VM
'''
output = {}
minion_dict = salt.config.get_cloud_config_value(
'minion', vm_, self.opts, default={}
)
alias, driver = vm_['provider'].split(':')
fun = '{0}.create'.format(dri... | [
"Create",
"a",
"single",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1161-L1316 | [
"def",
"create",
"(",
"self",
",",
"vm_",
",",
"local_master",
"=",
"True",
")",
":",
"output",
"=",
"{",
"}",
"minion_dict",
"=",
"salt",
".",
"config",
".",
"get_cloud_config_value",
"(",
"'minion'",
",",
"vm_",
",",
"self",
".",
"opts",
",",
"defaul... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.vm_config | Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The vm's config overrides | salt/cloud/__init__.py | def vm_config(name, main, provider, profile, overrides):
'''
Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The... | def vm_config(name, main, provider, profile, overrides):
'''
Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The... | [
"Create",
"vm",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1319-L1334 | [
"def",
"vm_config",
"(",
"name",
",",
"main",
",",
"provider",
",",
"profile",
",",
"overrides",
")",
":",
"vm",
"=",
"main",
".",
"copy",
"(",
")",
"vm",
"=",
"salt",
".",
"utils",
".",
"dictupdate",
".",
"update",
"(",
"vm",
",",
"provider",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.extras | Extra actions | salt/cloud/__init__.py | def extras(self, extra_):
'''
Extra actions
'''
output = {}
alias, driver = extra_['provider'].split(':')
fun = '{0}.{1}'.format(driver, extra_['action'])
if fun not in self.clouds:
log.error(
'Creating \'%s\' using \'%s\' as the provi... | def extras(self, extra_):
'''
Extra actions
'''
output = {}
alias, driver = extra_['provider'].split(':')
fun = '{0}.{1}'.format(driver, extra_['action'])
if fun not in self.clouds:
log.error(
'Creating \'%s\' using \'%s\' as the provi... | [
"Extra",
"actions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1336-L1364 | [
"def",
"extras",
"(",
"self",
",",
"extra_",
")",
":",
"output",
"=",
"{",
"}",
"alias",
",",
"driver",
"=",
"extra_",
"[",
"'provider'",
"]",
".",
"split",
"(",
"':'",
")",
"fun",
"=",
"'{0}.{1}'",
".",
"format",
"(",
"driver",
",",
"extra_",
"[",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.run_profile | Parse over the options passed on the command line and determine how to
handle them | salt/cloud/__init__.py | def run_profile(self, profile, names, vm_overrides=None):
'''
Parse over the options passed on the command line and determine how to
handle them
'''
if profile not in self.opts['profiles']:
msg = 'Profile {0} is not defined'.format(profile)
log.error(msg)
... | def run_profile(self, profile, names, vm_overrides=None):
'''
Parse over the options passed on the command line and determine how to
handle them
'''
if profile not in self.opts['profiles']:
msg = 'Profile {0} is not defined'.format(profile)
log.error(msg)
... | [
"Parse",
"over",
"the",
"options",
"passed",
"on",
"the",
"command",
"line",
"and",
"determine",
"how",
"to",
"handle",
"them"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1366-L1453 | [
"def",
"run_profile",
"(",
"self",
",",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
")",
":",
"if",
"profile",
"not",
"in",
"self",
".",
"opts",
"[",
"'profiles'",
"]",
":",
"msg",
"=",
"'Profile {0} is not defined'",
".",
"format",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.do_action | Perform an action on a VM which may be specific to this cloud provider | salt/cloud/__init__.py | def do_action(self, names, kwargs):
'''
Perform an action on a VM which may be specific to this cloud provider
'''
ret = {}
invalid_functions = {}
names = set(names)
for alias, drivers in six.iteritems(self.map_providers_parallel()):
if not names:
... | def do_action(self, names, kwargs):
'''
Perform an action on a VM which may be specific to this cloud provider
'''
ret = {}
invalid_functions = {}
names = set(names)
for alias, drivers in six.iteritems(self.map_providers_parallel()):
if not names:
... | [
"Perform",
"an",
"action",
"on",
"a",
"VM",
"which",
"may",
"be",
"specific",
"to",
"this",
"cloud",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1455-L1547 | [
"def",
"do_action",
"(",
"self",
",",
"names",
",",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"invalid_functions",
"=",
"{",
"}",
"names",
"=",
"set",
"(",
"names",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iteritems",
"(",
"self",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.do_function | Perform a function against a cloud provider | salt/cloud/__init__.py | def do_function(self, prov, func, kwargs):
'''
Perform a function against a cloud provider
'''
matches = self.lookup_providers(prov)
if len(matches) > 1:
raise SaltCloudSystemExit(
'More than one results matched \'{0}\'. Please specify '
... | def do_function(self, prov, func, kwargs):
'''
Perform a function against a cloud provider
'''
matches = self.lookup_providers(prov)
if len(matches) > 1:
raise SaltCloudSystemExit(
'More than one results matched \'{0}\'. Please specify '
... | [
"Perform",
"a",
"function",
"against",
"a",
"cloud",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1549-L1595 | [
"def",
"do_function",
"(",
"self",
",",
"prov",
",",
"func",
",",
"kwargs",
")",
":",
"matches",
"=",
"self",
".",
"lookup_providers",
"(",
"prov",
")",
"if",
"len",
"(",
"matches",
")",
">",
"1",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'More than one... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Cloud.__filter_non_working_providers | Remove any mis-configured cloud providers from the available listing | salt/cloud/__init__.py | def __filter_non_working_providers(self):
'''
Remove any mis-configured cloud providers from the available listing
'''
for alias, drivers in six.iteritems(self.opts['providers'].copy()):
for driver in drivers.copy():
fun = '{0}.get_configured_provider'.format(... | def __filter_non_working_providers(self):
'''
Remove any mis-configured cloud providers from the available listing
'''
for alias, drivers in six.iteritems(self.opts['providers'].copy()):
for driver in drivers.copy():
fun = '{0}.get_configured_provider'.format(... | [
"Remove",
"any",
"mis",
"-",
"configured",
"cloud",
"providers",
"from",
"the",
"available",
"listing"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1597-L1643 | [
"def",
"__filter_non_working_providers",
"(",
"self",
")",
":",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
"[",
"'providers'",
"]",
".",
"copy",
"(",
")",
")",
":",
"for",
"driver",
"in",
"drivers",
".",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Map.read | Read in the specified map and return the map structure | salt/cloud/__init__.py | def read(self):
'''
Read in the specified map and return the map structure
'''
map_ = None
if self.opts.get('map', None) is None:
if self.opts.get('map_data', None) is None:
if self.opts.get('map_pillar', None) is None:
pass
... | def read(self):
'''
Read in the specified map and return the map structure
'''
map_ = None
if self.opts.get('map', None) is None:
if self.opts.get('map_data', None) is None:
if self.opts.get('map_pillar', None) is None:
pass
... | [
"Read",
"in",
"the",
"specified",
"map",
"and",
"return",
"the",
"map",
"structure"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1742-L1857 | [
"def",
"read",
"(",
"self",
")",
":",
"map_",
"=",
"None",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'map'",
",",
"None",
")",
"is",
"None",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'map_data'",
",",
"None",
")",
"is",
"None",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Map.map_data | Create a data map of what to execute on | salt/cloud/__init__.py | def map_data(self, cached=False):
'''
Create a data map of what to execute on
'''
ret = {'create': {}}
pmap = self.map_providers_parallel(cached=cached)
exist = set()
defined = set()
rendered_map = copy.deepcopy(self.rendered_map)
for profile_name,... | def map_data(self, cached=False):
'''
Create a data map of what to execute on
'''
ret = {'create': {}}
pmap = self.map_providers_parallel(cached=cached)
exist = set()
defined = set()
rendered_map = copy.deepcopy(self.rendered_map)
for profile_name,... | [
"Create",
"a",
"data",
"map",
"of",
"what",
"to",
"execute",
"on"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1905-L2029 | [
"def",
"map_data",
"(",
"self",
",",
"cached",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'create'",
":",
"{",
"}",
"}",
"pmap",
"=",
"self",
".",
"map_providers_parallel",
"(",
"cached",
"=",
"cached",
")",
"exist",
"=",
"set",
"(",
")",
"defined",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Map.run_map | Execute the contents of the VM map | salt/cloud/__init__.py | def run_map(self, dmap):
'''
Execute the contents of the VM map
'''
if self._has_loop(dmap):
msg = 'Uh-oh, that cloud map has a dependency loop!'
log.error(msg)
raise SaltCloudException(msg)
# Go through the create list and calc dependencies
... | def run_map(self, dmap):
'''
Execute the contents of the VM map
'''
if self._has_loop(dmap):
msg = 'Uh-oh, that cloud map has a dependency loop!'
log.error(msg)
raise SaltCloudException(msg)
# Go through the create list and calc dependencies
... | [
"Execute",
"the",
"contents",
"of",
"the",
"VM",
"map"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2031-L2293 | [
"def",
"run_map",
"(",
"self",
",",
"dmap",
")",
":",
"if",
"self",
".",
"_has_loop",
"(",
"dmap",
")",
":",
"msg",
"=",
"'Uh-oh, that cloud map has a dependency loop!'",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"SaltCloudException",
"(",
"msg",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_user_info | Wrapper for user.info Salt function | salt/modules/gpg.py | def _get_user_info(user=None):
'''
Wrapper for user.info Salt function
'''
if not user:
# Get user Salt runnining as
user = __salt__['config.option']('user')
userinfo = __salt__['user.info'](user)
if not userinfo:
if user == 'salt':
# Special case with `salt... | def _get_user_info(user=None):
'''
Wrapper for user.info Salt function
'''
if not user:
# Get user Salt runnining as
user = __salt__['config.option']('user')
userinfo = __salt__['user.info'](user)
if not userinfo:
if user == 'salt':
# Special case with `salt... | [
"Wrapper",
"for",
"user",
".",
"info",
"Salt",
"function"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L104-L122 | [
"def",
"_get_user_info",
"(",
"user",
"=",
"None",
")",
":",
"if",
"not",
"user",
":",
"# Get user Salt runnining as",
"user",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'user'",
")",
"userinfo",
"=",
"__salt__",
"[",
"'user.info'",
"]",
"(",
"user"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_user_gnupghome | Return default GnuPG home directory path for a user | salt/modules/gpg.py | def _get_user_gnupghome(user):
'''
Return default GnuPG home directory path for a user
'''
if user == 'salt':
gnupghome = os.path.join(__salt__['config.get']('config_dir'), 'gpgkeys')
else:
gnupghome = os.path.join(_get_user_info(user)['home'], '.gnupg')
return gnupghome | def _get_user_gnupghome(user):
'''
Return default GnuPG home directory path for a user
'''
if user == 'salt':
gnupghome = os.path.join(__salt__['config.get']('config_dir'), 'gpgkeys')
else:
gnupghome = os.path.join(_get_user_info(user)['home'], '.gnupg')
return gnupghome | [
"Return",
"default",
"GnuPG",
"home",
"directory",
"path",
"for",
"a",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L125-L134 | [
"def",
"_get_user_gnupghome",
"(",
"user",
")",
":",
"if",
"user",
"==",
"'salt'",
":",
"gnupghome",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'config_dir'",
")",
",",
"'gpgkeys'",
")",
"else",
":",
"gnupghome"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _create_gpg | Create the GPG object | salt/modules/gpg.py | def _create_gpg(user=None, gnupghome=None):
'''
Create the GPG object
'''
if not gnupghome:
gnupghome = _get_user_gnupghome(user)
if GPG_1_3_1:
gpg = gnupg.GPG(homedir=gnupghome)
else:
gpg = gnupg.GPG(gnupghome=gnupghome)
return gpg | def _create_gpg(user=None, gnupghome=None):
'''
Create the GPG object
'''
if not gnupghome:
gnupghome = _get_user_gnupghome(user)
if GPG_1_3_1:
gpg = gnupg.GPG(homedir=gnupghome)
else:
gpg = gnupg.GPG(gnupghome=gnupghome)
return gpg | [
"Create",
"the",
"GPG",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L176-L188 | [
"def",
"_create_gpg",
"(",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"if",
"not",
"gnupghome",
":",
"gnupghome",
"=",
"_get_user_gnupghome",
"(",
"user",
")",
"if",
"GPG_1_3_1",
":",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
"homedir",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _list_keys | Helper function for Listing keys | salt/modules/gpg.py | def _list_keys(user=None, gnupghome=None, secret=False):
'''
Helper function for Listing keys
'''
gpg = _create_gpg(user, gnupghome)
_keys = gpg.list_keys(secret)
return _keys | def _list_keys(user=None, gnupghome=None, secret=False):
'''
Helper function for Listing keys
'''
gpg = _create_gpg(user, gnupghome)
_keys = gpg.list_keys(secret)
return _keys | [
"Helper",
"function",
"for",
"Listing",
"keys"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L191-L197 | [
"def",
"_list_keys",
"(",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
",",
"secret",
"=",
"False",
")",
":",
"gpg",
"=",
"_create_gpg",
"(",
"user",
",",
"gnupghome",
")",
"_keys",
"=",
"gpg",
".",
"list_keys",
"(",
"secret",
")",
"return",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _search_keys | Helper function for searching keys from keyserver | salt/modules/gpg.py | def _search_keys(text, keyserver, user=None):
'''
Helper function for searching keys from keyserver
'''
gpg = _create_gpg(user)
if keyserver:
_keys = gpg.search_keys(text, keyserver)
else:
_keys = gpg.search_keys(text)
return _keys | def _search_keys(text, keyserver, user=None):
'''
Helper function for searching keys from keyserver
'''
gpg = _create_gpg(user)
if keyserver:
_keys = gpg.search_keys(text, keyserver)
else:
_keys = gpg.search_keys(text)
return _keys | [
"Helper",
"function",
"for",
"searching",
"keys",
"from",
"keyserver"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L200-L209 | [
"def",
"_search_keys",
"(",
"text",
",",
"keyserver",
",",
"user",
"=",
"None",
")",
":",
"gpg",
"=",
"_create_gpg",
"(",
"user",
")",
"if",
"keyserver",
":",
"_keys",
"=",
"gpg",
".",
"search_keys",
"(",
"text",
",",
"keyserver",
")",
"else",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | search_keys | Search keys from keyserver
text
Text to search the keyserver for, e.g. email address, keyID or fingerprint.
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu.
user
Which user's keychain to access, defaults to user Salt is running as.
Passing th... | salt/modules/gpg.py | def search_keys(text, keyserver=None, user=None):
'''
Search keys from keyserver
text
Text to search the keyserver for, e.g. email address, keyID or fingerprint.
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu.
user
Which user's keychain to a... | def search_keys(text, keyserver=None, user=None):
'''
Search keys from keyserver
text
Text to search the keyserver for, e.g. email address, keyID or fingerprint.
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu.
user
Which user's keychain to a... | [
"Search",
"keys",
"from",
"keyserver"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L212-L262 | [
"def",
"search_keys",
"(",
"text",
",",
"keyserver",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"if",
"GPG_1_3_1",
":",
"raise",
"SaltInvocationError",
"(",
"'The search_keys function is not support with this version of python-gnupg.'",
")",
"else",
":",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_keys | List keys in GPG keychain
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
gnupghome
Specify the location where GPG keyring and related files are stored.
... | salt/modules/gpg.py | def list_keys(user=None, gnupghome=None):
'''
List keys in GPG keychain
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
gnupghome
Specify the location... | def list_keys(user=None, gnupghome=None):
'''
List keys in GPG keychain
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
gnupghome
Specify the location... | [
"List",
"keys",
"in",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L265-L309 | [
"def",
"list_keys",
"(",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"_keys",
"=",
"[",
"]",
"for",
"_key",
"in",
"_list_keys",
"(",
"user",
",",
"gnupghome",
")",
":",
"tmp",
"=",
"{",
"'keyid'",
":",
"_key",
"[",
"'keyid'",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_key | Create a key in the GPG keychain
.. note::
GPG key generation requires *a lot* of entropy and randomness.
Difficult to do over a remote connection, consider having
another process available which is generating randomness for
the machine. Also especially difficult on virtual machin... | salt/modules/gpg.py | def create_key(key_type='RSA',
key_length=1024,
name_real='Autogenerated Key',
name_comment='Generated by SaltStack',
name_email=None,
subkey_type=None,
subkey_length=None,
expire_date=None,
use_passp... | def create_key(key_type='RSA',
key_length=1024,
name_real='Autogenerated Key',
name_comment='Generated by SaltStack',
name_email=None,
subkey_type=None,
subkey_length=None,
expire_date=None,
use_passp... | [
"Create",
"a",
"key",
"in",
"the",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L360-L477 | [
"def",
"create_key",
"(",
"key_type",
"=",
"'RSA'",
",",
"key_length",
"=",
"1024",
",",
"name_real",
"=",
"'Autogenerated Key'",
",",
"name_comment",
"=",
"'Generated by SaltStack'",
",",
"name_email",
"=",
"None",
",",
"subkey_type",
"=",
"None",
",",
"subkey_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_key | Get a key from the GPG keychain
keyid
The keyid of the key to be deleted.
fingerprint
The fingerprint of the key to be deleted.
delete_secret
Whether to delete a corresponding secret key prior to deleting the public key.
Secret keys must be deleted before deleting any corr... | salt/modules/gpg.py | def delete_key(keyid=None,
fingerprint=None,
delete_secret=False,
user=None,
gnupghome=None):
'''
Get a key from the GPG keychain
keyid
The keyid of the key to be deleted.
fingerprint
The fingerprint of the key to be deleted.
... | def delete_key(keyid=None,
fingerprint=None,
delete_secret=False,
user=None,
gnupghome=None):
'''
Get a key from the GPG keychain
keyid
The keyid of the key to be deleted.
fingerprint
The fingerprint of the key to be deleted.
... | [
"Get",
"a",
"key",
"from",
"the",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L480-L555 | [
"def",
"delete_key",
"(",
"keyid",
"=",
"None",
",",
"fingerprint",
"=",
"None",
",",
"delete_secret",
"=",
"False",
",",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
",",
"'message'",
":",
"''"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_key | Get a key from the GPG keychain
keyid
The key ID (short or long) of the key to be retrieved.
fingerprint
The fingerprint of the key to be retrieved.
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG h... | salt/modules/gpg.py | def get_key(keyid=None, fingerprint=None, user=None, gnupghome=None):
'''
Get a key from the GPG keychain
keyid
The key ID (short or long) of the key to be retrieved.
fingerprint
The fingerprint of the key to be retrieved.
user
Which user's keychain to access, defaults to ... | def get_key(keyid=None, fingerprint=None, user=None, gnupghome=None):
'''
Get a key from the GPG keychain
keyid
The key ID (short or long) of the key to be retrieved.
fingerprint
The fingerprint of the key to be retrieved.
user
Which user's keychain to access, defaults to ... | [
"Get",
"a",
"key",
"from",
"the",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L558-L617 | [
"def",
"get_key",
"(",
"keyid",
"=",
"None",
",",
"fingerprint",
"=",
"None",
",",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"tmp",
"=",
"{",
"}",
"for",
"_key",
"in",
"_list_keys",
"(",
"user",
",",
"gnupghome",
")",
":",
"if",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | import_key | r'''
Import a key from text or file
text
The text containing to import.
filename
The filename containing the key to import.
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
... | salt/modules/gpg.py | def import_key(text=None,
filename=None,
user=None,
gnupghome=None):
r'''
Import a key from text or file
text
The text containing to import.
filename
The filename containing the key to import.
user
Which user's keychain to acces... | def import_key(text=None,
filename=None,
user=None,
gnupghome=None):
r'''
Import a key from text or file
text
The text containing to import.
filename
The filename containing the key to import.
user
Which user's keychain to acces... | [
"r",
"Import",
"a",
"key",
"from",
"text",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L683-L755 | [
"def",
"import_key",
"(",
"text",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
",",
"'message'",
":",
"''",
"}",
"gpg",
"=",
"_create_gpg",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | export_key | Export a key from the GPG keychain
keyids
The key ID(s) of the key(s) to be exported. Can be specified as a comma
separated string or a list. Anything which GnuPG itself accepts to
identify a key - for example, the key ID or the fingerprint could be
used.
secret
Export ... | salt/modules/gpg.py | def export_key(keyids=None, secret=False, user=None, gnupghome=None):
'''
Export a key from the GPG keychain
keyids
The key ID(s) of the key(s) to be exported. Can be specified as a comma
separated string or a list. Anything which GnuPG itself accepts to
identify a key - for example... | def export_key(keyids=None, secret=False, user=None, gnupghome=None):
'''
Export a key from the GPG keychain
keyids
The key ID(s) of the key(s) to be exported. Can be specified as a comma
separated string or a list. Anything which GnuPG itself accepts to
identify a key - for example... | [
"Export",
"a",
"key",
"from",
"the",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L758-L794 | [
"def",
"export_key",
"(",
"keyids",
"=",
"None",
",",
"secret",
"=",
"False",
",",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"gpg",
"=",
"_create_gpg",
"(",
"user",
",",
"gnupghome",
")",
"if",
"isinstance",
"(",
"keyids",
",",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | receive_keys | Receive key(s) from keyserver and add them to keychain
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu
keys
The keyID(s) to retrieve from the keyserver. Can be specified as a comma
separated string or a list.
user
Which user's keychain to ac... | salt/modules/gpg.py | def receive_keys(keyserver=None, keys=None, user=None, gnupghome=None):
'''
Receive key(s) from keyserver and add them to keychain
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu
keys
The keyID(s) to retrieve from the keyserver. Can be specified as a com... | def receive_keys(keyserver=None, keys=None, user=None, gnupghome=None):
'''
Receive key(s) from keyserver and add them to keychain
keyserver
Keyserver to use for searching for GPG keys, defaults to pgp.mit.edu
keys
The keyID(s) to retrieve from the keyserver. Can be specified as a com... | [
"Receive",
"key",
"(",
"s",
")",
"from",
"keyserver",
"and",
"add",
"them",
"to",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L798-L851 | [
"def",
"receive_keys",
"(",
"keyserver",
"=",
"None",
",",
"keys",
"=",
"None",
",",
"user",
"=",
"None",
",",
"gnupghome",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'message'",
":",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | trust_key | Set the trust level for a key in GPG keychain
keyid
The keyid of the key to set the trust level for.
fingerprint
The fingerprint of the key to set the trust level for.
trust_level
The trust level to set for the specified key, must be one
of the following:
expired, ... | salt/modules/gpg.py | def trust_key(keyid=None,
fingerprint=None,
trust_level=None,
user=None):
'''
Set the trust level for a key in GPG keychain
keyid
The keyid of the key to set the trust level for.
fingerprint
The fingerprint of the key to set the trust level for... | def trust_key(keyid=None,
fingerprint=None,
trust_level=None,
user=None):
'''
Set the trust level for a key in GPG keychain
keyid
The keyid of the key to set the trust level for.
fingerprint
The fingerprint of the key to set the trust level for... | [
"Set",
"the",
"trust",
"level",
"for",
"a",
"key",
"in",
"GPG",
"keychain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L854-L951 | [
"def",
"trust_key",
"(",
"keyid",
"=",
"None",
",",
"fingerprint",
"=",
"None",
",",
"trust_level",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
",",
"'message'",
":",
"''",
"}",
"_VALID_TRUST_LEVELS",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sign | Sign message or file
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
keyid
The keyid of the key to set the trust level for, defaults to
first key in t... | salt/modules/gpg.py | def sign(user=None,
keyid=None,
text=None,
filename=None,
output=None,
use_passphrase=False,
gnupghome=None):
'''
Sign message or file
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`... | def sign(user=None,
keyid=None,
text=None,
filename=None,
output=None,
use_passphrase=False,
gnupghome=None):
'''
Sign message or file
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`... | [
"Sign",
"message",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L954-L1027 | [
"def",
"sign",
"(",
"user",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"text",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"output",
"=",
"None",
",",
"use_passphrase",
"=",
"False",
",",
"gnupghome",
"=",
"None",
")",
":",
"gpg",
"=",
"_crea... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | verify | Verify a message or file
text
The text to verify.
filename
The filename to verify.
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
gnupghome... | salt/modules/gpg.py | def verify(text=None,
user=None,
filename=None,
gnupghome=None,
signature=None,
trustmodel=None):
'''
Verify a message or file
text
The text to verify.
filename
The filename to verify.
user
Which user's keychain to acc... | def verify(text=None,
user=None,
filename=None,
gnupghome=None,
signature=None,
trustmodel=None):
'''
Verify a message or file
text
The text to verify.
filename
The filename to verify.
user
Which user's keychain to acc... | [
"Verify",
"a",
"message",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L1030-L1117 | [
"def",
"verify",
"(",
"text",
"=",
"None",
",",
"user",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"gnupghome",
"=",
"None",
",",
"signature",
"=",
"None",
",",
"trustmodel",
"=",
"None",
")",
":",
"gpg",
"=",
"_create_gpg",
"(",
"user",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | encrypt | Encrypt a message or file
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
recipients
The fingerprints for those recipient whom the data is being encrypted for... | salt/modules/gpg.py | def encrypt(user=None,
recipients=None,
text=None,
filename=None,
output=None,
sign=None,
use_passphrase=False,
gnupghome=None,
bare=False):
'''
Encrypt a message or file
user
Which user's keychain to ac... | def encrypt(user=None,
recipients=None,
text=None,
filename=None,
output=None,
sign=None,
use_passphrase=False,
gnupghome=None,
bare=False):
'''
Encrypt a message or file
user
Which user's keychain to ac... | [
"Encrypt",
"a",
"message",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L1120-L1223 | [
"def",
"encrypt",
"(",
"user",
"=",
"None",
",",
"recipients",
"=",
"None",
",",
"text",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"output",
"=",
"None",
",",
"sign",
"=",
"None",
",",
"use_passphrase",
"=",
"False",
",",
"gnupghome",
"=",
"Non... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | decrypt | Decrypt a message or file
user
Which user's keychain to access, defaults to user Salt is running as.
Passing the user as ``salt`` will set the GnuPG home directory to the
``/etc/salt/gpgkeys``.
text
The encrypted text to decrypt.
filename
The encrypted filename to ... | salt/modules/gpg.py | def decrypt(user=None,
text=None,
filename=None,
output=None,
use_passphrase=False,
gnupghome=None,
bare=False):
'''
Decrypt a message or file
user
Which user's keychain to access, defaults to user Salt is running as.
P... | def decrypt(user=None,
text=None,
filename=None,
output=None,
use_passphrase=False,
gnupghome=None,
bare=False):
'''
Decrypt a message or file
user
Which user's keychain to access, defaults to user Salt is running as.
P... | [
"Decrypt",
"a",
"message",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L1226-L1311 | [
"def",
"decrypt",
"(",
"user",
"=",
"None",
",",
"text",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"output",
"=",
"None",
",",
"use_passphrase",
"=",
"False",
",",
"gnupghome",
"=",
"None",
",",
"bare",
"=",
"False",
")",
":",
"ret",
"=",
"{"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pack | .. versionadded:: 2018.3.4
Wraps msgpack.pack and ensures that the passed object is unwrapped if it is
a proxy.
By default, this function uses the msgpack module and falls back to
msgpack_pure, if the msgpack is not available. You can pass an alternate
msgpack module using the _msgpack_module argu... | salt/utils/msgpack.py | def pack(o, stream, **kwargs):
'''
.. versionadded:: 2018.3.4
Wraps msgpack.pack and ensures that the passed object is unwrapped if it is
a proxy.
By default, this function uses the msgpack module and falls back to
msgpack_pure, if the msgpack is not available. You can pass an alternate
ms... | def pack(o, stream, **kwargs):
'''
.. versionadded:: 2018.3.4
Wraps msgpack.pack and ensures that the passed object is unwrapped if it is
a proxy.
By default, this function uses the msgpack module and falls back to
msgpack_pure, if the msgpack is not available. You can pass an alternate
ms... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"4"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/msgpack.py#L20-L38 | [
"def",
"pack",
"(",
"o",
",",
"stream",
",",
"*",
"*",
"kwargs",
")",
":",
"msgpack_module",
"=",
"kwargs",
".",
"pop",
"(",
"'_msgpack_module'",
",",
"msgpack",
")",
"orig_enc_func",
"=",
"kwargs",
".",
"pop",
"(",
"'default'",
",",
"lambda",
"x",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.