repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/renderers/aws_kms.py | _plaintext_data_key | def _plaintext_data_key():
'''
Return the configured KMS data key decrypted and encoded in urlsafe base64.
Cache the result to minimize API calls to AWS.
'''
response = getattr(_plaintext_data_key, 'response', None)
cache_hit = response is not None
if not cache_hit:
response = _api_... | python | def _plaintext_data_key():
'''
Return the configured KMS data key decrypted and encoded in urlsafe base64.
Cache the result to minimize API calls to AWS.
'''
response = getattr(_plaintext_data_key, 'response', None)
cache_hit = response is not None
if not cache_hit:
response = _api_... | [
"def",
"_plaintext_data_key",
"(",
")",
":",
"response",
"=",
"getattr",
"(",
"_plaintext_data_key",
",",
"'response'",
",",
"None",
")",
"cache_hit",
"=",
"response",
"is",
"not",
"None",
"if",
"not",
"cache_hit",
":",
"response",
"=",
"_api_decrypt",
"(",
... | Return the configured KMS data key decrypted and encoded in urlsafe base64.
Cache the result to minimize API calls to AWS. | [
"Return",
"the",
"configured",
"KMS",
"data",
"key",
"decrypted",
"and",
"encoded",
"in",
"urlsafe",
"base64",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L179-L195 | train |
saltstack/salt | salt/renderers/aws_kms.py | _decrypt_ciphertext | def _decrypt_ciphertext(cipher, translate_newlines=False):
'''
Given a blob of ciphertext as a bytestring, try to decrypt
the cipher and return the decrypted string. If the cipher cannot be
decrypted, log the error, and return the ciphertext back out.
'''
if translate_newlines:
cipher = ... | python | def _decrypt_ciphertext(cipher, translate_newlines=False):
'''
Given a blob of ciphertext as a bytestring, try to decrypt
the cipher and return the decrypted string. If the cipher cannot be
decrypted, log the error, and return the ciphertext back out.
'''
if translate_newlines:
cipher = ... | [
"def",
"_decrypt_ciphertext",
"(",
"cipher",
",",
"translate_newlines",
"=",
"False",
")",
":",
"if",
"translate_newlines",
":",
"cipher",
"=",
"cipher",
".",
"replace",
"(",
"r'\\n'",
",",
"'\\n'",
")",
"if",
"hasattr",
"(",
"cipher",
",",
"'encode'",
")",
... | Given a blob of ciphertext as a bytestring, try to decrypt
the cipher and return the decrypted string. If the cipher cannot be
decrypted, log the error, and return the ciphertext back out. | [
"Given",
"a",
"blob",
"of",
"ciphertext",
"as",
"a",
"bytestring",
"try",
"to",
"decrypt",
"the",
"cipher",
"and",
"return",
"the",
"decrypted",
"string",
".",
"If",
"the",
"cipher",
"cannot",
"be",
"decrypted",
"log",
"the",
"error",
"and",
"return",
"the... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L206-L222 | train |
saltstack/salt | salt/renderers/aws_kms.py | _decrypt_object | def _decrypt_object(obj, translate_newlines=False):
'''
Recursively try to decrypt any object.
Recur on objects that are not strings.
Decrypt strings that are valid Fernet tokens.
Return the rest unchanged.
'''
if salt.utils.stringio.is_readable(obj):
return _decrypt_object(obj.getva... | python | def _decrypt_object(obj, translate_newlines=False):
'''
Recursively try to decrypt any object.
Recur on objects that are not strings.
Decrypt strings that are valid Fernet tokens.
Return the rest unchanged.
'''
if salt.utils.stringio.is_readable(obj):
return _decrypt_object(obj.getva... | [
"def",
"_decrypt_object",
"(",
"obj",
",",
"translate_newlines",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"stringio",
".",
"is_readable",
"(",
"obj",
")",
":",
"return",
"_decrypt_object",
"(",
"obj",
".",
"getvalue",
"(",
")",
",",
"tran... | Recursively try to decrypt any object.
Recur on objects that are not strings.
Decrypt strings that are valid Fernet tokens.
Return the rest unchanged. | [
"Recursively",
"try",
"to",
"decrypt",
"any",
"object",
".",
"Recur",
"on",
"objects",
"that",
"are",
"not",
"strings",
".",
"Decrypt",
"strings",
"that",
"are",
"valid",
"Fernet",
"tokens",
".",
"Return",
"the",
"rest",
"unchanged",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L225-L252 | train |
saltstack/salt | salt/renderers/aws_kms.py | render | def render(data, saltenv='base', sls='', argline='', **kwargs): # pylint: disable=unused-argument
'''
Decrypt the data to be rendered that was encrypted using AWS KMS envelope encryption.
'''
translate_newlines = kwargs.get('translate_newlines', False)
return _decrypt_object(data, translate_newline... | python | def render(data, saltenv='base', sls='', argline='', **kwargs): # pylint: disable=unused-argument
'''
Decrypt the data to be rendered that was encrypted using AWS KMS envelope encryption.
'''
translate_newlines = kwargs.get('translate_newlines', False)
return _decrypt_object(data, translate_newline... | [
"def",
"render",
"(",
"data",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"argline",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"translate_newlines",
"=",
"kwargs",
".",
"get",
"(",
"'translate_newlines'... | Decrypt the data to be rendered that was encrypted using AWS KMS envelope encryption. | [
"Decrypt",
"the",
"data",
"to",
"be",
"rendered",
"that",
"was",
"encrypted",
"using",
"AWS",
"KMS",
"envelope",
"encryption",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L255-L260 | train |
saltstack/salt | salt/modules/grains.py | _serial_sanitizer | def _serial_sanitizer(instr):
'''Replaces the last 1/4 of a string with X's'''
length = len(instr)
index = int(math.floor(length * .75))
return '{0}{1}'.format(instr[:index], 'X' * (length - index)) | python | def _serial_sanitizer(instr):
'''Replaces the last 1/4 of a string with X's'''
length = len(instr)
index = int(math.floor(length * .75))
return '{0}{1}'.format(instr[:index], 'X' * (length - index)) | [
"def",
"_serial_sanitizer",
"(",
"instr",
")",
":",
"length",
"=",
"len",
"(",
"instr",
")",
"index",
"=",
"int",
"(",
"math",
".",
"floor",
"(",
"length",
"*",
".75",
")",
")",
"return",
"'{0}{1}'",
".",
"format",
"(",
"instr",
"[",
":",
"index",
... | Replaces the last 1/4 of a string with X's | [
"Replaces",
"the",
"last",
"1",
"/",
"4",
"of",
"a",
"string",
"with",
"X",
"s"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L55-L59 | train |
saltstack/salt | salt/modules/grains.py | get | def get(key, default='', delimiter=DEFAULT_TARGET_DELIM, ordered=True):
'''
Attempt to retrieve the named value from grains, if the named value is not
available return the passed default. The default return is an empty string.
The value can also represent a value in a nested dict using a ":" delimiter
... | python | def get(key, default='', delimiter=DEFAULT_TARGET_DELIM, ordered=True):
'''
Attempt to retrieve the named value from grains, if the named value is not
available return the passed default. The default return is an empty string.
The value can also represent a value in a nested dict using a ":" delimiter
... | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"''",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered",
"=",
"True",
")",
":",
"if",
"ordered",
"is",
"True",
":",
"grains",
"=",
"__grains__",
"else",
":",
"grains",
"=",
"salt",
".",
"utils"... | Attempt to retrieve the named value from grains, if the named value is not
available return the passed default. The default return is an empty string.
The value can also represent a value in a nested dict using a ":" delimiter
for the dict. This means that if a dict in grains looks like this::
{'p... | [
"Attempt",
"to",
"retrieve",
"the",
"named",
"value",
"from",
"grains",
"if",
"the",
"named",
"value",
"is",
"not",
"available",
"return",
"the",
"passed",
"default",
".",
"The",
"default",
"return",
"is",
"an",
"empty",
"string",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L80-L123 | train |
saltstack/salt | salt/modules/grains.py | has_value | def has_value(key):
'''
Determine whether a key exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
.. code-... | python | def has_value(key):
'''
Determine whether a key exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
.. code-... | [
"def",
"has_value",
"(",
"key",
")",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"traverse_dict_and_list",
"(",
"__grains__",
",",
"key",
",",
"KeyError",
")",
"is",
"not",
"KeyError"
] | Determine whether a key exists in the grains dictionary.
Given a grains dictionary that contains the following structure::
{'pkg': {'apache': 'httpd'}}
One would determine if the apache key in the pkg dict exists by::
pkg:apache
CLI Example:
.. code-block:: bash
salt '*' g... | [
"Determine",
"whether",
"a",
"key",
"exists",
"in",
"the",
"grains",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L126-L147 | train |
saltstack/salt | salt/modules/grains.py | items | def items(sanitize=False):
'''
Return all of the minion's grains
CLI Example:
.. code-block:: bash
salt '*' grains.items
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.items sanitize=True
'''
if salt.utils.data.is_true(sanitize):
out = dict(__gr... | python | def items(sanitize=False):
'''
Return all of the minion's grains
CLI Example:
.. code-block:: bash
salt '*' grains.items
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.items sanitize=True
'''
if salt.utils.data.is_true(sanitize):
out = dict(__gr... | [
"def",
"items",
"(",
"sanitize",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"sanitize",
")",
":",
"out",
"=",
"dict",
"(",
"__grains__",
")",
"for",
"key",
",",
"func",
"in",
"six",
".",
"iteritems",
"(",
... | Return all of the minion's grains
CLI Example:
.. code-block:: bash
salt '*' grains.items
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.items sanitize=True | [
"Return",
"all",
"of",
"the",
"minion",
"s",
"grains"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L150-L173 | train |
saltstack/salt | salt/modules/grains.py | item | def item(*args, **kwargs):
'''
Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True
'''
ret = {}
... | python | def item(*args, **kwargs):
'''
Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True
'''
ret = {}
... | [
"def",
"item",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"default",
"=",
"kwargs",
".",
"get",
"(",
"'default'",
",",
"''",
")",
"delimiter",
"=",
"kwargs",
".",
"get",
"(",
"'delimiter'",
",",
"DEFAULT_TARGET_DELIM",... | Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True | [
"Return",
"one",
"or",
"more",
"grains"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L176-L211 | train |
saltstack/salt | salt/modules/grains.py | setvals | def setvals(grains, destructive=False):
'''
Set new grains values in the grains config file
destructive
If an operation results in a key being removed, delete the key, too.
Defaults to False.
CLI Example:
.. code-block:: bash
salt '*' grains.setvals "{'key1': 'val1', 'key... | python | def setvals(grains, destructive=False):
'''
Set new grains values in the grains config file
destructive
If an operation results in a key being removed, delete the key, too.
Defaults to False.
CLI Example:
.. code-block:: bash
salt '*' grains.setvals "{'key1': 'val1', 'key... | [
"def",
"setvals",
"(",
"grains",
",",
"destructive",
"=",
"False",
")",
":",
"new_grains",
"=",
"grains",
"if",
"not",
"isinstance",
"(",
"new_grains",
",",
"collections",
".",
"Mapping",
")",
":",
"raise",
"SaltException",
"(",
"'setvals grains must be a dictio... | Set new grains values in the grains config file
destructive
If an operation results in a key being removed, delete the key, too.
Defaults to False.
CLI Example:
.. code-block:: bash
salt '*' grains.setvals "{'key1': 'val1', 'key2': 'val2'}" | [
"Set",
"new",
"grains",
"values",
"in",
"the",
"grains",
"config",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L214-L310 | train |
saltstack/salt | salt/modules/grains.py | append | def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.17.0
Append a value to a list in the grains config file. If the grain doesn't
exist, the grain key is added and the value is appended to the new grain
as a list item.
key
The grain key to be ap... | python | def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.17.0
Append a value to a list in the grains config file. If the grain doesn't
exist, the grain key is added and the value is appended to the new grain
as a list item.
key
The grain key to be ap... | [
"def",
"append",
"(",
"key",
",",
"val",
",",
"convert",
"=",
"False",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"grains",
"=",
"get",
"(",
"key",
",",
"[",
"]",
",",
"delimiter",
")",
"if",
"convert",
":",
"if",
"not",
"isinstance",
"... | .. versionadded:: 0.17.0
Append a value to a list in the grains config file. If the grain doesn't
exist, the grain key is added and the value is appended to the new grain
as a list item.
key
The grain key to be appended to
val
The value to append to the grain key
convert
... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L337-L391 | train |
saltstack/salt | salt/modules/grains.py | remove | def remove(key, val, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.17.0
Remove a value from a list in the grains config file
key
The grain key to remove.
val
The value to remove.
delimiter
The key can be a nested dict key. Use this parameter to
spec... | python | def remove(key, val, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.17.0
Remove a value from a list in the grains config file
key
The grain key to remove.
val
The value to remove.
delimiter
The key can be a nested dict key. Use this parameter to
spec... | [
"def",
"remove",
"(",
"key",
",",
"val",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"grains",
"=",
"get",
"(",
"key",
",",
"[",
"]",
",",
"delimiter",
")",
"if",
"not",
"isinstance",
"(",
"grains",
",",
"list",
")",
":",
"return",
"'The... | .. versionadded:: 0.17.0
Remove a value from a list in the grains config file
key
The grain key to remove.
val
The value to remove.
delimiter
The key can be a nested dict key. Use this parameter to
specify the delimiter you use, instead of the default ``:``.
Y... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L394-L434 | train |
saltstack/salt | salt/modules/grains.py | filter_by | def filter_by(lookup_dict, grain='os_family', merge=None, default='default', base=None):
'''
.. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be useful at the CLI, the primary intent of
this function ... | python | def filter_by(lookup_dict, grain='os_family', merge=None, default='default', base=None):
'''
.. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be useful at the CLI, the primary intent of
this function ... | [
"def",
"filter_by",
"(",
"lookup_dict",
",",
"grain",
"=",
"'os_family'",
",",
"merge",
"=",
"None",
",",
"default",
"=",
"'default'",
",",
"base",
"=",
"None",
")",
":",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"filter_by",
"(",
"lookup_dict",
... | .. versionadded:: 0.17.0
Look up the given grain in a given dictionary for the current OS and return
the result
Although this may occasionally be useful at the CLI, the primary intent of
this function is for use in Jinja to make short work of creating lookup
tables for OS-specific data. For exampl... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L492-L600 | train |
saltstack/salt | salt/modules/grains.py | _dict_from_path | def _dict_from_path(path, val, delimiter=DEFAULT_TARGET_DELIM):
'''
Given a lookup string in the form of 'foo:bar:baz" return a nested
dictionary of the appropriate depth with the final segment as a value.
>>> _dict_from_path('foo:bar:baz', 'somevalue')
{"foo": {"bar": {"baz": "somevalue"}}
'''... | python | def _dict_from_path(path, val, delimiter=DEFAULT_TARGET_DELIM):
'''
Given a lookup string in the form of 'foo:bar:baz" return a nested
dictionary of the appropriate depth with the final segment as a value.
>>> _dict_from_path('foo:bar:baz', 'somevalue')
{"foo": {"bar": {"baz": "somevalue"}}
'''... | [
"def",
"_dict_from_path",
"(",
"path",
",",
"val",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"nested_dict",
"=",
"_infinitedict",
"(",
")",
"keys",
"=",
"path",
".",
"rsplit",
"(",
"delimiter",
")",
"lastplace",
"=",
"reduce",
"(",
"operator",... | Given a lookup string in the form of 'foo:bar:baz" return a nested
dictionary of the appropriate depth with the final segment as a value.
>>> _dict_from_path('foo:bar:baz', 'somevalue')
{"foo": {"bar": {"baz": "somevalue"}} | [
"Given",
"a",
"lookup",
"string",
"in",
"the",
"form",
"of",
"foo",
":",
"bar",
":",
"baz",
"return",
"a",
"nested",
"dictionary",
"of",
"the",
"appropriate",
"depth",
"with",
"the",
"final",
"segment",
"as",
"a",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L603-L616 | train |
saltstack/salt | salt/modules/grains.py | get_or_set_hash | def get_or_set_hash(name,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'):
'''
Perform a one-time generation of a hash and write it to the local grains.
If that grain has already been set return the value instead.
This is useful for generating passwords or keys tha... | python | def get_or_set_hash(name,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'):
'''
Perform a one-time generation of a hash and write it to the local grains.
If that grain has already been set return the value instead.
This is useful for generating passwords or keys tha... | [
"def",
"get_or_set_hash",
"(",
"name",
",",
"length",
"=",
"8",
",",
"chars",
"=",
"'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'",
")",
":",
"ret",
"=",
"get",
"(",
"name",
",",
"None",
")",
"if",
"ret",
"is",
"None",
":",
"val",
"=",
"''",
".",
... | Perform a one-time generation of a hash and write it to the local grains.
If that grain has already been set return the value instead.
This is useful for generating passwords or keys that are specific to a
single minion that don't need to be stored somewhere centrally.
State Example:
.. code-bloc... | [
"Perform",
"a",
"one",
"-",
"time",
"generation",
"of",
"a",
"hash",
"and",
"write",
"it",
"to",
"the",
"local",
"grains",
".",
"If",
"that",
"grain",
"has",
"already",
"been",
"set",
"return",
"the",
"value",
"instead",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L619-L666 | train |
saltstack/salt | salt/modules/grains.py | set | def set(key,
val='',
force=False,
destructive=False,
delimiter=DEFAULT_TARGET_DELIM):
'''
Set a key to an arbitrary value. It is used like setval but works
with nested keys.
This function is conservative. It will only overwrite an entry if
its value and the given one... | python | def set(key,
val='',
force=False,
destructive=False,
delimiter=DEFAULT_TARGET_DELIM):
'''
Set a key to an arbitrary value. It is used like setval but works
with nested keys.
This function is conservative. It will only overwrite an entry if
its value and the given one... | [
"def",
"set",
"(",
"key",
",",
"val",
"=",
"''",
",",
"force",
"=",
"False",
",",
"destructive",
"=",
"False",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"ret",
"=",
"{",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
",",
"... | Set a key to an arbitrary value. It is used like setval but works
with nested keys.
This function is conservative. It will only overwrite an entry if
its value and the given one are not a list or a dict. The ``force``
parameter is used to allow overwriting in all cases.
.. versionadded:: 2015.8.0
... | [
"Set",
"a",
"key",
"to",
"an",
"arbitrary",
"value",
".",
"It",
"is",
"used",
"like",
"setval",
"but",
"works",
"with",
"nested",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L669-L787 | train |
saltstack/salt | salt/modules/grains.py | equals | def equals(key, value):
'''
Used to make sure the minion's grain key/value matches.
Returns ``True`` if matches otherwise ``False``.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' grains.equals fqdn <expected_fqdn>
salt '*' grains.equals systemd:versio... | python | def equals(key, value):
'''
Used to make sure the minion's grain key/value matches.
Returns ``True`` if matches otherwise ``False``.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' grains.equals fqdn <expected_fqdn>
salt '*' grains.equals systemd:versio... | [
"def",
"equals",
"(",
"key",
",",
"value",
")",
":",
"return",
"six",
".",
"text_type",
"(",
"value",
")",
"==",
"six",
".",
"text_type",
"(",
"get",
"(",
"key",
")",
")"
] | Used to make sure the minion's grain key/value matches.
Returns ``True`` if matches otherwise ``False``.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt '*' grains.equals fqdn <expected_fqdn>
salt '*' grains.equals systemd:version 219 | [
"Used",
"to",
"make",
"sure",
"the",
"minion",
"s",
"grain",
"key",
"/",
"value",
"matches",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grains.py#L790-L805 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_xapi_session | def _get_xapi_session():
'''
Get a session to XenAPI. By default, use the local UNIX socket.
'''
_xenapi = _check_xenapi()
xapi_uri = __salt__['config.option']('xapi.uri')
xapi_login = __salt__['config.option']('xapi.login')
xapi_password = __salt__['config.option']('xapi.password')
if... | python | def _get_xapi_session():
'''
Get a session to XenAPI. By default, use the local UNIX socket.
'''
_xenapi = _check_xenapi()
xapi_uri = __salt__['config.option']('xapi.uri')
xapi_login = __salt__['config.option']('xapi.login')
xapi_password = __salt__['config.option']('xapi.password')
if... | [
"def",
"_get_xapi_session",
"(",
")",
":",
"_xenapi",
"=",
"_check_xenapi",
"(",
")",
"xapi_uri",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'xapi.uri'",
")",
"xapi_login",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'xapi.login'",
")",
"xapi_... | Get a session to XenAPI. By default, use the local UNIX socket. | [
"Get",
"a",
"session",
"to",
"XenAPI",
".",
"By",
"default",
"use",
"the",
"local",
"UNIX",
"socket",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L76-L102 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_xtool | def _get_xtool():
'''
Internal, returns xl or xm command line path
'''
for xtool in ['xl', 'xm']:
path = salt.utils.path.which(xtool)
if path is not None:
return path | python | def _get_xtool():
'''
Internal, returns xl or xm command line path
'''
for xtool in ['xl', 'xm']:
path = salt.utils.path.which(xtool)
if path is not None:
return path | [
"def",
"_get_xtool",
"(",
")",
":",
"for",
"xtool",
"in",
"[",
"'xl'",
",",
"'xm'",
"]",
":",
"path",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"xtool",
")",
"if",
"path",
"is",
"not",
"None",
":",
"return",
"path"
] | Internal, returns xl or xm command line path | [
"Internal",
"returns",
"xl",
"or",
"xm",
"command",
"line",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L114-L121 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_label_uuid | def _get_label_uuid(xapi, rectype, label):
'''
Internal, returns label's uuid
'''
try:
return getattr(xapi, rectype).get_by_name_label(label)[0]
except Exception:
return False | python | def _get_label_uuid(xapi, rectype, label):
'''
Internal, returns label's uuid
'''
try:
return getattr(xapi, rectype).get_by_name_label(label)[0]
except Exception:
return False | [
"def",
"_get_label_uuid",
"(",
"xapi",
",",
"rectype",
",",
"label",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"xapi",
",",
"rectype",
")",
".",
"get_by_name_label",
"(",
"label",
")",
"[",
"0",
"]",
"except",
"Exception",
":",
"return",
"False"
] | Internal, returns label's uuid | [
"Internal",
"returns",
"label",
"s",
"uuid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L131-L138 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_record_by_label | def _get_record_by_label(xapi, rectype, label):
'''
Internal, returns a full record for uuid
'''
uuid = _get_label_uuid(xapi, rectype, label)
if uuid is False:
return False
return getattr(xapi, rectype).get_record(uuid) | python | def _get_record_by_label(xapi, rectype, label):
'''
Internal, returns a full record for uuid
'''
uuid = _get_label_uuid(xapi, rectype, label)
if uuid is False:
return False
return getattr(xapi, rectype).get_record(uuid) | [
"def",
"_get_record_by_label",
"(",
"xapi",
",",
"rectype",
",",
"label",
")",
":",
"uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"rectype",
",",
"label",
")",
"if",
"uuid",
"is",
"False",
":",
"return",
"False",
"return",
"getattr",
"(",
"xapi",
","... | Internal, returns a full record for uuid | [
"Internal",
"returns",
"a",
"full",
"record",
"for",
"uuid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L148-L155 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_metrics_record | def _get_metrics_record(xapi, rectype, record):
'''
Internal, returns metrics record for a rectype
'''
metrics_id = record['metrics']
return getattr(xapi, '{0}_metrics'.format(rectype)).get_record(metrics_id) | python | def _get_metrics_record(xapi, rectype, record):
'''
Internal, returns metrics record for a rectype
'''
metrics_id = record['metrics']
return getattr(xapi, '{0}_metrics'.format(rectype)).get_record(metrics_id) | [
"def",
"_get_metrics_record",
"(",
"xapi",
",",
"rectype",
",",
"record",
")",
":",
"metrics_id",
"=",
"record",
"[",
"'metrics'",
"]",
"return",
"getattr",
"(",
"xapi",
",",
"'{0}_metrics'",
".",
"format",
"(",
"rectype",
")",
")",
".",
"get_record",
"(",... | Internal, returns metrics record for a rectype | [
"Internal",
"returns",
"metrics",
"record",
"for",
"a",
"rectype"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L158-L163 | train |
saltstack/salt | salt/modules/xapi_virt.py | _get_val | def _get_val(record, keys):
'''
Internal, get value from record
'''
data = record
for key in keys:
if key in data:
data = data[key]
else:
return None
return data | python | def _get_val(record, keys):
'''
Internal, get value from record
'''
data = record
for key in keys:
if key in data:
data = data[key]
else:
return None
return data | [
"def",
"_get_val",
"(",
"record",
",",
"keys",
")",
":",
"data",
"=",
"record",
"for",
"key",
"in",
"keys",
":",
"if",
"key",
"in",
"data",
":",
"data",
"=",
"data",
"[",
"key",
"]",
"else",
":",
"return",
"None",
"return",
"data"
] | Internal, get value from record | [
"Internal",
"get",
"value",
"from",
"record"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L166-L176 | train |
saltstack/salt | salt/modules/xapi_virt.py | list_domains | def list_domains():
'''
Return a list of virtual machine names on the minion
CLI Example:
.. code-block:: bash
salt '*' virt.list_domains
'''
with _get_xapi_session() as xapi:
hosts = xapi.VM.get_all()
ret = []
for _host in hosts:
if xapi.VM.get_re... | python | def list_domains():
'''
Return a list of virtual machine names on the minion
CLI Example:
.. code-block:: bash
salt '*' virt.list_domains
'''
with _get_xapi_session() as xapi:
hosts = xapi.VM.get_all()
ret = []
for _host in hosts:
if xapi.VM.get_re... | [
"def",
"list_domains",
"(",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"hosts",
"=",
"xapi",
".",
"VM",
".",
"get_all",
"(",
")",
"ret",
"=",
"[",
"]",
"for",
"_host",
"in",
"hosts",
":",
"if",
"xapi",
".",
"VM",
".",
"ge... | Return a list of virtual machine names on the minion
CLI Example:
.. code-block:: bash
salt '*' virt.list_domains | [
"Return",
"a",
"list",
"of",
"virtual",
"machine",
"names",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L179-L197 | train |
saltstack/salt | salt/modules/xapi_virt.py | vm_info | def vm_info(vm_=None):
'''
Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info
'''
with _get_xapi_session()... | python | def vm_info(vm_=None):
'''
Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info
'''
with _get_xapi_session()... | [
"def",
"vm_info",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_rec",
"is... | Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info | [
"Return",
"detailed",
"information",
"about",
"the",
"vms",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L200-L240 | train |
saltstack/salt | salt/modules/xapi_virt.py | vm_state | def vm_state(vm_=None):
'''
Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name>
'''
with _get_x... | python | def vm_state(vm_=None):
'''
Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name>
'''
with _get_x... | [
"def",
"vm_state",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"info",
"=",
"{",
"}",
"if",
"vm_",
":",
"info",
"[",
"vm_",
"]",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")"... | Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name> | [
"Return",
"list",
"of",
"all",
"the",
"vms",
"and",
"their",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L243-L265 | train |
saltstack/salt | salt/modules/xapi_virt.py | node_info | def node_info():
'''
Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info
'''
with _get_xapi_session() as xapi:
# get node uuid
host_rec = _get_record(xapi, 'host', _get_all(xapi, 'host')[0])
# get first CPU (... | python | def node_info():
'''
Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info
'''
with _get_xapi_session() as xapi:
# get node uuid
host_rec = _get_record(xapi, 'host', _get_all(xapi, 'host')[0])
# get first CPU (... | [
"def",
"node_info",
"(",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"# get node uuid",
"host_rec",
"=",
"_get_record",
"(",
"xapi",
",",
"'host'",
",",
"_get_all",
"(",
"xapi",
",",
"'host'",
")",
"[",
"0",
"]",
")",
"# get first... | Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"this",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L268-L350 | train |
saltstack/salt | salt/modules/xapi_virt.py | get_nics | def get_nics(vm_):
'''
Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name>
'''
with _get_xapi_session() as xapi:
nic = {}
vm_rec = _get_record_by_label(xapi, 'VM', vm_)
if vm_rec is False:
... | python | def get_nics(vm_):
'''
Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name>
'''
with _get_xapi_session() as xapi:
nic = {}
vm_rec = _get_record_by_label(xapi, 'VM', vm_)
if vm_rec is False:
... | [
"def",
"get_nics",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"nic",
"=",
"{",
"}",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_rec",
"is",
"False",
":",
"return",
"... | Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name> | [
"Return",
"info",
"about",
"the",
"network",
"interfaces",
"of",
"a",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L353-L377 | train |
saltstack/salt | salt/modules/xapi_virt.py | get_macs | def get_macs(vm_):
'''
Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name>
'''
macs = []
nics = get_nics(vm_)
if nics is None:
return None
for nic in nics:
macs.append(nic)
return macs | python | def get_macs(vm_):
'''
Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name>
'''
macs = []
nics = get_nics(vm_)
if nics is None:
return None
for nic in nics:
macs.append(nic)
return macs | [
"def",
"get_macs",
"(",
"vm_",
")",
":",
"macs",
"=",
"[",
"]",
"nics",
"=",
"get_nics",
"(",
"vm_",
")",
"if",
"nics",
"is",
"None",
":",
"return",
"None",
"for",
"nic",
"in",
"nics",
":",
"macs",
".",
"append",
"(",
"nic",
")",
"return",
"macs"... | Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name> | [
"Return",
"a",
"list",
"off",
"MAC",
"addresses",
"from",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L380-L397 | train |
saltstack/salt | salt/modules/xapi_virt.py | get_disks | def get_disks(vm_):
'''
Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name>
'''
with _get_xapi_session() as xapi:
disk = {}
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False... | python | def get_disks(vm_):
'''
Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name>
'''
with _get_xapi_session() as xapi:
disk = {}
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False... | [
"def",
"get_disks",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"disk",
"=",
"{",
"}",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"F... | Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name> | [
"Return",
"the",
"disks",
"of",
"a",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L400-L428 | train |
saltstack/salt | salt/modules/xapi_virt.py | setmem | def setmem(vm_, memory):
'''
Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768
'''
with _get_xapi_session() as xapi:
mem_target = int(memory) * 1024 * 1024
vm_uuid = _get_... | python | def setmem(vm_, memory):
'''
Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768
'''
with _get_xapi_session() as xapi:
mem_target = int(memory) * 1024 * 1024
vm_uuid = _get_... | [
"def",
"setmem",
"(",
"vm_",
",",
"memory",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"mem_target",
"=",
"int",
"(",
"memory",
")",
"*",
"1024",
"*",
"1024",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
... | Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768 | [
"Changes",
"the",
"amount",
"of",
"memory",
"allocated",
"to",
"VM",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L431-L454 | train |
saltstack/salt | salt/modules/xapi_virt.py | setvcpus | def setvcpus(vm_, vcpus):
'''
Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm... | python | def setvcpus(vm_, vcpus):
'''
Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm... | [
"def",
"setvcpus",
"(",
"vm_",
",",
"vcpus",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try"... | Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2 | [
"Changes",
"the",
"amount",
"of",
"vcpus",
"allocated",
"to",
"VM",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L457-L477 | train |
saltstack/salt | salt/modules/xapi_virt.py | vcpu_pin | def vcpu_pin(vm_, vcpu, cpus):
'''
Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if ... | python | def vcpu_pin(vm_, vcpu, cpus):
'''
Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if ... | [
"def",
"vcpu_pin",
"(",
"vm_",
",",
"vcpu",
",",
"cpus",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
... | Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6 | [
"Set",
"which",
"CPUs",
"a",
"VCPU",
"can",
"use",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L480-L532 | train |
saltstack/salt | salt/modules/xapi_virt.py | shutdown | def shutdown(vm_):
'''
Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
... | python | def shutdown(vm_):
'''
Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
... | [
"def",
"shutdown",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",... | Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name> | [
"Send",
"a",
"soft",
"shutdown",
"signal",
"to",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L576-L594 | train |
saltstack/salt | salt/modules/xapi_virt.py | pause | def pause(vm_):
'''
Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.pause(... | python | def pause(vm_):
'''
Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.pause(... | [
"def",
"pause",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name> | [
"Pause",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L597-L615 | train |
saltstack/salt | salt/modules/xapi_virt.py | resume | def resume(vm_):
'''
Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.unp... | python | def resume(vm_):
'''
Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.unp... | [
"def",
"resume",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name> | [
"Resume",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L618-L636 | train |
saltstack/salt | salt/modules/xapi_virt.py | reboot | def reboot(vm_):
'''
Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
... | python | def reboot(vm_):
'''
Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
... | [
"def",
"reboot",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name> | [
"Reboot",
"a",
"domain",
"via",
"ACPI",
"request"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L656-L674 | train |
saltstack/salt | salt/modules/xapi_virt.py | reset | def reset(vm_):
'''
Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return F... | python | def reset(vm_):
'''
Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return F... | [
"def",
"reset",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name> | [
"Reset",
"a",
"VM",
"by",
"emulating",
"the",
"reset",
"button",
"on",
"a",
"physical",
"machine"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L677-L695 | train |
saltstack/salt | salt/modules/xapi_virt.py | migrate | def migrate(vm_, target,
live=1, port=0, node=-1, ssl=None, change_home_server=0):
'''
Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Opti... | python | def migrate(vm_, target,
live=1, port=0, node=-1, ssl=None, change_home_server=0):
'''
Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Opti... | [
"def",
"migrate",
"(",
"vm_",
",",
"target",
",",
"live",
"=",
"1",
",",
"port",
"=",
"0",
",",
"node",
"=",
"-",
"1",
",",
"ssl",
"=",
"None",
",",
"change_home_server",
"=",
"0",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":... | Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Optional values:
live
Use live migration
port
Use a specified port
node
Us... | [
"Migrates",
"the",
"virtual",
"machine",
"to",
"another",
"hypervisor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L698-L736 | train |
saltstack/salt | salt/modules/xapi_virt.py | stop | def stop(vm_):
'''
Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
... | python | def stop(vm_):
'''
Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
... | [
"def",
"stop",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
"... | Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name> | [
"Hard",
"power",
"down",
"the",
"virtual",
"machine",
"this",
"is",
"equivalent",
"to",
"pulling",
"the",
"power"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L739-L758 | train |
saltstack/salt | salt/modules/xapi_virt.py | is_hyper | def is_hyper():
'''
Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper
'''
try:
if __grains__['virtual_subtype'] != 'Xen Dom0':
return False
except KeyError:
# virtual_subtype isn... | python | def is_hyper():
'''
Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper
'''
try:
if __grains__['virtual_subtype'] != 'Xen Dom0':
return False
except KeyError:
# virtual_subtype isn... | [
"def",
"is_hyper",
"(",
")",
":",
"try",
":",
"if",
"__grains__",
"[",
"'virtual_subtype'",
"]",
"!=",
"'Xen Dom0'",
":",
"return",
"False",
"except",
"KeyError",
":",
"# virtual_subtype isn't set everywhere.",
"return",
"False",
"try",
":",
"with",
"salt",
".",... | Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper | [
"Returns",
"a",
"bool",
"whether",
"or",
"not",
"this",
"node",
"is",
"a",
"hypervisor",
"of",
"any",
"kind"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L761-L784 | train |
saltstack/salt | salt/modules/xapi_virt.py | vm_cputime | def vm_cputime(vm_=None):
'''
Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name i... | python | def vm_cputime(vm_=None):
'''
Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name i... | [
"def",
"vm_cputime",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"host_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"host_cpus",
"="... | Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name in as an argument then it will return i... | [
"Return",
"cputime",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L787-L834 | train |
saltstack/salt | salt/modules/xapi_virt.py | vm_netstats | def vm_netstats(vm_=None):
'''
Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' ... | python | def vm_netstats(vm_=None):
'''
Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' ... | [
"def",
"vm_netstats",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"ret",
"=",
"{",
"}",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_"... | Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' : 0,
'io_write_kbs' ... | [
"Return",
"combined",
"network",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L837-L883 | train |
saltstack/salt | salt/modules/xapi_virt.py | vm_diskstats | def vm_diskstats(vm_=None):
'''
Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you p... | python | def vm_diskstats(vm_=None):
'''
Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you p... | [
"def",
"vm_diskstats",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"ret",
"=",
"{",
"}",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
... | Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you pass a VM name in as an argument then it ... | [
"Return",
"disk",
"usage",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L886-L930 | train |
saltstack/salt | salt/modules/zonecfg.py | _clean_message | def _clean_message(message):
'''Internal helper to sanitize message output'''
message = message.replace('zonecfg: ', '')
message = message.splitlines()
for line in message:
if line.startswith('On line'):
message.remove(line)
return "\n".join(message) | python | def _clean_message(message):
'''Internal helper to sanitize message output'''
message = message.replace('zonecfg: ', '')
message = message.splitlines()
for line in message:
if line.startswith('On line'):
message.remove(line)
return "\n".join(message) | [
"def",
"_clean_message",
"(",
"message",
")",
":",
"message",
"=",
"message",
".",
"replace",
"(",
"'zonecfg: '",
",",
"''",
")",
"message",
"=",
"message",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"message",
":",
"if",
"line",
".",
"startswith"... | Internal helper to sanitize message output | [
"Internal",
"helper",
"to",
"sanitize",
"message",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L117-L124 | train |
saltstack/salt | salt/modules/zonecfg.py | _parse_value | def _parse_value(value):
'''Internal helper for parsing configuration values into python values'''
if isinstance(value, bool):
return 'true' if value else 'false'
elif isinstance(value, six.string_types):
# parse compacted notation to dict
listparser = re.compile(r'''((?:[^,"']|"[^"]... | python | def _parse_value(value):
'''Internal helper for parsing configuration values into python values'''
if isinstance(value, bool):
return 'true' if value else 'false'
elif isinstance(value, six.string_types):
# parse compacted notation to dict
listparser = re.compile(r'''((?:[^,"']|"[^"]... | [
"def",
"_parse_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"return",
"'true'",
"if",
"value",
"else",
"'false'",
"elif",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"# parse compacted ... | Internal helper for parsing configuration values into python values | [
"Internal",
"helper",
"for",
"parsing",
"configuration",
"values",
"into",
"python",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L127-L165 | train |
saltstack/salt | salt/modules/zonecfg.py | _sanitize_value | def _sanitize_value(value):
'''Internal helper for converting pythonic values to configuration file values'''
# dump dict into compated
if isinstance(value, dict):
new_value = []
new_value.append('(')
for k, v in value.items():
new_value.append(k)
new_value.ap... | python | def _sanitize_value(value):
'''Internal helper for converting pythonic values to configuration file values'''
# dump dict into compated
if isinstance(value, dict):
new_value = []
new_value.append('(')
for k, v in value.items():
new_value.append(k)
new_value.ap... | [
"def",
"_sanitize_value",
"(",
"value",
")",
":",
"# dump dict into compated",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"new_value",
"=",
"[",
"]",
"new_value",
".",
"append",
"(",
"'('",
")",
"for",
"k",
",",
"v",
"in",
"value",
".",
"... | Internal helper for converting pythonic values to configuration file values | [
"Internal",
"helper",
"for",
"converting",
"pythonic",
"values",
"to",
"configuration",
"file",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L168-L198 | train |
saltstack/salt | salt/modules/zonecfg.py | _dump_cfg | def _dump_cfg(cfg_file):
'''Internal helper for debugging cfg files'''
if __salt__['file.file_exists'](cfg_file):
with salt.utils.files.fopen(cfg_file, 'r') as fp_:
log.debug(
"zonecfg - configuration file:\n%s",
"".join(salt.utils.data.decode(fp_.readline... | python | def _dump_cfg(cfg_file):
'''Internal helper for debugging cfg files'''
if __salt__['file.file_exists'](cfg_file):
with salt.utils.files.fopen(cfg_file, 'r') as fp_:
log.debug(
"zonecfg - configuration file:\n%s",
"".join(salt.utils.data.decode(fp_.readline... | [
"def",
"_dump_cfg",
"(",
"cfg_file",
")",
":",
"if",
"__salt__",
"[",
"'file.file_exists'",
"]",
"(",
"cfg_file",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"cfg_file",
",",
"'r'",
")",
"as",
"fp_",
":",
"log",
".",
"deb... | Internal helper for debugging cfg files | [
"Internal",
"helper",
"for",
"debugging",
"cfg",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L201-L208 | train |
saltstack/salt | salt/modules/zonecfg.py | create | def create(zone, brand, zonepath, force=False):
'''
Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. cod... | python | def create(zone, brand, zonepath, force=False):
'''
Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. cod... | [
"def",
"create",
"(",
"zone",
",",
"brand",
",",
"zonepath",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# write config",
"cfg_file",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
"(",
")",
"with",... | Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. code-block:: bash
salt '*' zonecfg.create deathscythe ... | [
"Create",
"an",
"in",
"-",
"memory",
"configuration",
"for",
"the",
"specified",
"zone",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L211-L259 | train |
saltstack/salt | salt/modules/zonecfg.py | create_from_template | def create_from_template(zone, template):
'''
Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bas... | python | def create_from_template(zone, template):
'''
Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bas... | [
"def",
"create_from_template",
"(",
"zone",
",",
"template",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# create from template",
"_dump_cfg",
"(",
"template",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} create ... | Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bash
salt '*' zonecfg.create_from_template leo t... | [
"Create",
"an",
"in",
"-",
"memory",
"configuration",
"from",
"a",
"template",
"for",
"the",
"specified",
"zone",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L262-L295 | train |
saltstack/salt | salt/modules/zonecfg.py | delete | def delete(zone):
'''
Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon
'''
ret = {'status': True}
# delete zone
res = __salt__['cmd.run_all']('zonecfg -z ... | python | def delete(zone):
'''
Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon
'''
ret = {'status': True}
# delete zone
res = __salt__['cmd.run_all']('zonecfg -z ... | [
"def",
"delete",
"(",
"zone",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# delete zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} delete -F'",
".",
"format",
"(",
"zone",
"=",
"zone",
",",
")",
")",
"ret"... | Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon | [
"Delete",
"the",
"specified",
"configuration",
"from",
"memory",
"and",
"stable",
"storage",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L298-L324 | train |
saltstack/salt | salt/modules/zonecfg.py | export | def export(zone, path=None):
'''
Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epy... | python | def export(zone, path=None):
'''
Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epy... | [
"def",
"export",
"(",
"zone",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# export zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} export{path}'",
".",
"format",
"(",
"zone",
"=",
... | Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epyon.cfg | [
"Export",
"the",
"configuration",
"from",
"memory",
"to",
"stable",
"storage",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L327-L357 | train |
saltstack/salt | salt/modules/zonecfg.py | import_ | def import_(zone, path):
'''
Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg
'''
ret = {'status': True}
... | python | def import_(zone, path):
'''
Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg
'''
ret = {'status': True}
... | [
"def",
"import_",
"(",
"zone",
",",
"path",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# create from file",
"_dump_cfg",
"(",
"path",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} -f {path}'",
".",
"format",
... | Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg | [
"Import",
"the",
"configuration",
"to",
"memory",
"from",
"stable",
"storage",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L360-L390 | train |
saltstack/salt | salt/modules/zonecfg.py | _property | def _property(methode, zone, key, value):
'''
internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property
'''
ret = {'status': True}
... | python | def _property(methode, zone, key, value):
'''
internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property
'''
ret = {'status': True}
... | [
"def",
"_property",
"(",
"methode",
",",
"zone",
",",
"key",
",",
"value",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# generate update script",
"cfg_file",
"=",
"None",
"if",
"methode",
"not",
"in",
"[",
"'set'",
",",
"'clear'",
"]",
":... | internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property | [
"internal",
"handler",
"for",
"set",
"and",
"clear_property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L393-L443 | train |
saltstack/salt | salt/modules/zonecfg.py | _resource | def _resource(methode, zone, resource_type, resource_selector, **kwargs):
'''
internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**k... | python | def _resource(methode, zone, resource_type, resource_selector, **kwargs):
'''
internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**k... | [
"def",
"_resource",
"(",
"methode",
",",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# parse kwargs",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
... | internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**kwargs : string|int|...
resource properties | [
"internal",
"resource",
"hanlder"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L494-L570 | train |
saltstack/salt | salt/modules/zonecfg.py | update_resource | def update_resource(zone, resource_type, resource_selector, **kwargs):
'''
Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. ... | python | def update_resource(zone, resource_type, resource_selector, **kwargs):
'''
Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. ... | [
"def",
"update_resource",
"(",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_resource",
"(",
"'update'",
",",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")"
] | Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. note::
Set resource_selector to None for resource that do not require one.
... | [
"Add",
"a",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L593-L615 | train |
saltstack/salt | salt/modules/zonecfg.py | remove_resource | def remove_resource(zone, resource_type, resource_key, resource_value):
'''
Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
... | python | def remove_resource(zone, resource_type, resource_key, resource_value):
'''
Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
... | [
"def",
"remove_resource",
"(",
"zone",
",",
"resource_type",
",",
"resource_key",
",",
"resource_value",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# generate update script",
"cfg_file",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
... | Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
.. note::
Set resource_selector to None for resource that do not requir... | [
"Remove",
"a",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L618-L668 | train |
saltstack/salt | salt/modules/zonecfg.py | info | def info(zone, show_all=False):
'''
Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese
'''
ret = ... | python | def info(zone, show_all=False):
'''
Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese
'''
ret = ... | [
"def",
"info",
"(",
"zone",
",",
"show_all",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"# dump zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} info'",
".",
"format",
"(",
"zone",
"=",
"zone",
",",
")",
")",
"if",
... | Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese | [
"Display",
"the",
"configuration",
"from",
"memory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L671-L769 | train |
saltstack/salt | salt/cli/daemons.py | DaemonsMixin.verify_hash_type | def verify_hash_type(self):
'''
Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return:
'''
if self.config['hash_type'].lower() in ['md5', 'sha1']:
log.warning(
'IMPORTANT: Do not use %s hashing algorithm! Please set '
... | python | def verify_hash_type(self):
'''
Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return:
'''
if self.config['hash_type'].lower() in ['md5', 'sha1']:
log.warning(
'IMPORTANT: Do not use %s hashing algorithm! Please set '
... | [
"def",
"verify_hash_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"config",
"[",
"'hash_type'",
"]",
".",
"lower",
"(",
")",
"in",
"[",
"'md5'",
",",
"'sha1'",
"]",
":",
"log",
".",
"warning",
"(",
"'IMPORTANT: Do not use %s hashing algorithm! Please set '"... | Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return: | [
"Verify",
"and",
"display",
"a",
"nag",
"-",
"messsage",
"to",
"the",
"log",
"if",
"vulnerable",
"hash",
"-",
"type",
"is",
"used",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L65-L76 | train |
saltstack/salt | salt/cli/daemons.py | DaemonsMixin.environment_failure | def environment_failure(self, error):
'''
Log environment failure for the daemon and exit with the error code.
:param error:
:return:
'''
log.exception(
'Failed to create environment for %s: %s',
self.__class__.__name__, get_error_message(error)
... | python | def environment_failure(self, error):
'''
Log environment failure for the daemon and exit with the error code.
:param error:
:return:
'''
log.exception(
'Failed to create environment for %s: %s',
self.__class__.__name__, get_error_message(error)
... | [
"def",
"environment_failure",
"(",
"self",
",",
"error",
")",
":",
"log",
".",
"exception",
"(",
"'Failed to create environment for %s: %s'",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"get_error_message",
"(",
"error",
")",
")",
"self",
".",
"shutdown... | Log environment failure for the daemon and exit with the error code.
:param error:
:return: | [
"Log",
"environment",
"failure",
"for",
"the",
"daemon",
"and",
"exit",
"with",
"the",
"error",
"code",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L103-L114 | train |
saltstack/salt | salt/cli/daemons.py | Master.prepare | def prepare(self):
'''
Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Master, self).prepare()
try:
if self.config['verify_env']:
... | python | def prepare(self):
'''
Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Master, self).prepare()
try:
if self.config['verify_env']:
... | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Master",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"v_dirs",
"=",
"[",
"self",
".",
"config",
"[",
"'pki_dir'",
"]",
... | Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"master",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L130-L190 | train |
saltstack/salt | salt/cli/daemons.py | Master.start | def start(self):
'''
Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Master, self).start()
if check_user(self.config['user']):
... | python | def start(self):
'''
Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Master, self).start()
if check_user(self.config['user']):
... | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Master",
",",
"self",
")",
".",
"start",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Starting up'",
")",
"self",
... | Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | [
"Start",
"the",
"actual",
"master",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L192-L206 | train |
saltstack/salt | salt/cli/daemons.py | Master.shutdown | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
'''
self.shutdown_log_info()
msg = 'The salt master is shutdown. '
if exitmsg is not None:
exitmsg = msg + exitmsg
else:
exitmsg =... | python | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
'''
self.shutdown_log_info()
msg = 'The salt master is shutdown. '
if exitmsg is not None:
exitmsg = msg + exitmsg
else:
exitmsg =... | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"shutdown_log_info",
"(",
")",
"msg",
"=",
"'The salt master is shutdown. '",
"if",
"exitmsg",
"is",
"not",
"None",
":",
"exitmsg",
"=",
"msg",
... | If sub-classed, run any shutdown operations on this method. | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L208-L218 | train |
saltstack/salt | salt/cli/daemons.py | Minion.prepare | def prepare(self):
'''
Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Minion, self).prepare()
try:
if self.config['verify_env']:
... | python | def prepare(self):
'''
Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Minion, self).prepare()
try:
if self.config['verify_env']:
... | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Minion",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"confd",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'default_inc... | Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L233-L311 | train |
saltstack/salt | salt/cli/daemons.py | Minion.start | def start(self):
'''
Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Minion, self).start()
while True:
try:
... | python | def start(self):
'''
Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Minion, self).start()
while True:
try:
... | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Minion",
",",
"self",
")",
".",
"start",
"(",
")",
"while",
"True",
":",
"try",
":",
"self",
".",
"_real_start",
"(",
")",
"except",
"SaltClientError",
"as",
"exc",
":",
"# Restart for multi_master fa... | Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | [
"Start",
"the",
"actual",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L313-L331 | train |
saltstack/salt | salt/cli/daemons.py | Minion.call | def call(self, cleanup_protecteds):
'''
Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
... | python | def call(self, cleanup_protecteds):
'''
Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
... | [
"def",
"call",
"(",
"self",
",",
"cleanup_protecteds",
")",
":",
"try",
":",
"self",
".",
"prepare",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"minion",
".",
"opts",
"[",
"'__role'",
"]",
"... | Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE... | [
"Start",
"the",
"actual",
"minion",
"as",
"a",
"caller",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L350-L375 | train |
saltstack/salt | salt/cli/daemons.py | Minion.shutdown | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
if hasattr(self, 'minion') and hasattr(self.minion, 'destroy'):
self... | python | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
if hasattr(self, 'minion') and hasattr(self.minion, 'destroy'):
self... | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Shutting down'",
")",
"if",
"hasattr",
"(",
"self",
",",
"'minion'",
")",
"and",
"hasattr",
"(",
"self",
".",
"mini... | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L377-L389 | train |
saltstack/salt | salt/cli/daemons.py | ProxyMinion.prepare | def prepare(self):
'''
Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(ProxyMinion, self).prepare()
if not self.values.proxyid:
self.... | python | def prepare(self):
'''
Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(ProxyMinion, self).prepare()
if not self.values.proxyid:
self.... | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"ProxyMinion",
",",
"self",
")",
".",
"prepare",
"(",
")",
"if",
"not",
"self",
".",
"values",
".",
"proxyid",
":",
"self",
".",
"error",
"(",
"'salt-proxy requires --proxyid'",
")",
"# Proxies get the... | Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"proxy",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L404-L483 | train |
saltstack/salt | salt/cli/daemons.py | ProxyMinion.start | def start(self):
'''
Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(ProxyMinion, self).start()
try:
if check_... | python | def start(self):
'''
Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(ProxyMinion, self).start()
try:
if check_... | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"ProxyMinion",
",",
"self",
")",
".",
"start",
"(",
")",
"try",
":",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'The Proxy M... | Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | [
"Start",
"the",
"actual",
"proxy",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L485-L510 | train |
saltstack/salt | salt/cli/daemons.py | ProxyMinion.shutdown | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
if hasattr(self, 'minion') and 'proxymodule' in self.minion.opts:
proxy_fn = self.minion.opts['proxymodule'].loade... | python | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
if hasattr(self, 'minion') and 'proxymodule' in self.minion.opts:
proxy_fn = self.minion.opts['proxymodule'].loade... | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'minion'",
")",
"and",
"'proxymodule'",
"in",
"self",
".",
"minion",
".",
"opts",
":",
"proxy_fn",
"=",
"self",
".",... | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L512-L525 | train |
saltstack/salt | salt/cli/daemons.py | Syndic.prepare | def prepare(self):
'''
Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Syndic, self).prepare()
try:
if self.config['verify_env']:
... | python | def prepare(self):
'''
Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Syndic, self).prepare()
try:
if self.config['verify_env']:
... | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"verify_env",
"(",
"[",
"self",
".",
"config",
"[",
"'pki_dir'",
"]... | Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"syndic",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L534-L568 | train |
saltstack/salt | salt/cli/daemons.py | Syndic.start | def start(self):
'''
Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Syndic, self).start()
if check_user(self.config['user']):
... | python | def start(self):
'''
Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Syndic, self).start()
if check_user(self.config['user']):
... | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"start",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Starting up'",
")",
"self",
... | Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | [
"Start",
"the",
"actual",
"syndic",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L570-L588 | train |
saltstack/salt | salt/cli/daemons.py | Syndic.shutdown | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
super(Syndic, self).shutdown(
exitcode, ('The Salt {0} is shutdown. ... | python | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
super(Syndic, self).shutdown(
exitcode, ('The Salt {0} is shutdown. ... | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Shutting down'",
")",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"shutdown",
"(",
"exitcode",
",",
"(",
"'The S... | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L590-L600 | train |
saltstack/salt | salt/modules/drac.py | __execute_cmd | def __execute_cmd(command):
'''
Execute rac commands
'''
cmd = __salt__['cmd.run_all']('racadm {0}'.format(command))
if cmd['retcode'] != 0:
log.warning('racadm return an exit code \'%s\'.', cmd['retcode'])
return False
return True | python | def __execute_cmd(command):
'''
Execute rac commands
'''
cmd = __salt__['cmd.run_all']('racadm {0}'.format(command))
if cmd['retcode'] != 0:
log.warning('racadm return an exit code \'%s\'.', cmd['retcode'])
return False
return True | [
"def",
"__execute_cmd",
"(",
"command",
")",
":",
"cmd",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'racadm {0}'",
".",
"format",
"(",
"command",
")",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"log",
".",
"warning",
"(",
"'racadm ... | Execute rac commands | [
"Execute",
"rac",
"commands"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L48-L58 | train |
saltstack/salt | salt/modules/drac.py | nameservers | def nameservers(*ns):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com
'''
if len(ns) > 2:
log.warning('racadm only supports two nameservers')... | python | def nameservers(*ns):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com
'''
if len(ns) > 2:
log.warning('racadm only supports two nameservers')... | [
"def",
"nameservers",
"(",
"*",
"ns",
")",
":",
"if",
"len",
"(",
"ns",
")",
">",
"2",
":",
"log",
".",
"warning",
"(",
"'racadm only supports two nameservers'",
")",
"return",
"False",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"ns",
")",... | Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com | [
"Configure",
"the",
"nameservers",
"on",
"the",
"DRAC"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L98-L118 | train |
saltstack/salt | salt/modules/drac.py | syslog | def syslog(server, enable=True):
'''
Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.s... | python | def syslog(server, enable=True):
'''
Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.s... | [
"def",
"syslog",
"(",
"server",
",",
"enable",
"=",
"True",
")",
":",
"if",
"enable",
"and",
"__execute_cmd",
"(",
"'config -g cfgRemoteHosts -o \\\n cfgRhostsSyslogEnable 1'",
")",
":",
"return",
"__execute_cmd",
"(",
"'config -g cfgRemoteHosts -o \\\n ... | Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.syslog [SYSLOG IP] [ENABLE/DISABLE]
sa... | [
"Configure",
"syslog",
"remote",
"logging",
"by",
"default",
"syslog",
"will",
"automatically",
"be",
"enabled",
"if",
"a",
"server",
"is",
"specified",
".",
"However",
"if",
"you",
"want",
"to",
"disable",
"syslog",
"you",
"will",
"need",
"to",
"specify",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L121-L139 | train |
saltstack/salt | salt/modules/drac.py | list_users | def list_users():
'''
List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
cmd = __salt__['cmd.run_all']('racadm getconfig -g \
cfgUserAdmin -i {0}'.format(idx))
... | python | def list_users():
'''
List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
cmd = __salt__['cmd.run_all']('racadm getconfig -g \
cfgUserAdmin -i {0}'.format(idx))
... | [
"def",
"list_users",
"(",
")",
":",
"users",
"=",
"{",
"}",
"_username",
"=",
"''",
"for",
"idx",
"in",
"range",
"(",
"1",
",",
"17",
")",
":",
"cmd",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'racadm getconfig -g \\\n cfgUserAdmin -i ... | List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users | [
"List",
"all",
"DRAC",
"users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L162-L198 | train |
saltstack/salt | salt/modules/drac.py | delete_user | def delete_user(username, uid=None):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4
'''
if uid is None:
user = list_users()
uid = user[username]['index']
if uid:... | python | def delete_user(username, uid=None):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4
'''
if uid is None:
user = list_users()
uid = user[username]['index']
if uid:... | [
"def",
"delete_user",
"(",
"username",
",",
"uid",
"=",
"None",
")",
":",
"if",
"uid",
"is",
"None",
":",
"user",
"=",
"list_users",
"(",
")",
"uid",
"=",
"user",
"[",
"username",
"]",
"[",
"'index'",
"]",
"if",
"uid",
":",
"return",
"__execute_cmd",... | Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4 | [
"Delete",
"a",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L201-L224 | train |
saltstack/salt | salt/modules/drac.py | change_password | def change_password(username, password, uid=None):
'''
Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret
'''
if uid is None:
user = list_users()
... | python | def change_password(username, password, uid=None):
'''
Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret
'''
if uid is None:
user = list_users()
... | [
"def",
"change_password",
"(",
"username",
",",
"password",
",",
"uid",
"=",
"None",
")",
":",
"if",
"uid",
"is",
"None",
":",
"user",
"=",
"list_users",
"(",
")",
"uid",
"=",
"user",
"[",
"username",
"]",
"[",
"'index'",
"]",
"if",
"uid",
":",
"re... | Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret | [
"Change",
"users",
"password"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L227-L249 | train |
saltstack/salt | salt/modules/drac.py | create_user | def create_user(username, password, permissions, users=None):
'''
Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* logi... | python | def create_user(username, password, permissions, users=None):
'''
Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* logi... | [
"def",
"create_user",
"(",
"username",
",",
"password",
",",
"permissions",
",",
"users",
"=",
"None",
")",
":",
"_uids",
"=",
"set",
"(",
")",
"if",
"users",
"is",
"None",
":",
"users",
"=",
"list_users",
"(",
")",
"if",
"username",
"in",
"users",
"... | Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* login : Login to iDRAC
* drac : Con... | [
"Create",
"user",
"accounts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L252-L312 | train |
saltstack/salt | salt/modules/drac.py | set_permissions | def set_permissions(username, permissions, uid=None):
'''
Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileg... | python | def set_permissions(username, permissions, uid=None):
'''
Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileg... | [
"def",
"set_permissions",
"(",
"username",
",",
"permissions",
",",
"uid",
"=",
"None",
")",
":",
"privileges",
"=",
"{",
"'login'",
":",
"'0x0000001'",
",",
"'drac'",
":",
"'0x0000002'",
",",
"'user_management'",
":",
"'0x0000004'",
",",
"'clear_logs'",
":",
... | Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileges
* login : Login to iDRAC
* drac ... | [
"Configure",
"users",
"permissions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L315-L362 | train |
saltstack/salt | salt/modules/drac.py | server_pxe | def server_pxe():
'''
Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o \
cfgServerFirstBootDevice PXE'):
if __execute_cmd('config -g cfgServerInfo -o cfgS... | python | def server_pxe():
'''
Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o \
cfgServerFirstBootDevice PXE'):
if __execute_cmd('config -g cfgServerInfo -o cfgS... | [
"def",
"server_pxe",
"(",
")",
":",
"if",
"__execute_cmd",
"(",
"'config -g cfgServerInfo -o \\\n cfgServerFirstBootDevice PXE'",
")",
":",
"if",
"__execute_cmd",
"(",
"'config -g cfgServerInfo -o cfgServerBootOnce 1'",
")",
":",
"return",
"server_reboot",
"else",
... | Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe | [
"Configure",
"server",
"to",
"PXE",
"perform",
"a",
"one",
"off",
"PXE",
"boot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L450-L469 | train |
saltstack/salt | scripts/suse/yum/plugins/yumnotify.py | _get_mtime | def _get_mtime():
"""
Get the modified time of the RPM Database.
Returns:
Unix ticks
"""
return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0 | python | def _get_mtime():
"""
Get the modified time of the RPM Database.
Returns:
Unix ticks
"""
return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0 | [
"def",
"_get_mtime",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"RPM_PATH",
")",
"and",
"int",
"(",
"os",
".",
"path",
".",
"getmtime",
"(",
"RPM_PATH",
")",
")",
"or",
"0"
] | Get the modified time of the RPM Database.
Returns:
Unix ticks | [
"Get",
"the",
"modified",
"time",
"of",
"the",
"RPM",
"Database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L18-L25 | train |
saltstack/salt | scripts/suse/yum/plugins/yumnotify.py | _get_checksum | def _get_checksum():
"""
Get the checksum of the RPM Database.
Returns:
hexdigest
"""
digest = hashlib.sha256()
with open(RPM_PATH, "rb") as rpm_db_fh:
while True:
buff = rpm_db_fh.read(0x1000)
if not buff:
break
digest.update(... | python | def _get_checksum():
"""
Get the checksum of the RPM Database.
Returns:
hexdigest
"""
digest = hashlib.sha256()
with open(RPM_PATH, "rb") as rpm_db_fh:
while True:
buff = rpm_db_fh.read(0x1000)
if not buff:
break
digest.update(... | [
"def",
"_get_checksum",
"(",
")",
":",
"digest",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"with",
"open",
"(",
"RPM_PATH",
",",
"\"rb\"",
")",
"as",
"rpm_db_fh",
":",
"while",
"True",
":",
"buff",
"=",
"rpm_db_fh",
".",
"read",
"(",
"0x1000",
")",
"i... | Get the checksum of the RPM Database.
Returns:
hexdigest | [
"Get",
"the",
"checksum",
"of",
"the",
"RPM",
"Database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L28-L42 | train |
saltstack/salt | scripts/suse/yum/plugins/yumnotify.py | posttrans_hook | def posttrans_hook(conduit):
"""
Hook after the package installation transaction.
:param conduit:
:return:
"""
# Integrate Yum with Salt
if 'SALT_RUNNING' not in os.environ:
with open(CK_PATH, 'w') as ck_fh:
ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(),... | python | def posttrans_hook(conduit):
"""
Hook after the package installation transaction.
:param conduit:
:return:
"""
# Integrate Yum with Salt
if 'SALT_RUNNING' not in os.environ:
with open(CK_PATH, 'w') as ck_fh:
ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(),... | [
"def",
"posttrans_hook",
"(",
"conduit",
")",
":",
"# Integrate Yum with Salt",
"if",
"'SALT_RUNNING'",
"not",
"in",
"os",
".",
"environ",
":",
"with",
"open",
"(",
"CK_PATH",
",",
"'w'",
")",
"as",
"ck_fh",
":",
"ck_fh",
".",
"write",
"(",
"'{chksum} {mtime... | Hook after the package installation transaction.
:param conduit:
:return: | [
"Hook",
"after",
"the",
"package",
"installation",
"transaction",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L45-L55 | train |
saltstack/salt | salt/modules/postfix.py | _parse_master | def _parse_master(path=MASTER_CF):
'''
Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving emp... | python | def _parse_master(path=MASTER_CF):
'''
Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving emp... | [
"def",
"_parse_master",
"(",
"path",
"=",
"MASTER_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fh_",
":",
"full_conf",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
... | Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving empty lines and comments
intact. Where the val... | [
"Parse",
"the",
"master",
".",
"cf",
"file",
".",
"This",
"file",
"is",
"essentially",
"a",
"whitespace",
"-",
"delimited",
"columnar",
"file",
".",
"The",
"columns",
"are",
":",
"service",
"type",
"private",
"(",
"yes",
")",
"unpriv",
"(",
"yes",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L45-L84 | train |
saltstack/salt | salt/modules/postfix.py | set_master | def set_master(service,
conn_type,
private='y',
unpriv='y',
chroot='y',
wakeup='n',
maxproc='100',
command='',
write_conf=True,
path=MASTER_CF):
'''
Set a single config value in... | python | def set_master(service,
conn_type,
private='y',
unpriv='y',
chroot='y',
wakeup='n',
maxproc='100',
command='',
write_conf=True,
path=MASTER_CF):
'''
Set a single config value in... | [
"def",
"set_master",
"(",
"service",
",",
"conn_type",
",",
"private",
"=",
"'y'",
",",
"unpriv",
"=",
"'y'",
",",
"chroot",
"=",
"'y'",
",",
"wakeup",
"=",
"'n'",
",",
"maxproc",
"=",
"'100'",
",",
"command",
"=",
"''",
",",
"write_conf",
"=",
"True... | Set a single config value in the master.cf file. If the value does not
already exist, it will be appended to the end.
Because of shell parsing issues, '-' cannot be set as a value, as is normal
in the master.cf file; either 'y', 'n' or a number should be used when
calling this function from the command... | [
"Set",
"a",
"single",
"config",
"value",
"in",
"the",
"master",
".",
"cf",
"file",
".",
"If",
"the",
"value",
"does",
"not",
"already",
"exist",
"it",
"will",
"be",
"appended",
"to",
"the",
"end",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L104-L169 | train |
saltstack/salt | salt/modules/postfix.py | _format_master | def _format_master(service,
conn_type,
private,
unpriv,
chroot,
wakeup,
maxproc,
command):
'''
Format the given values into the style of line normally used in the
master.cf fi... | python | def _format_master(service,
conn_type,
private,
unpriv,
chroot,
wakeup,
maxproc,
command):
'''
Format the given values into the style of line normally used in the
master.cf fi... | [
"def",
"_format_master",
"(",
"service",
",",
"conn_type",
",",
"private",
",",
"unpriv",
",",
"chroot",
",",
"wakeup",
",",
"maxproc",
",",
"command",
")",
":",
"#==========================================================================",
"#service type private unpriv c... | Format the given values into the style of line normally used in the
master.cf file. | [
"Format",
"the",
"given",
"values",
"into",
"the",
"style",
"of",
"line",
"normally",
"used",
"in",
"the",
"master",
".",
"cf",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L172-L216 | train |
saltstack/salt | salt/modules/postfix.py | _parse_main | def _parse_main(path=MAIN_CF):
'''
Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace ru... | python | def _parse_main(path=MAIN_CF):
'''
Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace ru... | [
"def",
"_parse_main",
"(",
"path",
"=",
"MAIN_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fh_",
":",
"full_conf",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",... | Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace rule applies to comments.
* Keys defined ... | [
"Parse",
"files",
"in",
"the",
"style",
"of",
"main",
".",
"cf",
".",
"This",
"is",
"not",
"just",
"a",
"name",
"=",
"value",
"file",
";",
"there",
"are",
"other",
"rules",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L219-L264 | train |
saltstack/salt | salt/modules/postfix.py | set_main | def set_main(key, value, path=MAIN_CF):
'''
Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq
'''
pairs, conf_list = _parse_main(path)
new_conf =... | python | def set_main(key, value, path=MAIN_CF):
'''
Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq
'''
pairs, conf_list = _parse_main(path)
new_conf =... | [
"def",
"set_main",
"(",
"key",
",",
"value",
",",
"path",
"=",
"MAIN_CF",
")",
":",
"pairs",
",",
"conf_list",
"=",
"_parse_main",
"(",
"path",
")",
"new_conf",
"=",
"[",
"]",
"key_line_match",
"=",
"re",
".",
"compile",
"(",
"\"^{0}([\\\\s=]|$)\"",
".",... | Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq | [
"Set",
"a",
"single",
"config",
"value",
"in",
"the",
"main",
".",
"cf",
"file",
".",
"If",
"the",
"value",
"does",
"not",
"already",
"exist",
"it",
"will",
"be",
"appended",
"to",
"the",
"end",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L284-L308 | train |
saltstack/salt | salt/modules/postfix.py | _write_conf | def _write_conf(conf, path=MAIN_CF):
'''
Write out configuration file.
'''
with salt.utils.files.fopen(path, 'w') as fh_:
for line in conf:
line = salt.utils.stringutils.to_str(line)
if isinstance(line, dict):
fh_.write(' '.join(line))
else:
... | python | def _write_conf(conf, path=MAIN_CF):
'''
Write out configuration file.
'''
with salt.utils.files.fopen(path, 'w') as fh_:
for line in conf:
line = salt.utils.stringutils.to_str(line)
if isinstance(line, dict):
fh_.write(' '.join(line))
else:
... | [
"def",
"_write_conf",
"(",
"conf",
",",
"path",
"=",
"MAIN_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'w'",
")",
"as",
"fh_",
":",
"for",
"line",
"in",
"conf",
":",
"line",
"=",
"salt",
".",
"utils... | Write out configuration file. | [
"Write",
"out",
"configuration",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L311-L322 | train |
saltstack/salt | salt/modules/postfix.py | show_queue | def show_queue():
'''
Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue
'''
cmd = 'mailq'
out = __salt__['cmd.run'](cmd).splitlines()
queue = []
queue_pattern = re.compile(r"(?P<queue_id>^[A-Z0-9]+)\s+(?P<size>\d+)\s(?P<timesta... | python | def show_queue():
'''
Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue
'''
cmd = 'mailq'
out = __salt__['cmd.run'](cmd).splitlines()
queue = []
queue_pattern = re.compile(r"(?P<queue_id>^[A-Z0-9]+)\s+(?P<size>\d+)\s(?P<timesta... | [
"def",
"show_queue",
"(",
")",
":",
"cmd",
"=",
"'mailq'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"queue",
"=",
"[",
"]",
"queue_pattern",
"=",
"re",
".",
"compile",
"(",
"r\"(?P<queue_id>^[A-Z0-9]+)\... | Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue | [
"Show",
"contents",
"of",
"the",
"mail",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L325-L357 | train |
saltstack/salt | salt/modules/postfix.py | delete | def delete(queue_id):
'''
Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL
'''
ret = {'message': '',
'result': True
}
if not queue_id:
log.error('Require... | python | def delete(queue_id):
'''
Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL
'''
ret = {'message': '',
'result': True
}
if not queue_id:
log.error('Require... | [
"def",
"delete",
"(",
"queue_id",
")",
":",
"ret",
"=",
"{",
"'message'",
":",
"''",
",",
"'result'",
":",
"True",
"}",
"if",
"not",
"queue_id",
":",
"log",
".",
"error",
"(",
"'Require argument queue_id'",
")",
"if",
"not",
"queue_id",
"==",
"'ALL'",
... | Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL | [
"Delete",
"message",
"(",
"s",
")",
"from",
"the",
"mail",
"queue"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L360-L406 | train |
saltstack/salt | salt/modules/solrcloud.py | collection_get_options | def collection_get_options(collection_name, **kwargs):
'''
Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name
'''
cluster = cluster_st... | python | def collection_get_options(collection_name, **kwargs):
'''
Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name
'''
cluster = cluster_st... | [
"def",
"collection_get_options",
"(",
"collection_name",
",",
"*",
"*",
"kwargs",
")",
":",
"cluster",
"=",
"cluster_status",
"(",
"*",
"*",
"kwargs",
")",
"options",
"=",
"{",
"\"collection.configName\"",
":",
"cluster",
"[",
"\"collections\"",
"]",
"[",
"col... | Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name | [
"Get",
"collection",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solrcloud.py#L445-L473 | train |
saltstack/salt | salt/modules/solrcloud.py | collection_set_options | def collection_set_options(collection_name, options, **kwargs):
'''
Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
sal... | python | def collection_set_options(collection_name, options, **kwargs):
'''
Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
sal... | [
"def",
"collection_set_options",
"(",
"collection_name",
",",
"options",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"option",
"in",
"list",
"(",
"options",
".",
"keys",
"(",
")",
")",
":",
"if",
"option",
"not",
"in",
"CREATION_ONLY_OPTION",
":",
"raise",
... | Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_set_options collection_name options={"replication... | [
"Change",
"collection",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solrcloud.py#L476-L497 | train |
saltstack/salt | salt/modules/keystore.py | list | def list(keystore, passphrase, alias=None, return_cert=False):
'''
Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only t... | python | def list(keystore, passphrase, alias=None, return_cert=False):
'''
Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only t... | [
"def",
"list",
"(",
"keystore",
",",
"passphrase",
",",
"alias",
"=",
"None",
",",
"return_cert",
"=",
"False",
")",
":",
"ASN1",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_ASN1",
"PEM",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_PEM",
"decoded_certs... | Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only this key
:param return_certs: (Optional) Also return certificate PEM.
... | [
"Lists",
"certificates",
"in",
"a",
"keytool",
"managed",
"keystore",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L63-L121 | train |
saltstack/salt | salt/modules/keystore.py | add | def add(name, keystore, passphrase, certificate, private_key=None):
'''
Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the... | python | def add(name, keystore, passphrase, certificate, private_key=None):
'''
Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the... | [
"def",
"add",
"(",
"name",
",",
"keystore",
",",
"passphrase",
",",
"certificate",
",",
"private_key",
"=",
"None",
")",
":",
"ASN1",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_ASN1",
"PEM",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_PEM",
"certs_lis... | Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param certificate: The PEM public certificate to add to keystore.... | [
"Adds",
"certificates",
"to",
"an",
"existing",
"keystore",
"or",
"creates",
"a",
"new",
"one",
"if",
"necesssary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L124-L172 | train |
saltstack/salt | salt/modules/keystore.py | remove | def remove(name, keystore, passphrase):
'''
Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode t... | python | def remove(name, keystore, passphrase):
'''
Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode t... | [
"def",
"remove",
"(",
"name",
",",
"keystore",
",",
"passphrase",
")",
":",
"certs_list",
"=",
"[",
"]",
"keystore_object",
"=",
"jks",
".",
"KeyStore",
".",
"load",
"(",
"keystore",
",",
"passphrase",
")",
"for",
"alias",
",",
"loaded_cert",
"in",
"keys... | Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
CLI Example:
.. code-block:: b... | [
"Removes",
"a",
"certificate",
"from",
"an",
"existing",
"keystore",
".",
"Returns",
"True",
"if",
"remove",
"was",
"successful",
"otherwise",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L175-L203 | train |
saltstack/salt | salt/cache/localfs.py | store | def store(bank, key, data, cachedir):
'''
Store information in a file.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
try:
os.makedirs(base)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise SaltCacheError(
'The cache directory, {0}... | python | def store(bank, key, data, cachedir):
'''
Store information in a file.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
try:
os.makedirs(base)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise SaltCacheError(
'The cache directory, {0}... | [
"def",
"store",
"(",
"bank",
",",
"key",
",",
"data",
",",
"cachedir",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
")",
"try",
":",
"os",
".",
"makedirs",
"(... | Store information in a file. | [
"Store",
"information",
"in",
"a",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L44-L72 | train |
saltstack/salt | salt/cache/localfs.py | fetch | def fetch(bank, key, cachedir):
'''
Fetch information from a file.
'''
inkey = False
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
# The bank includes the full filename, and the key is inside the file
key_file = os... | python | def fetch(bank, key, cachedir):
'''
Fetch information from a file.
'''
inkey = False
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
# The bank includes the full filename, and the key is inside the file
key_file = os... | [
"def",
"fetch",
"(",
"bank",
",",
"key",
",",
"cachedir",
")",
":",
"inkey",
"=",
"False",
"key_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
",",
"'{0}.p'",
".",
"format",
... | Fetch information from a file. | [
"Fetch",
"information",
"from",
"a",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L75-L100 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.