repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/win_pkg.py | get_repo_data | def get_repo_data(saltenv='base'):
'''
Returns the existing package metadata db. Will create it, if it does not
exist, however will not refresh it.
Args:
saltenv (str): Salt environment. Default ``base``
Returns:
dict: A dict containing contents of metadata db.
CLI Example:
... | python | def get_repo_data(saltenv='base'):
'''
Returns the existing package metadata db. Will create it, if it does not
exist, however will not refresh it.
Args:
saltenv (str): Salt environment. Default ``base``
Returns:
dict: A dict containing contents of metadata db.
CLI Example:
... | [
"def",
"get_repo_data",
"(",
"saltenv",
"=",
"'base'",
")",
":",
"# we only call refresh_db if it does not exist, as we want to return",
"# the existing data even if its old, other parts of the code call this,",
"# but they will call refresh if they need too.",
"repo_details",
"=",
"_get_r... | Returns the existing package metadata db. Will create it, if it does not
exist, however will not refresh it.
Args:
saltenv (str): Salt environment. Default ``base``
Returns:
dict: A dict containing contents of metadata db.
CLI Example:
.. code-block:: bash
salt '*' pkg.g... | [
"Returns",
"the",
"existing",
"package",
"metadata",
"db",
".",
"Will",
"create",
"it",
"if",
"it",
"does",
"not",
"exist",
"however",
"will",
"not",
"refresh",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pkg.py#L2088-L2134 | train |
saltstack/salt | salt/modules/win_pkg.py | _get_name_map | def _get_name_map(saltenv='base'):
'''
Return a reverse map of full pkg names to the names recognized by winrepo.
'''
u_name_map = {}
name_map = get_repo_data(saltenv).get('name_map', {})
if not six.PY2:
return name_map
for k in name_map:
u_name_map[k] = name_map[k]
ret... | python | def _get_name_map(saltenv='base'):
'''
Return a reverse map of full pkg names to the names recognized by winrepo.
'''
u_name_map = {}
name_map = get_repo_data(saltenv).get('name_map', {})
if not six.PY2:
return name_map
for k in name_map:
u_name_map[k] = name_map[k]
ret... | [
"def",
"_get_name_map",
"(",
"saltenv",
"=",
"'base'",
")",
":",
"u_name_map",
"=",
"{",
"}",
"name_map",
"=",
"get_repo_data",
"(",
"saltenv",
")",
".",
"get",
"(",
"'name_map'",
",",
"{",
"}",
")",
"if",
"not",
"six",
".",
"PY2",
":",
"return",
"na... | Return a reverse map of full pkg names to the names recognized by winrepo. | [
"Return",
"a",
"reverse",
"map",
"of",
"full",
"pkg",
"names",
"to",
"the",
"names",
"recognized",
"by",
"winrepo",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pkg.py#L2137-L2149 | train |
saltstack/salt | salt/modules/win_pkg.py | compare_versions | def compare_versions(ver1='', oper='==', ver2=''):
'''
Compare software package versions
Args:
ver1 (str): A software version to compare
oper (str): The operand to use to compare
ver2 (str): A software version to compare
Returns:
bool: True if the comparison is valid, o... | python | def compare_versions(ver1='', oper='==', ver2=''):
'''
Compare software package versions
Args:
ver1 (str): A software version to compare
oper (str): The operand to use to compare
ver2 (str): A software version to compare
Returns:
bool: True if the comparison is valid, o... | [
"def",
"compare_versions",
"(",
"ver1",
"=",
"''",
",",
"oper",
"=",
"'=='",
",",
"ver2",
"=",
"''",
")",
":",
"if",
"not",
"ver1",
":",
"raise",
"SaltInvocationError",
"(",
"'compare_version, ver1 is blank'",
")",
"if",
"not",
"ver2",
":",
"raise",
"SaltI... | Compare software package versions
Args:
ver1 (str): A software version to compare
oper (str): The operand to use to compare
ver2 (str): A software version to compare
Returns:
bool: True if the comparison is valid, otherwise False
CLI Example:
.. code-block:: bash
... | [
"Compare",
"software",
"package",
"versions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_pkg.py#L2184-L2218 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser._read | def _read(self, fp, fpname):
'''
Makes the following changes from the RawConfigParser:
1. Strip leading tabs from non-section-header lines.
2. Treat 8 spaces at the beginning of a line as a tab.
3. Treat lines beginning with a tab as options.
4. Drops support for continu... | python | def _read(self, fp, fpname):
'''
Makes the following changes from the RawConfigParser:
1. Strip leading tabs from non-section-header lines.
2. Treat 8 spaces at the beginning of a line as a tab.
3. Treat lines beginning with a tab as options.
4. Drops support for continu... | [
"def",
"_read",
"(",
"self",
",",
"fp",
",",
"fpname",
")",
":",
"cursect",
"=",
"None",
"# None, or a dictionary",
"optname",
"=",
"None",
"lineno",
"=",
"0",
"e",
"=",
"None",
"# None, or an exception",
"while",
"True",
":",
"line",
"=",
"salt",
".",
"... | Makes the following changes from the RawConfigParser:
1. Strip leading tabs from non-section-header lines.
2. Treat 8 spaces at the beginning of a line as a tab.
3. Treat lines beginning with a tab as options.
4. Drops support for continuation lines.
5. Multiple values for a giv... | [
"Makes",
"the",
"following",
"changes",
"from",
"the",
"RawConfigParser",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L57-L137 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser._string_check | def _string_check(self, value, allow_list=False):
'''
Based on the string-checking code from the SafeConfigParser's set()
function, this enforces string values for config options.
'''
if self._optcre is self.OPTCRE or value:
is_list = isinstance(value, list)
... | python | def _string_check(self, value, allow_list=False):
'''
Based on the string-checking code from the SafeConfigParser's set()
function, this enforces string values for config options.
'''
if self._optcre is self.OPTCRE or value:
is_list = isinstance(value, list)
... | [
"def",
"_string_check",
"(",
"self",
",",
"value",
",",
"allow_list",
"=",
"False",
")",
":",
"if",
"self",
".",
"_optcre",
"is",
"self",
".",
"OPTCRE",
"or",
"value",
":",
"is_list",
"=",
"isinstance",
"(",
"value",
",",
"list",
")",
"if",
"is_list",
... | Based on the string-checking code from the SafeConfigParser's set()
function, this enforces string values for config options. | [
"Based",
"on",
"the",
"string",
"-",
"checking",
"code",
"from",
"the",
"SafeConfigParser",
"s",
"set",
"()",
"function",
"this",
"enforces",
"string",
"values",
"for",
"config",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L139-L151 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser.get | def get(self, section, option, as_list=False):
'''
Adds an optional "as_list" argument to ensure a list is returned. This
is helpful when iterating over an option which may or may not be a
multivar.
'''
ret = super(GitConfigParser, self).get(section, option)
if as... | python | def get(self, section, option, as_list=False):
'''
Adds an optional "as_list" argument to ensure a list is returned. This
is helpful when iterating over an option which may or may not be a
multivar.
'''
ret = super(GitConfigParser, self).get(section, option)
if as... | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"as_list",
"=",
"False",
")",
":",
"ret",
"=",
"super",
"(",
"GitConfigParser",
",",
"self",
")",
".",
"get",
"(",
"section",
",",
"option",
")",
"if",
"as_list",
"and",
"not",
"isinstanc... | Adds an optional "as_list" argument to ensure a list is returned. This
is helpful when iterating over an option which may or may not be a
multivar. | [
"Adds",
"an",
"optional",
"as_list",
"argument",
"to",
"ensure",
"a",
"list",
"is",
"returned",
".",
"This",
"is",
"helpful",
"when",
"iterating",
"over",
"an",
"option",
"which",
"may",
"or",
"may",
"not",
"be",
"a",
"multivar",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L153-L162 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser.set | def set(self, section, option, value=''):
'''
This is overridden from the RawConfigParser merely to change the
default value for the 'value' argument.
'''
self._string_check(value)
super(GitConfigParser, self).set(section, option, value) | python | def set(self, section, option, value=''):
'''
This is overridden from the RawConfigParser merely to change the
default value for the 'value' argument.
'''
self._string_check(value)
super(GitConfigParser, self).set(section, option, value) | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"''",
")",
":",
"self",
".",
"_string_check",
"(",
"value",
")",
"super",
"(",
"GitConfigParser",
",",
"self",
")",
".",
"set",
"(",
"section",
",",
"option",
",",
"value",
... | This is overridden from the RawConfigParser merely to change the
default value for the 'value' argument. | [
"This",
"is",
"overridden",
"from",
"the",
"RawConfigParser",
"merely",
"to",
"change",
"the",
"default",
"value",
"for",
"the",
"value",
"argument",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L164-L170 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser.set_multivar | def set_multivar(self, section, option, value=''):
'''
This function is unique to the GitConfigParser. It will add another
value for the option if it already exists, converting the option's
value to a list if applicable.
If "value" is a list, then any existing values for the spe... | python | def set_multivar(self, section, option, value=''):
'''
This function is unique to the GitConfigParser. It will add another
value for the option if it already exists, converting the option's
value to a list if applicable.
If "value" is a list, then any existing values for the spe... | [
"def",
"set_multivar",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"''",
")",
":",
"self",
".",
"_string_check",
"(",
"value",
",",
"allow_list",
"=",
"True",
")",
"if",
"not",
"section",
"or",
"section",
"==",
"self",
".",
"DEFAULTS... | This function is unique to the GitConfigParser. It will add another
value for the option if it already exists, converting the option's
value to a list if applicable.
If "value" is a list, then any existing values for the specified
section and option will be replaced with the list being ... | [
"This",
"function",
"is",
"unique",
"to",
"the",
"GitConfigParser",
".",
"It",
"will",
"add",
"another",
"value",
"for",
"the",
"option",
"if",
"it",
"already",
"exists",
"converting",
"the",
"option",
"s",
"value",
"to",
"a",
"list",
"if",
"applicable",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L189-L208 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser.remove_option_regexp | def remove_option_regexp(self, section, option, expr):
'''
Remove an option with a value matching the expression. Works on single
values and multivars.
'''
if not section or section == self.DEFAULTSECT:
sectdict = self._defaults
else:
try:
... | python | def remove_option_regexp(self, section, option, expr):
'''
Remove an option with a value matching the expression. Works on single
values and multivars.
'''
if not section or section == self.DEFAULTSECT:
sectdict = self._defaults
else:
try:
... | [
"def",
"remove_option_regexp",
"(",
"self",
",",
"section",
",",
"option",
",",
"expr",
")",
":",
"if",
"not",
"section",
"or",
"section",
"==",
"self",
".",
"DEFAULTSECT",
":",
"sectdict",
"=",
"self",
".",
"_defaults",
"else",
":",
"try",
":",
"sectdic... | Remove an option with a value matching the expression. Works on single
values and multivars. | [
"Remove",
"an",
"option",
"with",
"a",
"value",
"matching",
"the",
"expression",
".",
"Works",
"on",
"single",
"values",
"and",
"multivars",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L210-L241 | train |
saltstack/salt | salt/utils/configparser.py | GitConfigParser.write | def write(self, fp_):
'''
Makes the following changes from the RawConfigParser:
1. Prepends options with a tab character.
2. Does not write a blank line between sections.
3. When an option's value is a list, a line for each option is written.
This allows us to support... | python | def write(self, fp_):
'''
Makes the following changes from the RawConfigParser:
1. Prepends options with a tab character.
2. Does not write a blank line between sections.
3. When an option's value is a list, a line for each option is written.
This allows us to support... | [
"def",
"write",
"(",
"self",
",",
"fp_",
")",
":",
"convert",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"if",
"'b'",
"in",
"fp_",
".",
"mode",
"else",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_str",
"if",
"self",
".",
... | Makes the following changes from the RawConfigParser:
1. Prepends options with a tab character.
2. Does not write a blank line between sections.
3. When an option's value is a list, a line for each option is written.
This allows us to support multivars like a remote's "fetch" option.... | [
"Makes",
"the",
"following",
"changes",
"from",
"the",
"RawConfigParser",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/configparser.py#L243-L268 | train |
saltstack/salt | salt/pillar/csvpillar.py | ext_pillar | def ext_pillar(
mid,
pillar,
path,
idkey='id',
namespace=None,
fieldnames=None,
restkey=None,
restval=None,
dialect='excel'):
'''
Read a CSV into Pillar
:param str path: Absolute path to a CSV file.
:param str idkey: (Optional) The... | python | def ext_pillar(
mid,
pillar,
path,
idkey='id',
namespace=None,
fieldnames=None,
restkey=None,
restval=None,
dialect='excel'):
'''
Read a CSV into Pillar
:param str path: Absolute path to a CSV file.
:param str idkey: (Optional) The... | [
"def",
"ext_pillar",
"(",
"mid",
",",
"pillar",
",",
"path",
",",
"idkey",
"=",
"'id'",
",",
"namespace",
"=",
"None",
",",
"fieldnames",
"=",
"None",
",",
"restkey",
"=",
"None",
",",
"restval",
"=",
"None",
",",
"dialect",
"=",
"'excel'",
")",
":",... | Read a CSV into Pillar
:param str path: Absolute path to a CSV file.
:param str idkey: (Optional) The column name of minion IDs.
:param str namespace: (Optional) A pillar key to namespace the values under.
:param list fieldnames: (Optional) if the first row of the CSV is not
column names they m... | [
"Read",
"a",
"CSV",
"into",
"Pillar"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/csvpillar.py#L60-L90 | train |
saltstack/salt | salt/modules/openstack_config.py | set_ | def set_(filename, section, parameter, value):
'''
Set a value in an OpenStack configuration file.
filename
The full path to the configuration file
section
The section in which the parameter will be set
parameter
The parameter to change
value
The value to set
... | python | def set_(filename, section, parameter, value):
'''
Set a value in an OpenStack configuration file.
filename
The full path to the configuration file
section
The section in which the parameter will be set
parameter
The parameter to change
value
The value to set
... | [
"def",
"set_",
"(",
"filename",
",",
"section",
",",
"parameter",
",",
"value",
")",
":",
"filename",
"=",
"_quote",
"(",
"filename",
")",
"section",
"=",
"_quote",
"(",
"section",
")",
"parameter",
"=",
"_quote",
"(",
"parameter",
")",
"value",
"=",
"... | Set a value in an OpenStack configuration file.
filename
The full path to the configuration file
section
The section in which the parameter will be set
parameter
The parameter to change
value
The value to set
CLI Example:
.. code-block:: bash
salt-c... | [
"Set",
"a",
"value",
"in",
"an",
"OpenStack",
"configuration",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openstack_config.py#L50-L88 | train |
saltstack/salt | salt/modules/openstack_config.py | get | def get(filename, section, parameter):
'''
Get a value from an OpenStack configuration file.
filename
The full path to the configuration file
section
The section from which to search for the parameter
parameter
The parameter to return
CLI Example:
.. code-block::... | python | def get(filename, section, parameter):
'''
Get a value from an OpenStack configuration file.
filename
The full path to the configuration file
section
The section from which to search for the parameter
parameter
The parameter to return
CLI Example:
.. code-block::... | [
"def",
"get",
"(",
"filename",
",",
"section",
",",
"parameter",
")",
":",
"filename",
"=",
"_quote",
"(",
"filename",
")",
"section",
"=",
"_quote",
"(",
"section",
")",
"parameter",
"=",
"_quote",
"(",
"parameter",
")",
"result",
"=",
"__salt__",
"[",
... | Get a value from an OpenStack configuration file.
filename
The full path to the configuration file
section
The section from which to search for the parameter
parameter
The parameter to return
CLI Example:
.. code-block:: bash
salt-call openstack_config.get /etc/... | [
"Get",
"a",
"value",
"from",
"an",
"OpenStack",
"configuration",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openstack_config.py#L92-L127 | train |
saltstack/salt | salt/states/win_dacl.py | present | def present(name, objectType, user, permission, acetype, propagation):
'''
Ensure an ACE is present
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_ace'](name, objectType, user, permission, acetype, propagation, ... | python | def present(name, objectType, user, permission, acetype, propagation):
'''
Ensure an ACE is present
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_ace'](name, objectType, user, permission, acetype, propagation, ... | [
"def",
"present",
"(",
"name",
",",
"objectType",
",",
"user",
",",
"permission",
",",
"acetype",
",",
"propagation",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
"... | Ensure an ACE is present | [
"Ensure",
"an",
"ACE",
"is",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dacl.py#L86-L118 | train |
saltstack/salt | salt/states/win_dacl.py | inherit | def inherit(name, objectType, clear_existing_acl=False):
'''
Ensure an object is inheriting ACLs from its parent
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_inheritance'](name, objectType)
if tRet['result... | python | def inherit(name, objectType, clear_existing_acl=False):
'''
Ensure an object is inheriting ACLs from its parent
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_inheritance'](name, objectType)
if tRet['result... | [
"def",
"inherit",
"(",
"name",
",",
"objectType",
",",
"clear_existing_acl",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"tRet",
"=",... | Ensure an object is inheriting ACLs from its parent | [
"Ensure",
"an",
"object",
"is",
"inheriting",
"ACLs",
"from",
"its",
"parent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dacl.py#L156-L188 | train |
saltstack/salt | salt/states/win_dacl.py | disinherit | def disinherit(name, objectType, copy_inherited_acl=True):
'''
Ensure an object is not inheriting ACLs from its parent
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_inheritance'](name, objectType)
if tRet['... | python | def disinherit(name, objectType, copy_inherited_acl=True):
'''
Ensure an object is not inheriting ACLs from its parent
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
tRet = __salt__['win_dacl.check_inheritance'](name, objectType)
if tRet['... | [
"def",
"disinherit",
"(",
"name",
",",
"objectType",
",",
"copy_inherited_acl",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"tRet",
"=... | Ensure an object is not inheriting ACLs from its parent | [
"Ensure",
"an",
"object",
"is",
"not",
"inheriting",
"ACLs",
"from",
"its",
"parent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dacl.py#L191-L222 | train |
saltstack/salt | salt/output/progress.py | output | def output(ret, bar, **kwargs): # pylint: disable=unused-argument
'''
Update the progress bar
'''
if 'return_count' in ret:
val = ret['return_count']
# Avoid to fail if targets are behind a syndic. In this case actual return count will be
# higher than targeted by MoM itself.
... | python | def output(ret, bar, **kwargs): # pylint: disable=unused-argument
'''
Update the progress bar
'''
if 'return_count' in ret:
val = ret['return_count']
# Avoid to fail if targets are behind a syndic. In this case actual return count will be
# higher than targeted by MoM itself.
... | [
"def",
"output",
"(",
"ret",
",",
"bar",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"'return_count'",
"in",
"ret",
":",
"val",
"=",
"ret",
"[",
"'return_count'",
"]",
"# Avoid to fail if targets are behind a syndic. In this case actu... | Update the progress bar | [
"Update",
"the",
"progress",
"bar"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/progress.py#L21-L34 | train |
saltstack/salt | salt/output/progress.py | progress_iter | def progress_iter(progress):
'''
Initialize and return a progress bar iter
'''
widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.Timer(), ' Returns: [', progressbar.Counter(), '/{0}]'.format(progress['minion_count'])]
bar = progressbar.ProgressBar(widgets=widgets, maxval=... | python | def progress_iter(progress):
'''
Initialize and return a progress bar iter
'''
widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.Timer(), ' Returns: [', progressbar.Counter(), '/{0}]'.format(progress['minion_count'])]
bar = progressbar.ProgressBar(widgets=widgets, maxval=... | [
"def",
"progress_iter",
"(",
"progress",
")",
":",
"widgets",
"=",
"[",
"progressbar",
".",
"Percentage",
"(",
")",
",",
"' '",
",",
"progressbar",
".",
"Bar",
"(",
")",
",",
"' '",
",",
"progressbar",
".",
"Timer",
"(",
")",
",",
"' Returns: ['",
",",... | Initialize and return a progress bar iter | [
"Initialize",
"and",
"return",
"a",
"progress",
"bar",
"iter"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/progress.py#L37-L44 | train |
saltstack/salt | salt/utils/preseed.py | mksls | def mksls(src, dst=None):
'''
Convert a preseed file to an SLS file
'''
ps_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
line = salt.utils.stringutils.to_unicode(line)
if line.startswith('#'):
continue
if not line... | python | def mksls(src, dst=None):
'''
Convert a preseed file to an SLS file
'''
ps_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
line = salt.utils.stringutils.to_unicode(line)
if line.startswith('#'):
continue
if not line... | [
"def",
"mksls",
"(",
"src",
",",
"dst",
"=",
"None",
")",
":",
"ps_opts",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"src",
",",
"'r'",
")",
"as",
"fh_",
":",
"for",
"line",
"in",
"fh_",
":",
"line",
"=",
"s... | Convert a preseed file to an SLS file | [
"Convert",
"a",
"preseed",
"file",
"to",
"an",
"SLS",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/preseed.py#L14-L80 | train |
saltstack/salt | salt/modules/win_lgpo.py | _updateNamespace | def _updateNamespace(item, new_namespace):
'''
helper function to recursively update the namespaces of an item
'''
temp_item = ''
i = item.tag.find('}')
if i >= 0:
temp_item = item.tag[i+1:]
else:
temp_item = item.tag
item.tag = '{{{0}}}{1}'.format(new_namespace, temp_ite... | python | def _updateNamespace(item, new_namespace):
'''
helper function to recursively update the namespaces of an item
'''
temp_item = ''
i = item.tag.find('}')
if i >= 0:
temp_item = item.tag[i+1:]
else:
temp_item = item.tag
item.tag = '{{{0}}}{1}'.format(new_namespace, temp_ite... | [
"def",
"_updateNamespace",
"(",
"item",
",",
"new_namespace",
")",
":",
"temp_item",
"=",
"''",
"i",
"=",
"item",
".",
"tag",
".",
"find",
"(",
"'}'",
")",
"if",
"i",
">=",
"0",
":",
"temp_item",
"=",
"item",
".",
"tag",
"[",
"i",
"+",
"1",
":",
... | helper function to recursively update the namespaces of an item | [
"helper",
"function",
"to",
"recursively",
"update",
"the",
"namespaces",
"of",
"an",
"item"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4750-L4770 | train |
saltstack/salt | salt/modules/win_lgpo.py | _updatePolicyElements | def _updatePolicyElements(policy_item, regkey):
'''
helper function to add the reg key to each policies element definitions if
the key attribute is not defined to make xpath searching easier for each
child in the policy <elements> item
'''
for child in policy_item.getiterator():
if 'valu... | python | def _updatePolicyElements(policy_item, regkey):
'''
helper function to add the reg key to each policies element definitions if
the key attribute is not defined to make xpath searching easier for each
child in the policy <elements> item
'''
for child in policy_item.getiterator():
if 'valu... | [
"def",
"_updatePolicyElements",
"(",
"policy_item",
",",
"regkey",
")",
":",
"for",
"child",
"in",
"policy_item",
".",
"getiterator",
"(",
")",
":",
"if",
"'valueName'",
"in",
"child",
".",
"attrib",
":",
"if",
"'key'",
"not",
"in",
"child",
".",
"attrib",... | helper function to add the reg key to each policies element definitions if
the key attribute is not defined to make xpath searching easier for each
child in the policy <elements> item | [
"helper",
"function",
"to",
"add",
"the",
"reg",
"key",
"to",
"each",
"policies",
"element",
"definitions",
"if",
"the",
"key",
"attribute",
"is",
"not",
"defined",
"to",
"make",
"xpath",
"searching",
"easier",
"for",
"each",
"child",
"in",
"the",
"policy",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4773-L4783 | train |
saltstack/salt | salt/modules/win_lgpo.py | _remove_unicode_encoding | def _remove_unicode_encoding(xml_file):
'''
attempts to remove the "encoding='unicode'" from an xml file
as lxml does not support that on a windows node currently
see issue #38100
'''
with salt.utils.files.fopen(xml_file, 'rb') as f:
xml_content = f.read()
modified_xml = re.sub(r' en... | python | def _remove_unicode_encoding(xml_file):
'''
attempts to remove the "encoding='unicode'" from an xml file
as lxml does not support that on a windows node currently
see issue #38100
'''
with salt.utils.files.fopen(xml_file, 'rb') as f:
xml_content = f.read()
modified_xml = re.sub(r' en... | [
"def",
"_remove_unicode_encoding",
"(",
"xml_file",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"xml_file",
",",
"'rb'",
")",
"as",
"f",
":",
"xml_content",
"=",
"f",
".",
"read",
"(",
")",
"modified_xml",
"=",
"re",
".",
... | attempts to remove the "encoding='unicode'" from an xml file
as lxml does not support that on a windows node currently
see issue #38100 | [
"attempts",
"to",
"remove",
"the",
"encoding",
"=",
"unicode",
"from",
"an",
"xml",
"file",
"as",
"lxml",
"does",
"not",
"support",
"that",
"on",
"a",
"windows",
"node",
"currently",
"see",
"issue",
"#38100"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4786-L4796 | train |
saltstack/salt | salt/modules/win_lgpo.py | _load_policy_definitions | def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
language='en-US'):
'''
helper function to process all ADMX files in the specified policy_def_path
and build a single XML doc that we can search/use for ADMX policy processing
'''
# Fallback to the System... | python | def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
language='en-US'):
'''
helper function to process all ADMX files in the specified policy_def_path
and build a single XML doc that we can search/use for ADMX policy processing
'''
# Fallback to the System... | [
"def",
"_load_policy_definitions",
"(",
"path",
"=",
"'c:\\\\Windows\\\\PolicyDefinitions'",
",",
"language",
"=",
"'en-US'",
")",
":",
"# Fallback to the System Install Language",
"display_language_fallback",
"=",
"INSTALL_LANGUAGE",
"t_policy_definitions",
"=",
"lxml",
".",
... | helper function to process all ADMX files in the specified policy_def_path
and build a single XML doc that we can search/use for ADMX policy processing | [
"helper",
"function",
"to",
"process",
"all",
"ADMX",
"files",
"in",
"the",
"specified",
"policy_def_path",
"and",
"build",
"a",
"single",
"XML",
"doc",
"that",
"we",
"can",
"search",
"/",
"use",
"for",
"ADMX",
"policy",
"processing"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4799-L4944 | train |
saltstack/salt | salt/modules/win_lgpo.py | _buildElementNsmap | def _buildElementNsmap(using_elements):
'''
build a namespace map for an ADMX element
'''
thisMap = {}
for e in using_elements:
thisMap[e.attrib['prefix']] = e.attrib['namespace']
return thisMap | python | def _buildElementNsmap(using_elements):
'''
build a namespace map for an ADMX element
'''
thisMap = {}
for e in using_elements:
thisMap[e.attrib['prefix']] = e.attrib['namespace']
return thisMap | [
"def",
"_buildElementNsmap",
"(",
"using_elements",
")",
":",
"thisMap",
"=",
"{",
"}",
"for",
"e",
"in",
"using_elements",
":",
"thisMap",
"[",
"e",
".",
"attrib",
"[",
"'prefix'",
"]",
"]",
"=",
"e",
".",
"attrib",
"[",
"'namespace'",
"]",
"return",
... | build a namespace map for an ADMX element | [
"build",
"a",
"namespace",
"map",
"for",
"an",
"ADMX",
"element"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4963-L4970 | train |
saltstack/salt | salt/modules/win_lgpo.py | _get_audit_defaults | def _get_audit_defaults(option=None):
'''
Loads audit.csv defaults into a dict in __context__ called
'lgpo.audit_defaults'. The dictionary includes fieldnames and all
configurable policies as keys. The values are used to create/modify the
``audit.csv`` file. The first entry is `fieldnames` used to c... | python | def _get_audit_defaults(option=None):
'''
Loads audit.csv defaults into a dict in __context__ called
'lgpo.audit_defaults'. The dictionary includes fieldnames and all
configurable policies as keys. The values are used to create/modify the
``audit.csv`` file. The first entry is `fieldnames` used to c... | [
"def",
"_get_audit_defaults",
"(",
"option",
"=",
"None",
")",
":",
"if",
"'lgpo.audit_defaults'",
"not",
"in",
"__context__",
":",
"# Get available setting names and GUIDs",
"# This is used to get the fieldnames and GUIDs for individual policies",
"log",
".",
"debug",
"(",
"... | Loads audit.csv defaults into a dict in __context__ called
'lgpo.audit_defaults'. The dictionary includes fieldnames and all
configurable policies as keys. The values are used to create/modify the
``audit.csv`` file. The first entry is `fieldnames` used to create the
header for the csv file. The rest of... | [
"Loads",
"audit",
".",
"csv",
"defaults",
"into",
"a",
"dict",
"in",
"__context__",
"called",
"lgpo",
".",
"audit_defaults",
".",
"The",
"dictionary",
"includes",
"fieldnames",
"and",
"all",
"configurable",
"policies",
"as",
"keys",
".",
"The",
"values",
"are"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4973-L5056 | train |
saltstack/salt | salt/modules/win_lgpo.py | _findOptionValueAdvAudit | def _findOptionValueAdvAudit(option):
'''
Get the Advanced Auditing policy as configured in
``C:\\Windows\\Security\\Audit\\audit.csv``
Args:
option (str): The name of the setting as it appears in audit.csv
Returns:
bool: ``True`` if successful, otherwise ``False``
'''
if '... | python | def _findOptionValueAdvAudit(option):
'''
Get the Advanced Auditing policy as configured in
``C:\\Windows\\Security\\Audit\\audit.csv``
Args:
option (str): The name of the setting as it appears in audit.csv
Returns:
bool: ``True`` if successful, otherwise ``False``
'''
if '... | [
"def",
"_findOptionValueAdvAudit",
"(",
"option",
")",
":",
"if",
"'lgpo.adv_audit_data'",
"not",
"in",
"__context__",
":",
"system_root",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SystemRoot'",
",",
"'C:\\\\Windows'",
")",
"f_audit",
"=",
"os",
".",
"path... | Get the Advanced Auditing policy as configured in
``C:\\Windows\\Security\\Audit\\audit.csv``
Args:
option (str): The name of the setting as it appears in audit.csv
Returns:
bool: ``True`` if successful, otherwise ``False`` | [
"Get",
"the",
"Advanced",
"Auditing",
"policy",
"as",
"configured",
"in",
"C",
":",
"\\\\",
"Windows",
"\\\\",
"Security",
"\\\\",
"Audit",
"\\\\",
"audit",
".",
"csv"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5059-L5099 | train |
saltstack/salt | salt/modules/win_lgpo.py | _set_audit_file_data | def _set_audit_file_data(option, value):
'''
Helper function that sets the Advanced Audit settings in the two .csv files
on Windows. Those files are located at:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows NT\\Audit\\audit.csv
Args:
... | python | def _set_audit_file_data(option, value):
'''
Helper function that sets the Advanced Audit settings in the two .csv files
on Windows. Those files are located at:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows NT\\Audit\\audit.csv
Args:
... | [
"def",
"_set_audit_file_data",
"(",
"option",
",",
"value",
")",
":",
"# Set up some paths here",
"system_root",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SystemRoot'",
",",
"'C:\\\\Windows'",
")",
"f_audit",
"=",
"os",
".",
"path",
".",
"join",
"(",
"sy... | Helper function that sets the Advanced Audit settings in the two .csv files
on Windows. Those files are located at:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows NT\\Audit\\audit.csv
Args:
option (str): The name of the option to set
... | [
"Helper",
"function",
"that",
"sets",
"the",
"Advanced",
"Audit",
"settings",
"in",
"the",
"two",
".",
"csv",
"files",
"on",
"Windows",
".",
"Those",
"files",
"are",
"located",
"at",
":",
"C",
":",
"\\\\",
"Windows",
"\\\\",
"Security",
"\\\\",
"Audit",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5102-L5196 | train |
saltstack/salt | salt/modules/win_lgpo.py | _set_auditpol_data | def _set_auditpol_data(option, value):
'''
Helper function that updates the current applied settings to match what has
just been set in the audit.csv files. We're doing it this way instead of
running `gpupdate`
Args:
option (str): The name of the option to set
value (str): The value... | python | def _set_auditpol_data(option, value):
'''
Helper function that updates the current applied settings to match what has
just been set in the audit.csv files. We're doing it this way instead of
running `gpupdate`
Args:
option (str): The name of the option to set
value (str): The value... | [
"def",
"_set_auditpol_data",
"(",
"option",
",",
"value",
")",
":",
"auditpol_values",
"=",
"{",
"'None'",
":",
"'No Auditing'",
",",
"'0'",
":",
"'No Auditing'",
",",
"'1'",
":",
"'Success'",
",",
"'2'",
":",
"'Failure'",
",",
"'3'",
":",
"'Success and Fail... | Helper function that updates the current applied settings to match what has
just been set in the audit.csv files. We're doing it this way instead of
running `gpupdate`
Args:
option (str): The name of the option to set
value (str): The value to set. ['None', '0', '1', '2', '3']
Returns:... | [
"Helper",
"function",
"that",
"updates",
"the",
"current",
"applied",
"settings",
"to",
"match",
"what",
"has",
"just",
"been",
"set",
"in",
"the",
"audit",
".",
"csv",
"files",
".",
"We",
"re",
"doing",
"it",
"this",
"way",
"instead",
"of",
"running",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5199-L5220 | train |
saltstack/salt | salt/modules/win_lgpo.py | _setOptionValueAdvAudit | def _setOptionValueAdvAudit(option, value):
'''
Helper function to update the Advanced Audit policy on the machine. This
function modifies the two ``audit.csv`` files in the following locations:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows ... | python | def _setOptionValueAdvAudit(option, value):
'''
Helper function to update the Advanced Audit policy on the machine. This
function modifies the two ``audit.csv`` files in the following locations:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows ... | [
"def",
"_setOptionValueAdvAudit",
"(",
"option",
",",
"value",
")",
":",
"# Set the values in both audit.csv files",
"if",
"not",
"_set_audit_file_data",
"(",
"option",
"=",
"option",
",",
"value",
"=",
"value",
")",
":",
"raise",
"CommandExecutionError",
"(",
"'Fai... | Helper function to update the Advanced Audit policy on the machine. This
function modifies the two ``audit.csv`` files in the following locations:
C:\\Windows\\Security\\Audit\\audit.csv
C:\\Windows\\System32\\GroupPolicy\\Machine\\Microsoft\\Windows NT\\Audit\\audit.csv
Then it applies those settings... | [
"Helper",
"function",
"to",
"update",
"the",
"Advanced",
"Audit",
"policy",
"on",
"the",
"machine",
".",
"This",
"function",
"modifies",
"the",
"two",
"audit",
".",
"csv",
"files",
"in",
"the",
"following",
"locations",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5223-L5261 | train |
saltstack/salt | salt/modules/win_lgpo.py | _load_secedit_data | def _load_secedit_data():
'''
Helper function that loads secedit data. It runs `secedit /export /cfg
<file_name>` which creates a file that contains the secedit data.
Returns:
str: The contents of the file generated by the secedit command
'''
try:
f_exp = os.path.join(__opts__['... | python | def _load_secedit_data():
'''
Helper function that loads secedit data. It runs `secedit /export /cfg
<file_name>` which creates a file that contains the secedit data.
Returns:
str: The contents of the file generated by the secedit command
'''
try:
f_exp = os.path.join(__opts__['... | [
"def",
"_load_secedit_data",
"(",
")",
":",
"try",
":",
"f_exp",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'secedit-{0}.txt'",
".",
"format",
"(",
"UUID",
")",
")",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"[",
... | Helper function that loads secedit data. It runs `secedit /export /cfg
<file_name>` which creates a file that contains the secedit data.
Returns:
str: The contents of the file generated by the secedit command | [
"Helper",
"function",
"that",
"loads",
"secedit",
"data",
".",
"It",
"runs",
"secedit",
"/",
"export",
"/",
"cfg",
"<file_name",
">",
"which",
"creates",
"a",
"file",
"that",
"contains",
"the",
"secedit",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5312-L5329 | train |
saltstack/salt | salt/modules/win_lgpo.py | _get_secedit_value | def _get_secedit_value(option):
'''
Helper function that looks for the passed option in the secedit data
'''
secedit_data = _get_secedit_data()
for _line in secedit_data:
if _line.startswith(option):
return _line.split('=')[1].strip()
return 'Not Defined' | python | def _get_secedit_value(option):
'''
Helper function that looks for the passed option in the secedit data
'''
secedit_data = _get_secedit_data()
for _line in secedit_data:
if _line.startswith(option):
return _line.split('=')[1].strip()
return 'Not Defined' | [
"def",
"_get_secedit_value",
"(",
"option",
")",
":",
"secedit_data",
"=",
"_get_secedit_data",
"(",
")",
"for",
"_line",
"in",
"secedit_data",
":",
"if",
"_line",
".",
"startswith",
"(",
"option",
")",
":",
"return",
"_line",
".",
"split",
"(",
"'='",
")"... | Helper function that looks for the passed option in the secedit data | [
"Helper",
"function",
"that",
"looks",
"for",
"the",
"passed",
"option",
"in",
"the",
"secedit",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5346-L5354 | train |
saltstack/salt | salt/modules/win_lgpo.py | _write_secedit_data | def _write_secedit_data(inf_data):
'''
Helper function to write secedit data to the database
'''
# Set file names
f_sdb = os.path.join(__opts__['cachedir'], 'secedit-{0}.sdb'.format(UUID))
f_inf = os.path.join(__opts__['cachedir'], 'secedit-{0}.inf'.format(UUID))
try:
# Write the ch... | python | def _write_secedit_data(inf_data):
'''
Helper function to write secedit data to the database
'''
# Set file names
f_sdb = os.path.join(__opts__['cachedir'], 'secedit-{0}.sdb'.format(UUID))
f_inf = os.path.join(__opts__['cachedir'], 'secedit-{0}.inf'.format(UUID))
try:
# Write the ch... | [
"def",
"_write_secedit_data",
"(",
"inf_data",
")",
":",
"# Set file names",
"f_sdb",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'secedit-{0}.sdb'",
".",
"format",
"(",
"UUID",
")",
")",
"f_inf",
"=",
"os",
".",
"... | Helper function to write secedit data to the database | [
"Helper",
"function",
"to",
"write",
"secedit",
"data",
"to",
"the",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5357-L5383 | train |
saltstack/salt | salt/modules/win_lgpo.py | _transform_value | def _transform_value(value, policy, transform_type):
'''
helper function to transform the policy value into something that more
closely matches how the policy is displayed in the gpedit GUI
'''
t_kwargs = {}
if 'Transform' in policy:
if transform_type in policy['Transform']:
... | python | def _transform_value(value, policy, transform_type):
'''
helper function to transform the policy value into something that more
closely matches how the policy is displayed in the gpedit GUI
'''
t_kwargs = {}
if 'Transform' in policy:
if transform_type in policy['Transform']:
... | [
"def",
"_transform_value",
"(",
"value",
",",
"policy",
",",
"transform_type",
")",
":",
"t_kwargs",
"=",
"{",
"}",
"if",
"'Transform'",
"in",
"policy",
":",
"if",
"transform_type",
"in",
"policy",
"[",
"'Transform'",
"]",
":",
"_policydata",
"=",
"_policy_i... | helper function to transform the policy value into something that more
closely matches how the policy is displayed in the gpedit GUI | [
"helper",
"function",
"to",
"transform",
"the",
"policy",
"value",
"into",
"something",
"that",
"more",
"closely",
"matches",
"how",
"the",
"policy",
"is",
"displayed",
"in",
"the",
"gpedit",
"GUI"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5386-L5404 | train |
saltstack/salt | salt/modules/win_lgpo.py | _validateSetting | def _validateSetting(value, policy):
'''
helper function to validate specified value is appropriate for the policy
if the 'Settings' key is a list, the value will check that it is in the list
if the 'Settings' key is a dict we will try to execute the function name
from the 'Function' key, passin... | python | def _validateSetting(value, policy):
'''
helper function to validate specified value is appropriate for the policy
if the 'Settings' key is a list, the value will check that it is in the list
if the 'Settings' key is a dict we will try to execute the function name
from the 'Function' key, passin... | [
"def",
"_validateSetting",
"(",
"value",
",",
"policy",
")",
":",
"log",
".",
"debug",
"(",
"'validating %s for policy %s'",
",",
"value",
",",
"policy",
")",
"if",
"'Settings'",
"in",
"policy",
":",
"if",
"policy",
"[",
"'Settings'",
"]",
":",
"if",
"isin... | helper function to validate specified value is appropriate for the policy
if the 'Settings' key is a list, the value will check that it is in the list
if the 'Settings' key is a dict we will try to execute the function name
from the 'Function' key, passing the value and additional arguments from
... | [
"helper",
"function",
"to",
"validate",
"specified",
"value",
"is",
"appropriate",
"for",
"the",
"policy",
"if",
"the",
"Settings",
"key",
"is",
"a",
"list",
"the",
"value",
"will",
"check",
"that",
"it",
"is",
"in",
"the",
"list",
"if",
"the",
"Settings",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5407-L5431 | train |
saltstack/salt | salt/modules/win_lgpo.py | _addAccountRights | def _addAccountRights(sidObject, user_right):
'''
helper function to add an account right to a user
'''
try:
if sidObject:
_polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
user_rights_list = [user_right]
_ret = win32security.LsaA... | python | def _addAccountRights(sidObject, user_right):
'''
helper function to add an account right to a user
'''
try:
if sidObject:
_polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
user_rights_list = [user_right]
_ret = win32security.LsaA... | [
"def",
"_addAccountRights",
"(",
"sidObject",
",",
"user_right",
")",
":",
"try",
":",
"if",
"sidObject",
":",
"_polHandle",
"=",
"win32security",
".",
"LsaOpenPolicy",
"(",
"None",
",",
"win32security",
".",
"POLICY_ALL_ACCESS",
")",
"user_rights_list",
"=",
"[... | helper function to add an account right to a user | [
"helper",
"function",
"to",
"add",
"an",
"account",
"right",
"to",
"a",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5434-L5448 | train |
saltstack/salt | salt/modules/win_lgpo.py | _delAccountRights | def _delAccountRights(sidObject, user_right):
'''
helper function to remove an account right from a user
'''
try:
_polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
user_rights_list = [user_right]
_ret = win32security.LsaRemoveAccountRights(_polHandle... | python | def _delAccountRights(sidObject, user_right):
'''
helper function to remove an account right from a user
'''
try:
_polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
user_rights_list = [user_right]
_ret = win32security.LsaRemoveAccountRights(_polHandle... | [
"def",
"_delAccountRights",
"(",
"sidObject",
",",
"user_right",
")",
":",
"try",
":",
"_polHandle",
"=",
"win32security",
".",
"LsaOpenPolicy",
"(",
"None",
",",
"win32security",
".",
"POLICY_ALL_ACCESS",
")",
"user_rights_list",
"=",
"[",
"user_right",
"]",
"_... | helper function to remove an account right from a user | [
"helper",
"function",
"to",
"remove",
"an",
"account",
"right",
"from",
"a",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5451-L5462 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getRightsAssignments | def _getRightsAssignments(user_right):
'''
helper function to return all the user rights assignments/users
'''
sids = []
polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
sids = win32security.LsaEnumerateAccountsWithUserRight(polHandle, user_right)
return sids | python | def _getRightsAssignments(user_right):
'''
helper function to return all the user rights assignments/users
'''
sids = []
polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
sids = win32security.LsaEnumerateAccountsWithUserRight(polHandle, user_right)
return sids | [
"def",
"_getRightsAssignments",
"(",
"user_right",
")",
":",
"sids",
"=",
"[",
"]",
"polHandle",
"=",
"win32security",
".",
"LsaOpenPolicy",
"(",
"None",
",",
"win32security",
".",
"POLICY_ALL_ACCESS",
")",
"sids",
"=",
"win32security",
".",
"LsaEnumerateAccountsW... | helper function to return all the user rights assignments/users | [
"helper",
"function",
"to",
"return",
"all",
"the",
"user",
"rights",
"assignments",
"/",
"users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5465-L5472 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getAdmlDisplayName | def _getAdmlDisplayName(adml_xml_data, display_name):
'''
helper function to take the 'displayName' attribute of an element and find
the value from the ADML data
adml_xml_data :: XML data of all ADML files to search
display_name :: the value of the displayName attribute from the ADMX entry
... | python | def _getAdmlDisplayName(adml_xml_data, display_name):
'''
helper function to take the 'displayName' attribute of an element and find
the value from the ADML data
adml_xml_data :: XML data of all ADML files to search
display_name :: the value of the displayName attribute from the ADMX entry
... | [
"def",
"_getAdmlDisplayName",
"(",
"adml_xml_data",
",",
"display_name",
")",
":",
"if",
"display_name",
".",
"startswith",
"(",
"'$('",
")",
"and",
"display_name",
".",
"endswith",
"(",
"')'",
")",
":",
"display_name",
"=",
"re",
".",
"sub",
"(",
"r'(^\\$\\... | helper function to take the 'displayName' attribute of an element and find
the value from the ADML data
adml_xml_data :: XML data of all ADML files to search
display_name :: the value of the displayName attribute from the ADMX entry
to search the ADML data for | [
"helper",
"function",
"to",
"take",
"the",
"displayName",
"attribute",
"of",
"an",
"element",
"and",
"find",
"the",
"value",
"from",
"the",
"ADML",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5475-L5496 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getAdmlPresentationRefId | def _getAdmlPresentationRefId(adml_data, ref_id):
'''
helper function to check for a presentation label for a policy element
'''
search_results = adml_data.xpath('//*[@*[local-name() = "refId"] = "{0}"]'.format(ref_id))
prepended_text = ''
if search_results:
for result in search_results:... | python | def _getAdmlPresentationRefId(adml_data, ref_id):
'''
helper function to check for a presentation label for a policy element
'''
search_results = adml_data.xpath('//*[@*[local-name() = "refId"] = "{0}"]'.format(ref_id))
prepended_text = ''
if search_results:
for result in search_results:... | [
"def",
"_getAdmlPresentationRefId",
"(",
"adml_data",
",",
"ref_id",
")",
":",
"search_results",
"=",
"adml_data",
".",
"xpath",
"(",
"'//*[@*[local-name() = \"refId\"] = \"{0}\"]'",
".",
"format",
"(",
"ref_id",
")",
")",
"prepended_text",
"=",
"''",
"if",
"search_... | helper function to check for a presentation label for a policy element | [
"helper",
"function",
"to",
"check",
"for",
"a",
"presentation",
"label",
"for",
"a",
"policy",
"element"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5499-L5540 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getFullPolicyName | def _getFullPolicyName(policy_item,
policy_name,
return_full_policy_names,
adml_language):
'''
helper function to retrieve the full policy name if needed
'''
adml_data = _get_policy_resources(language=adml_language)
if policy_name ... | python | def _getFullPolicyName(policy_item,
policy_name,
return_full_policy_names,
adml_language):
'''
helper function to retrieve the full policy name if needed
'''
adml_data = _get_policy_resources(language=adml_language)
if policy_name ... | [
"def",
"_getFullPolicyName",
"(",
"policy_item",
",",
"policy_name",
",",
"return_full_policy_names",
",",
"adml_language",
")",
":",
"adml_data",
"=",
"_get_policy_resources",
"(",
"language",
"=",
"adml_language",
")",
"if",
"policy_name",
"in",
"adm_policy_name_map",... | helper function to retrieve the full policy name if needed | [
"helper",
"function",
"to",
"retrieve",
"the",
"full",
"policy",
"name",
"if",
"needed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5543-L5564 | train |
saltstack/salt | salt/modules/win_lgpo.py | _regexSearchRegPolData | def _regexSearchRegPolData(search_string, policy_data):
'''
helper function to do a search of Policy data from a registry.pol file
returns True if the regex search_string is found, otherwise False
'''
if policy_data:
if search_string:
match = re.search(search_string, policy_data,... | python | def _regexSearchRegPolData(search_string, policy_data):
'''
helper function to do a search of Policy data from a registry.pol file
returns True if the regex search_string is found, otherwise False
'''
if policy_data:
if search_string:
match = re.search(search_string, policy_data,... | [
"def",
"_regexSearchRegPolData",
"(",
"search_string",
",",
"policy_data",
")",
":",
"if",
"policy_data",
":",
"if",
"search_string",
":",
"match",
"=",
"re",
".",
"search",
"(",
"search_string",
",",
"policy_data",
",",
"re",
".",
"IGNORECASE",
")",
"if",
"... | helper function to do a search of Policy data from a registry.pol file
returns True if the regex search_string is found, otherwise False | [
"helper",
"function",
"to",
"do",
"a",
"search",
"of",
"Policy",
"data",
"from",
"a",
"registry",
".",
"pol",
"file",
"returns",
"True",
"if",
"the",
"regex",
"search_string",
"is",
"found",
"otherwise",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5567-L5577 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getDataFromRegPolData | def _getDataFromRegPolData(search_string, policy_data, return_value_name=False):
'''
helper function to do a search of Policy data from a registry.pol file
returns the "data" field
https://msdn.microsoft.com/en-us/library/aa374407(VS.85).aspx
[key;value;type;size;data]
'''
value = None
v... | python | def _getDataFromRegPolData(search_string, policy_data, return_value_name=False):
'''
helper function to do a search of Policy data from a registry.pol file
returns the "data" field
https://msdn.microsoft.com/en-us/library/aa374407(VS.85).aspx
[key;value;type;size;data]
'''
value = None
v... | [
"def",
"_getDataFromRegPolData",
"(",
"search_string",
",",
"policy_data",
",",
"return_value_name",
"=",
"False",
")",
":",
"value",
"=",
"None",
"values",
"=",
"[",
"]",
"encoded_semicolon",
"=",
"';'",
".",
"encode",
"(",
"'utf-16-le'",
")",
"if",
"return_v... | helper function to do a search of Policy data from a registry.pol file
returns the "data" field
https://msdn.microsoft.com/en-us/library/aa374407(VS.85).aspx
[key;value;type;size;data] | [
"helper",
"function",
"to",
"do",
"a",
"search",
"of",
"Policy",
"data",
"from",
"a",
"registry",
".",
"pol",
"file",
"returns",
"the",
"data",
"field",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5580-L5634 | train |
saltstack/salt | salt/modules/win_lgpo.py | _checkListItem | def _checkListItem(policy_element, policy_name, policy_key, xpath_object, policy_file_data, test_items=True):
'''
helper function to process an enabled/disabled/true/falseList set
if test_items is True, it will determine if the policy is enabled or
disabled returning True if all items are configured in... | python | def _checkListItem(policy_element, policy_name, policy_key, xpath_object, policy_file_data, test_items=True):
'''
helper function to process an enabled/disabled/true/falseList set
if test_items is True, it will determine if the policy is enabled or
disabled returning True if all items are configured in... | [
"def",
"_checkListItem",
"(",
"policy_element",
",",
"policy_name",
",",
"policy_key",
",",
"xpath_object",
",",
"policy_file_data",
",",
"test_items",
"=",
"True",
")",
":",
"xpath_string",
"=",
"(",
"'.//*[local-name() = \"decimal\" or local-name() = \"delete\"'",
"' or... | helper function to process an enabled/disabled/true/falseList set
if test_items is True, it will determine if the policy is enabled or
disabled returning True if all items are configured in the registry.pol file
and false if they are not
if test_items is False, the expected strings for the items will ... | [
"helper",
"function",
"to",
"process",
"an",
"enabled",
"/",
"disabled",
"/",
"true",
"/",
"falseList",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5637-L5695 | train |
saltstack/salt | salt/modules/win_lgpo.py | _checkValueItemParent | def _checkValueItemParent(policy_element, policy_name, policy_key,
policy_valueName, xpath_object, policy_file_data,
check_deleted=False, test_item=True):
'''
helper function to process the parent of a value item object
if test_item is True, it will determ... | python | def _checkValueItemParent(policy_element, policy_name, policy_key,
policy_valueName, xpath_object, policy_file_data,
check_deleted=False, test_item=True):
'''
helper function to process the parent of a value item object
if test_item is True, it will determ... | [
"def",
"_checkValueItemParent",
"(",
"policy_element",
",",
"policy_name",
",",
"policy_key",
",",
"policy_valueName",
",",
"xpath_object",
",",
"policy_file_data",
",",
"check_deleted",
"=",
"False",
",",
"test_item",
"=",
"True",
")",
":",
"for",
"element",
"in"... | helper function to process the parent of a value item object
if test_item is True, it will determine if the policy is enabled/disabled
returns True if the value is configured in the registry.pol file, otherwise returns False
if test_item is False, the expected search string will be returned
value type... | [
"helper",
"function",
"to",
"process",
"the",
"parent",
"of",
"a",
"value",
"item",
"object",
"if",
"test_item",
"is",
"True",
"it",
"will",
"determine",
"if",
"the",
"policy",
"is",
"enabled",
"/",
"disabled",
"returns",
"True",
"if",
"the",
"value",
"is"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5698-L5728 | train |
saltstack/salt | salt/modules/win_lgpo.py | _buildKnownDataSearchString | def _buildKnownDataSearchString(reg_key, reg_valueName, reg_vtype, reg_data,
check_deleted=False):
'''
helper function similar to _processValueItem to build a search string for a
known key/value/type/data
'''
registry = Registry()
this_element_value = None
exp... | python | def _buildKnownDataSearchString(reg_key, reg_valueName, reg_vtype, reg_data,
check_deleted=False):
'''
helper function similar to _processValueItem to build a search string for a
known key/value/type/data
'''
registry = Registry()
this_element_value = None
exp... | [
"def",
"_buildKnownDataSearchString",
"(",
"reg_key",
",",
"reg_valueName",
",",
"reg_vtype",
",",
"reg_data",
",",
"check_deleted",
"=",
"False",
")",
":",
"registry",
"=",
"Registry",
"(",
")",
"this_element_value",
"=",
"None",
"expected_string",
"=",
"b''",
... | helper function similar to _processValueItem to build a search string for a
known key/value/type/data | [
"helper",
"function",
"similar",
"to",
"_processValueItem",
"to",
"build",
"a",
"search",
"string",
"for",
"a",
"known",
"key",
"/",
"value",
"/",
"type",
"/",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5731-L5785 | train |
saltstack/salt | salt/modules/win_lgpo.py | _processValueItem | def _processValueItem(element, reg_key, reg_valuename, policy, parent_element,
check_deleted=False, this_element_value=None):
'''
helper function to process a value type item and generate the expected
string in the Registry.pol file
element - the element to process
reg_key - t... | python | def _processValueItem(element, reg_key, reg_valuename, policy, parent_element,
check_deleted=False, this_element_value=None):
'''
helper function to process a value type item and generate the expected
string in the Registry.pol file
element - the element to process
reg_key - t... | [
"def",
"_processValueItem",
"(",
"element",
",",
"reg_key",
",",
"reg_valuename",
",",
"policy",
",",
"parent_element",
",",
"check_deleted",
"=",
"False",
",",
"this_element_value",
"=",
"None",
")",
":",
"registry",
"=",
"Registry",
"(",
")",
"expected_string"... | helper function to process a value type item and generate the expected
string in the Registry.pol file
element - the element to process
reg_key - the registry key associated with the element (some inherit from
their parent policy)
reg_valuename - the registry valueName associated with the... | [
"helper",
"function",
"to",
"process",
"a",
"value",
"type",
"item",
"and",
"generate",
"the",
"expected",
"string",
"in",
"the",
"Registry",
".",
"pol",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5788-L6047 | train |
saltstack/salt | salt/modules/win_lgpo.py | _checkAllAdmxPolicies | def _checkAllAdmxPolicies(policy_class,
adml_language='en-US',
return_full_policy_names=False,
hierarchical_return=False,
return_not_configured=False):
'''
rewrite of _getAllAdminTemplateSettingsFromRegPolFil... | python | def _checkAllAdmxPolicies(policy_class,
adml_language='en-US',
return_full_policy_names=False,
hierarchical_return=False,
return_not_configured=False):
'''
rewrite of _getAllAdminTemplateSettingsFromRegPolFil... | [
"def",
"_checkAllAdmxPolicies",
"(",
"policy_class",
",",
"adml_language",
"=",
"'en-US'",
",",
"return_full_policy_names",
"=",
"False",
",",
"hierarchical_return",
"=",
"False",
",",
"return_not_configured",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'PO... | rewrite of _getAllAdminTemplateSettingsFromRegPolFile where instead of
looking only at the contents of the file, we're going to loop through every
policy and look in the registry.pol file to determine if it is
enabled/disabled/not configured | [
"rewrite",
"of",
"_getAllAdminTemplateSettingsFromRegPolFile",
"where",
"instead",
"of",
"looking",
"only",
"at",
"the",
"contents",
"of",
"the",
"file",
"we",
"re",
"going",
"to",
"loop",
"through",
"every",
"policy",
"and",
"look",
"in",
"the",
"registry",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6050-L6507 | train |
saltstack/salt | salt/modules/win_lgpo.py | _build_parent_list | def _build_parent_list(policy_definition,
return_full_policy_names,
adml_language):
'''
helper function to build a list containing parent elements of the ADMX
policy
'''
parent_list = []
policy_namespace = list(policy_definition.nsmap.keys())[0]
... | python | def _build_parent_list(policy_definition,
return_full_policy_names,
adml_language):
'''
helper function to build a list containing parent elements of the ADMX
policy
'''
parent_list = []
policy_namespace = list(policy_definition.nsmap.keys())[0]
... | [
"def",
"_build_parent_list",
"(",
"policy_definition",
",",
"return_full_policy_names",
",",
"adml_language",
")",
":",
"parent_list",
"=",
"[",
"]",
"policy_namespace",
"=",
"list",
"(",
"policy_definition",
".",
"nsmap",
".",
"keys",
"(",
")",
")",
"[",
"0",
... | helper function to build a list containing parent elements of the ADMX
policy | [
"helper",
"function",
"to",
"build",
"a",
"list",
"containing",
"parent",
"elements",
"of",
"the",
"ADMX",
"policy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6510-L6539 | train |
saltstack/salt | salt/modules/win_lgpo.py | _admx_policy_parent_walk | def _admx_policy_parent_walk(path,
policy_namespace,
parent_category,
policy_nsmap,
return_full_policy_names,
adml_language):
'''
helper function to recursively walk u... | python | def _admx_policy_parent_walk(path,
policy_namespace,
parent_category,
policy_nsmap,
return_full_policy_names,
adml_language):
'''
helper function to recursively walk u... | [
"def",
"_admx_policy_parent_walk",
"(",
"path",
",",
"policy_namespace",
",",
"parent_category",
",",
"policy_nsmap",
",",
"return_full_policy_names",
",",
"adml_language",
")",
":",
"admx_policy_definitions",
"=",
"_get_policy_definitions",
"(",
"language",
"=",
"adml_la... | helper function to recursively walk up the ADMX namespaces and build the
hierarchy for the policy | [
"helper",
"function",
"to",
"recursively",
"walk",
"up",
"the",
"ADMX",
"namespaces",
"and",
"build",
"the",
"hierarchy",
"for",
"the",
"policy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6542-L6582 | train |
saltstack/salt | salt/modules/win_lgpo.py | _read_regpol_file | def _read_regpol_file(reg_pol_path):
'''
helper function to read a reg policy file and return decoded data
'''
returndata = None
if os.path.exists(reg_pol_path):
with salt.utils.files.fopen(reg_pol_path, 'rb') as pol_file:
returndata = pol_file.read()
return returndata | python | def _read_regpol_file(reg_pol_path):
'''
helper function to read a reg policy file and return decoded data
'''
returndata = None
if os.path.exists(reg_pol_path):
with salt.utils.files.fopen(reg_pol_path, 'rb') as pol_file:
returndata = pol_file.read()
return returndata | [
"def",
"_read_regpol_file",
"(",
"reg_pol_path",
")",
":",
"returndata",
"=",
"None",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"reg_pol_path",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"reg_pol_path",
",",
"'rb'",
")",
... | helper function to read a reg policy file and return decoded data | [
"helper",
"function",
"to",
"read",
"a",
"reg",
"policy",
"file",
"and",
"return",
"decoded",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6585-L6593 | train |
saltstack/salt | salt/modules/win_lgpo.py | _regexSearchKeyValueCombo | def _regexSearchKeyValueCombo(policy_data, policy_regpath, policy_regkey):
'''
helper function to do a search of Policy data from a registry.pol file
for a policy_regpath and policy_regkey combo
'''
if policy_data:
specialValueRegex = salt.utils.stringutils.to_bytes(r'(\*\*Del\.|\*\*DelVals\... | python | def _regexSearchKeyValueCombo(policy_data, policy_regpath, policy_regkey):
'''
helper function to do a search of Policy data from a registry.pol file
for a policy_regpath and policy_regkey combo
'''
if policy_data:
specialValueRegex = salt.utils.stringutils.to_bytes(r'(\*\*Del\.|\*\*DelVals\... | [
"def",
"_regexSearchKeyValueCombo",
"(",
"policy_data",
",",
"policy_regpath",
",",
"policy_regkey",
")",
":",
"if",
"policy_data",
":",
"specialValueRegex",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"r'(\\*\\*Del\\.|\\*\\*DelVals\\.){0,1}'",
... | helper function to do a search of Policy data from a registry.pol file
for a policy_regpath and policy_regkey combo | [
"helper",
"function",
"to",
"do",
"a",
"search",
"of",
"Policy",
"data",
"from",
"a",
"registry",
".",
"pol",
"file",
"for",
"a",
"policy_regpath",
"and",
"policy_regkey",
"combo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6596-L6615 | train |
saltstack/salt | salt/modules/win_lgpo.py | _write_regpol_data | def _write_regpol_data(data_to_write,
policy_file_path,
gpt_ini_path,
gpt_extension,
gpt_extension_guid):
'''
helper function to actually write the data to a Registry.pol file
also updates/edits the gpt.ini file to ... | python | def _write_regpol_data(data_to_write,
policy_file_path,
gpt_ini_path,
gpt_extension,
gpt_extension_guid):
'''
helper function to actually write the data to a Registry.pol file
also updates/edits the gpt.ini file to ... | [
"def",
"_write_regpol_data",
"(",
"data_to_write",
",",
"policy_file_path",
",",
"gpt_ini_path",
",",
"gpt_extension",
",",
"gpt_extension_guid",
")",
":",
"try",
":",
"reg_pol_header",
"=",
"u'\\u5250\\u6765\\x01\\x00'",
"if",
"not",
"os",
".",
"path",
".",
"exists... | helper function to actually write the data to a Registry.pol file
also updates/edits the gpt.ini file to include the ADM policy extensions
to let the computer know user and/or machine registry policy files need
to be processed
data_to_write: data to write into the user/machine registry.pol file
po... | [
"helper",
"function",
"to",
"actually",
"write",
"the",
"data",
"to",
"a",
"Registry",
".",
"pol",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6618-L6719 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policyFileReplaceOrAppendList | def _policyFileReplaceOrAppendList(string_list, policy_data):
'''
helper function to take a list of strings for registry.pol file data and
update existing strings or append the strings
'''
if not policy_data:
policy_data = b''
# we are going to clean off the special pre-fixes, so we get ... | python | def _policyFileReplaceOrAppendList(string_list, policy_data):
'''
helper function to take a list of strings for registry.pol file data and
update existing strings or append the strings
'''
if not policy_data:
policy_data = b''
# we are going to clean off the special pre-fixes, so we get ... | [
"def",
"_policyFileReplaceOrAppendList",
"(",
"string_list",
",",
"policy_data",
")",
":",
"if",
"not",
"policy_data",
":",
"policy_data",
"=",
"b''",
"# we are going to clean off the special pre-fixes, so we get only the valuename",
"specialValueRegex",
"=",
"salt",
".",
"ut... | helper function to take a list of strings for registry.pol file data and
update existing strings or append the strings | [
"helper",
"function",
"to",
"take",
"a",
"list",
"of",
"strings",
"for",
"registry",
".",
"pol",
"file",
"data",
"and",
"update",
"existing",
"strings",
"or",
"append",
"the",
"strings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6722-L6747 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policyFileReplaceOrAppend | def _policyFileReplaceOrAppend(this_string, policy_data, append_only=False):
'''
helper function to take a ADMX policy string for registry.pol file data and
update existing string or append the string to the data
'''
# we are going to clean off the special pre-fixes, so we get only the valuename
... | python | def _policyFileReplaceOrAppend(this_string, policy_data, append_only=False):
'''
helper function to take a ADMX policy string for registry.pol file data and
update existing string or append the string to the data
'''
# we are going to clean off the special pre-fixes, so we get only the valuename
... | [
"def",
"_policyFileReplaceOrAppend",
"(",
"this_string",
",",
"policy_data",
",",
"append_only",
"=",
"False",
")",
":",
"# we are going to clean off the special pre-fixes, so we get only the valuename",
"if",
"not",
"policy_data",
":",
"policy_data",
"=",
"b''",
"specialValu... | helper function to take a ADMX policy string for registry.pol file data and
update existing string or append the string to the data | [
"helper",
"function",
"to",
"take",
"a",
"ADMX",
"policy",
"string",
"for",
"registry",
".",
"pol",
"file",
"data",
"and",
"update",
"existing",
"string",
"or",
"append",
"the",
"string",
"to",
"the",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6750-L6777 | train |
saltstack/salt | salt/modules/win_lgpo.py | _writeAdminTemplateRegPolFile | def _writeAdminTemplateRegPolFile(admtemplate_data,
adml_language='en-US',
registry_class='Machine'):
r'''
helper function to prep/write adm template data to the Registry.pol file
each file begins with REGFILE_SIGNATURE (u'\u5250\u6765') a... | python | def _writeAdminTemplateRegPolFile(admtemplate_data,
adml_language='en-US',
registry_class='Machine'):
r'''
helper function to prep/write adm template data to the Registry.pol file
each file begins with REGFILE_SIGNATURE (u'\u5250\u6765') a... | [
"def",
"_writeAdminTemplateRegPolFile",
"(",
"admtemplate_data",
",",
"adml_language",
"=",
"'en-US'",
",",
"registry_class",
"=",
"'Machine'",
")",
":",
"existing_data",
"=",
"b''",
"policy_data",
"=",
"_policy_info",
"(",
")",
"policySearchXpath",
"=",
"'//ns1:*[@id... | r'''
helper function to prep/write adm template data to the Registry.pol file
each file begins with REGFILE_SIGNATURE (u'\u5250\u6765') and
REGISTRY_FILE_VERSION (u'\x01\00')
https://msdn.microsoft.com/en-us/library/aa374407(VS.85).aspx
+ https://msdn.microsoft.com/en-us/library/cc232696.aspx
... | [
"r",
"helper",
"function",
"to",
"prep",
"/",
"write",
"adm",
"template",
"data",
"to",
"the",
"Registry",
".",
"pol",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6780-L7114 | train |
saltstack/salt | salt/modules/win_lgpo.py | _getScriptSettingsFromIniFile | def _getScriptSettingsFromIniFile(policy_info):
'''
helper function to parse/read a GPO Startup/Shutdown script file
psscript.ini and script.ini file definitions are here
https://msdn.microsoft.com/en-us/library/ff842529.aspx
https://msdn.microsoft.com/en-us/library/dd303238.aspx
'''
... | python | def _getScriptSettingsFromIniFile(policy_info):
'''
helper function to parse/read a GPO Startup/Shutdown script file
psscript.ini and script.ini file definitions are here
https://msdn.microsoft.com/en-us/library/ff842529.aspx
https://msdn.microsoft.com/en-us/library/dd303238.aspx
'''
... | [
"def",
"_getScriptSettingsFromIniFile",
"(",
"policy_info",
")",
":",
"_existingData",
"=",
"None",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"policy_info",
"[",
"'ScriptIni'",
"]",
"[",
"'IniPath'",
"]",
")",
":",
"with",
"salt",
".",
"utils",
".",
"fi... | helper function to parse/read a GPO Startup/Shutdown script file
psscript.ini and script.ini file definitions are here
https://msdn.microsoft.com/en-us/library/ff842529.aspx
https://msdn.microsoft.com/en-us/library/dd303238.aspx | [
"helper",
"function",
"to",
"parse",
"/",
"read",
"a",
"GPO",
"Startup",
"/",
"Shutdown",
"script",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7117-L7148 | train |
saltstack/salt | salt/modules/win_lgpo.py | _writeGpoScript | def _writeGpoScript(psscript=False):
'''
helper function to write local GPO startup/shutdown script
scripts are stored in scripts.ini and psscripts.ini files in
``WINDIR\\System32\\GroupPolicy\\Machine|User\\Scripts``
these files have the hidden attribute set
files have following format:
... | python | def _writeGpoScript(psscript=False):
'''
helper function to write local GPO startup/shutdown script
scripts are stored in scripts.ini and psscripts.ini files in
``WINDIR\\System32\\GroupPolicy\\Machine|User\\Scripts``
these files have the hidden attribute set
files have following format:
... | [
"def",
"_writeGpoScript",
"(",
"psscript",
"=",
"False",
")",
":",
"_machineScriptPolicyPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getenv",
"(",
"'WINDIR'",
")",
",",
"'System32'",
",",
"'GroupPolicy'",
",",
"'Machine'",
",",
"'Scripts'",
... | helper function to write local GPO startup/shutdown script
scripts are stored in scripts.ini and psscripts.ini files in
``WINDIR\\System32\\GroupPolicy\\Machine|User\\Scripts``
these files have the hidden attribute set
files have following format:
empty line
[Startup]
0CmdLine... | [
"helper",
"function",
"to",
"write",
"local",
"GPO",
"startup",
"/",
"shutdown",
"script"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7151-L7203 | train |
saltstack/salt | salt/modules/win_lgpo.py | _lookup_admin_template | def _lookup_admin_template(policy_name,
policy_class,
adml_language='en-US'):
'''
(success_flag, policy_xml_item, policy_name_list, message)
'''
policy_aliases = []
admx_policy_definitions = _get_policy_definitions(language=adml_language)
adm... | python | def _lookup_admin_template(policy_name,
policy_class,
adml_language='en-US'):
'''
(success_flag, policy_xml_item, policy_name_list, message)
'''
policy_aliases = []
admx_policy_definitions = _get_policy_definitions(language=adml_language)
adm... | [
"def",
"_lookup_admin_template",
"(",
"policy_name",
",",
"policy_class",
",",
"adml_language",
"=",
"'en-US'",
")",
":",
"policy_aliases",
"=",
"[",
"]",
"admx_policy_definitions",
"=",
"_get_policy_definitions",
"(",
"language",
"=",
"adml_language",
")",
"adml_poli... | (success_flag, policy_xml_item, policy_name_list, message) | [
"(",
"success_flag",
"policy_xml_item",
"policy_name_list",
"message",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7206-L7393 | train |
saltstack/salt | salt/modules/win_lgpo.py | get_policy_info | def get_policy_info(policy_name,
policy_class,
adml_language='en-US'):
r'''
Returns information about a specified policy
Args:
policy_name (str):
The name of the policy to lookup
policy_class (str):
The class of policy, i.e. ma... | python | def get_policy_info(policy_name,
policy_class,
adml_language='en-US'):
r'''
Returns information about a specified policy
Args:
policy_name (str):
The name of the policy to lookup
policy_class (str):
The class of policy, i.e. ma... | [
"def",
"get_policy_info",
"(",
"policy_name",
",",
"policy_class",
",",
"adml_language",
"=",
"'en-US'",
")",
":",
"# return the possible policy names and element names",
"ret",
"=",
"{",
"'policy_name'",
":",
"policy_name",
",",
"'policy_class'",
":",
"policy_class",
"... | r'''
Returns information about a specified policy
Args:
policy_name (str):
The name of the policy to lookup
policy_class (str):
The class of policy, i.e. machine, user, both
adml_language (str):
The ADML language to use for Administrative Template dat... | [
"r",
"Returns",
"information",
"about",
"a",
"specified",
"policy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7396-L7592 | train |
saltstack/salt | salt/modules/win_lgpo.py | get | def get(policy_class=None, return_full_policy_names=True,
hierarchical_return=False, adml_language='en-US',
return_not_configured=False):
'''
Get a policy value
Args:
policy_class (str):
Some policies are both user and computer, by default all policies
will ... | python | def get(policy_class=None, return_full_policy_names=True,
hierarchical_return=False, adml_language='en-US',
return_not_configured=False):
'''
Get a policy value
Args:
policy_class (str):
Some policies are both user and computer, by default all policies
will ... | [
"def",
"get",
"(",
"policy_class",
"=",
"None",
",",
"return_full_policy_names",
"=",
"True",
",",
"hierarchical_return",
"=",
"False",
",",
"adml_language",
"=",
"'en-US'",
",",
"return_not_configured",
"=",
"False",
")",
":",
"vals",
"=",
"{",
"}",
"modal_re... | Get a policy value
Args:
policy_class (str):
Some policies are both user and computer, by default all policies
will be pulled, but this can be used to retrieve only a specific
policy class User/USER/user = retrieve user policies
Machine/MACHINE/machine/Compu... | [
"Get",
"a",
"policy",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7595-L7740 | train |
saltstack/salt | salt/modules/win_lgpo.py | set_computer_policy | def set_computer_policy(name,
setting,
cumulative_rights_assignments=True,
adml_language='en-US'):
'''
Set a single computer policy
Args:
name (str):
The name of the policy to configure
setting (str):
... | python | def set_computer_policy(name,
setting,
cumulative_rights_assignments=True,
adml_language='en-US'):
'''
Set a single computer policy
Args:
name (str):
The name of the policy to configure
setting (str):
... | [
"def",
"set_computer_policy",
"(",
"name",
",",
"setting",
",",
"cumulative_rights_assignments",
"=",
"True",
",",
"adml_language",
"=",
"'en-US'",
")",
":",
"pol",
"=",
"{",
"}",
"pol",
"[",
"name",
"]",
"=",
"setting",
"ret",
"=",
"set_",
"(",
"computer_... | Set a single computer policy
Args:
name (str):
The name of the policy to configure
setting (str):
The setting to configure the named policy with
cumulative_rights_assignments (bool): Determine how user rights
assignment policies are configured. If True,... | [
"Set",
"a",
"single",
"computer",
"policy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7743-L7782 | train |
saltstack/salt | salt/modules/win_lgpo.py | set_ | def set_(computer_policy=None,
user_policy=None,
cumulative_rights_assignments=True,
adml_language='en-US'):
'''
Set a local server policy.
Args:
computer_policy (dict):
A dictionary of "policyname: value" pairs of computer policies to
set. 'value... | python | def set_(computer_policy=None,
user_policy=None,
cumulative_rights_assignments=True,
adml_language='en-US'):
'''
Set a local server policy.
Args:
computer_policy (dict):
A dictionary of "policyname: value" pairs of computer policies to
set. 'value... | [
"def",
"set_",
"(",
"computer_policy",
"=",
"None",
",",
"user_policy",
"=",
"None",
",",
"cumulative_rights_assignments",
"=",
"True",
",",
"adml_language",
"=",
"'en-US'",
")",
":",
"if",
"computer_policy",
"and",
"not",
"isinstance",
"(",
"computer_policy",
"... | Set a local server policy.
Args:
computer_policy (dict):
A dictionary of "policyname: value" pairs of computer policies to
set. 'value' should be how it is displayed in the gpedit GUI, i.e.
if a setting can be 'Enabled'/'Disabled', then that should be passed
... | [
"Set",
"a",
"local",
"server",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7822-L8202 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._seconds_to_days | def _seconds_to_days(cls, val, **kwargs):
'''
converts a number of seconds to days
'''
zero_value = kwargs.get('zero_value', 0)
if val is not None:
if val == zero_value:
return 0
return val / 86400
else:
return 'Not Defi... | python | def _seconds_to_days(cls, val, **kwargs):
'''
converts a number of seconds to days
'''
zero_value = kwargs.get('zero_value', 0)
if val is not None:
if val == zero_value:
return 0
return val / 86400
else:
return 'Not Defi... | [
"def",
"_seconds_to_days",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"zero_value",
"=",
"kwargs",
".",
"get",
"(",
"'zero_value'",
",",
"0",
")",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
"==",
"zero_value",
":",
"return",
... | converts a number of seconds to days | [
"converts",
"a",
"number",
"of",
"seconds",
"to",
"days"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4369-L4379 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._days_to_seconds | def _days_to_seconds(cls, val, **kwargs):
'''
converts a number of days to seconds
'''
zero_value = kwargs.get('zero_value', 0)
if val is not None:
if val == 0:
return zero_value
return val * 86400
else:
return 'Not Defi... | python | def _days_to_seconds(cls, val, **kwargs):
'''
converts a number of days to seconds
'''
zero_value = kwargs.get('zero_value', 0)
if val is not None:
if val == 0:
return zero_value
return val * 86400
else:
return 'Not Defi... | [
"def",
"_days_to_seconds",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"zero_value",
"=",
"kwargs",
".",
"get",
"(",
"'zero_value'",
",",
"0",
")",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
"==",
"0",
":",
"return",
"zero_v... | converts a number of days to seconds | [
"converts",
"a",
"number",
"of",
"days",
"to",
"seconds"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4382-L4392 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._binary_enable_zero_disable_one_conversion | def _binary_enable_zero_disable_one_conversion(cls, val, **kwargs):
'''
converts a binary 0/1 to Disabled/Enabled
'''
try:
if val is not None:
if ord(val) == 0:
return 'Disabled'
elif ord(val) == 1:
retur... | python | def _binary_enable_zero_disable_one_conversion(cls, val, **kwargs):
'''
converts a binary 0/1 to Disabled/Enabled
'''
try:
if val is not None:
if ord(val) == 0:
return 'Disabled'
elif ord(val) == 1:
retur... | [
"def",
"_binary_enable_zero_disable_one_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"ord",
"(",
"val",
")",
"==",
"0",
":",
"return",
"'Disabled'",
"elif",
"ord",
"(",... | converts a binary 0/1 to Disabled/Enabled | [
"converts",
"a",
"binary",
"0",
"/",
"1",
"to",
"Disabled",
"/",
"Enabled"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4429-L4444 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._binary_enable_zero_disable_one_reverse_conversion | def _binary_enable_zero_disable_one_reverse_conversion(cls, val, **kwargs):
'''
converts Enabled/Disabled to unicode char to write to a REG_BINARY value
'''
if val is not None:
if val.upper() == 'DISABLED':
return chr(0)
elif val.upper() == 'ENABLE... | python | def _binary_enable_zero_disable_one_reverse_conversion(cls, val, **kwargs):
'''
converts Enabled/Disabled to unicode char to write to a REG_BINARY value
'''
if val is not None:
if val.upper() == 'DISABLED':
return chr(0)
elif val.upper() == 'ENABLE... | [
"def",
"_binary_enable_zero_disable_one_reverse_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
".",
"upper",
"(",
")",
"==",
"'DISABLED'",
":",
"return",
"chr",
"(",
"0",
")",
... | converts Enabled/Disabled to unicode char to write to a REG_BINARY value | [
"converts",
"Enabled",
"/",
"Disabled",
"to",
"unicode",
"char",
"to",
"write",
"to",
"a",
"REG_BINARY",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4447-L4459 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._dasd_conversion | def _dasd_conversion(cls, val, **kwargs):
'''
converts 0/1/2 for dasd reg key
'''
if val is not None:
if val == '0' or val == 0 or val == '':
return 'Administrators'
elif val == '1' or val == 1:
return 'Administrators and Power User... | python | def _dasd_conversion(cls, val, **kwargs):
'''
converts 0/1/2 for dasd reg key
'''
if val is not None:
if val == '0' or val == 0 or val == '':
return 'Administrators'
elif val == '1' or val == 1:
return 'Administrators and Power User... | [
"def",
"_dasd_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
"==",
"'0'",
"or",
"val",
"==",
"0",
"or",
"val",
"==",
"''",
":",
"return",
"'Administrators'",
"elif",
"val"... | converts 0/1/2 for dasd reg key | [
"converts",
"0",
"/",
"1",
"/",
"2",
"for",
"dasd",
"reg",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4462-L4476 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._dasd_reverse_conversion | def _dasd_reverse_conversion(cls, val, **kwargs):
'''
converts DASD String values to the reg_sz value
'''
if val is not None:
if val.upper() == 'ADMINISTRATORS':
# "" also shows 'administrators' in the GUI
return '0'
elif val.upper(... | python | def _dasd_reverse_conversion(cls, val, **kwargs):
'''
converts DASD String values to the reg_sz value
'''
if val is not None:
if val.upper() == 'ADMINISTRATORS':
# "" also shows 'administrators' in the GUI
return '0'
elif val.upper(... | [
"def",
"_dasd_reverse_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
".",
"upper",
"(",
")",
"==",
"'ADMINISTRATORS'",
":",
"# \"\" also shows 'administrators' in the GUI",
"return",
... | converts DASD String values to the reg_sz value | [
"converts",
"DASD",
"String",
"values",
"to",
"the",
"reg_sz",
"value"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4479-L4498 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._in_range_inclusive | def _in_range_inclusive(cls, val, **kwargs):
'''
checks that a value is in an inclusive range
The value for 0 used by Max Password Age is actually 0xffffffff
'''
minimum = kwargs.get('min', 0)
maximum = kwargs.get('max', 1)
zero_value = kwargs.get('zero_value', 0)... | python | def _in_range_inclusive(cls, val, **kwargs):
'''
checks that a value is in an inclusive range
The value for 0 used by Max Password Age is actually 0xffffffff
'''
minimum = kwargs.get('min', 0)
maximum = kwargs.get('max', 1)
zero_value = kwargs.get('zero_value', 0)... | [
"def",
"_in_range_inclusive",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"minimum",
"=",
"kwargs",
".",
"get",
"(",
"'min'",
",",
"0",
")",
"maximum",
"=",
"kwargs",
".",
"get",
"(",
"'max'",
",",
"1",
")",
"zero_value",
"=",
"kwarg... | checks that a value is in an inclusive range
The value for 0 used by Max Password Age is actually 0xffffffff | [
"checks",
"that",
"a",
"value",
"is",
"in",
"an",
"inclusive",
"range",
"The",
"value",
"for",
"0",
"used",
"by",
"Max",
"Password",
"Age",
"is",
"actually",
"0xffffffff"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4501-L4524 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._driver_signing_reg_conversion | def _driver_signing_reg_conversion(cls, val, **kwargs):
'''
converts the binary value in the registry for driver signing into the
correct string representation
'''
log.debug('we have %s for the driver signing value', val)
if val is not None:
# since this is fr... | python | def _driver_signing_reg_conversion(cls, val, **kwargs):
'''
converts the binary value in the registry for driver signing into the
correct string representation
'''
log.debug('we have %s for the driver signing value', val)
if val is not None:
# since this is fr... | [
"def",
"_driver_signing_reg_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'we have %s for the driver signing value'",
",",
"val",
")",
"if",
"val",
"is",
"not",
"None",
":",
"# since this is from secedit, it sho... | converts the binary value in the registry for driver signing into the
correct string representation | [
"converts",
"the",
"binary",
"value",
"in",
"the",
"registry",
"for",
"driver",
"signing",
"into",
"the",
"correct",
"string",
"representation"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4527-L4550 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._driver_signing_reg_reverse_conversion | def _driver_signing_reg_reverse_conversion(cls, val, **kwargs):
'''
converts the string value seen in the GUI to the correct registry value
for secedit
'''
if val is not None:
if val.upper() == 'SILENTLY SUCCEED':
return ','.join(['3', '0'])
... | python | def _driver_signing_reg_reverse_conversion(cls, val, **kwargs):
'''
converts the string value seen in the GUI to the correct registry value
for secedit
'''
if val is not None:
if val.upper() == 'SILENTLY SUCCEED':
return ','.join(['3', '0'])
... | [
"def",
"_driver_signing_reg_reverse_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"val",
".",
"upper",
"(",
")",
"==",
"'SILENTLY SUCCEED'",
":",
"return",
"','",
".",
"join",
"(",
... | converts the string value seen in the GUI to the correct registry value
for secedit | [
"converts",
"the",
"string",
"value",
"seen",
"in",
"the",
"GUI",
"to",
"the",
"correct",
"registry",
"value",
"for",
"secedit"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4553-L4568 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._sidConversion | def _sidConversion(cls, val, **kwargs):
'''
converts a list of pysid objects to string representations
'''
if isinstance(val, six.string_types):
val = val.split(',')
usernames = []
for _sid in val:
try:
userSid = win32security.Looku... | python | def _sidConversion(cls, val, **kwargs):
'''
converts a list of pysid objects to string representations
'''
if isinstance(val, six.string_types):
val = val.split(',')
usernames = []
for _sid in val:
try:
userSid = win32security.Looku... | [
"def",
"_sidConversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"six",
".",
"string_types",
")",
":",
"val",
"=",
"val",
".",
"split",
"(",
"','",
")",
"usernames",
"=",
"[",
"]",
"for",
"_... | converts a list of pysid objects to string representations | [
"converts",
"a",
"list",
"of",
"pysid",
"objects",
"to",
"string",
"representations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4571-L4590 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._usernamesToSidObjects | def _usernamesToSidObjects(cls, val, **kwargs):
'''
converts a list of usernames to sid objects
'''
if not val:
return val
if isinstance(val, six.string_types):
val = val.split(',')
sids = []
for _user in val:
try:
... | python | def _usernamesToSidObjects(cls, val, **kwargs):
'''
converts a list of usernames to sid objects
'''
if not val:
return val
if isinstance(val, six.string_types):
val = val.split(',')
sids = []
for _user in val:
try:
... | [
"def",
"_usernamesToSidObjects",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"val",
":",
"return",
"val",
"if",
"isinstance",
"(",
"val",
",",
"six",
".",
"string_types",
")",
":",
"val",
"=",
"val",
".",
"split",
"(",
"... | converts a list of usernames to sid objects | [
"converts",
"a",
"list",
"of",
"usernames",
"to",
"sid",
"objects"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4593-L4613 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._powershell_script_order_conversion | def _powershell_script_order_conversion(cls, val, **kwargs):
'''
converts true/false/None to the GUI representation of the powershell
startup/shutdown script order
'''
log.debug('script order value = %s', val)
if val is None or val == 'None':
return 'Not Confi... | python | def _powershell_script_order_conversion(cls, val, **kwargs):
'''
converts true/false/None to the GUI representation of the powershell
startup/shutdown script order
'''
log.debug('script order value = %s', val)
if val is None or val == 'None':
return 'Not Confi... | [
"def",
"_powershell_script_order_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'script order value = %s'",
",",
"val",
")",
"if",
"val",
"is",
"None",
"or",
"val",
"==",
"'None'",
":",
"return",
"'Not Co... | converts true/false/None to the GUI representation of the powershell
startup/shutdown script order | [
"converts",
"true",
"/",
"false",
"/",
"None",
"to",
"the",
"GUI",
"representation",
"of",
"the",
"powershell",
"startup",
"/",
"shutdown",
"script",
"order"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4616-L4629 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._powershell_script_order_reverse_conversion | def _powershell_script_order_reverse_conversion(cls, val, **kwargs):
'''
converts powershell script GUI strings representations to
True/False/None
'''
if val.upper() == 'Run Windows PowerShell scripts first'.upper():
return 'true'
elif val.upper() == 'Run Wind... | python | def _powershell_script_order_reverse_conversion(cls, val, **kwargs):
'''
converts powershell script GUI strings representations to
True/False/None
'''
if val.upper() == 'Run Windows PowerShell scripts first'.upper():
return 'true'
elif val.upper() == 'Run Wind... | [
"def",
"_powershell_script_order_reverse_conversion",
"(",
"cls",
",",
"val",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"val",
".",
"upper",
"(",
")",
"==",
"'Run Windows PowerShell scripts first'",
".",
"upper",
"(",
")",
":",
"return",
"'true'",
"elif",
"val"... | converts powershell script GUI strings representations to
True/False/None | [
"converts",
"powershell",
"script",
"GUI",
"strings",
"representations",
"to",
"True",
"/",
"False",
"/",
"None"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4632-L4644 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._dict_lookup | def _dict_lookup(cls, item, **kwargs):
'''
Retrieves the key or value from a dict based on the item
kwarg lookup dict to search for item
kwarg value_lookup bool to determine if item should be compared to keys
or values
'''
log.debug('item == %s', item)
val... | python | def _dict_lookup(cls, item, **kwargs):
'''
Retrieves the key or value from a dict based on the item
kwarg lookup dict to search for item
kwarg value_lookup bool to determine if item should be compared to keys
or values
'''
log.debug('item == %s', item)
val... | [
"def",
"_dict_lookup",
"(",
"cls",
",",
"item",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'item == %s'",
",",
"item",
")",
"value_lookup",
"=",
"kwargs",
".",
"get",
"(",
"'value_lookup'",
",",
"False",
")",
"if",
"'lookup'",
"in",
... | Retrieves the key or value from a dict based on the item
kwarg lookup dict to search for item
kwarg value_lookup bool to determine if item should be compared to keys
or values | [
"Retrieves",
"the",
"key",
"or",
"value",
"from",
"a",
"dict",
"based",
"on",
"the",
"item",
"kwarg",
"lookup",
"dict",
"to",
"search",
"for",
"item",
"kwarg",
"value_lookup",
"bool",
"to",
"determine",
"if",
"item",
"should",
"be",
"compared",
"to",
"keys... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4647-L4666 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._dict_lookup_bitwise_add | def _dict_lookup_bitwise_add(cls, item, **kwargs):
'''
kwarg value_lookup bool to determine if item_list should be compared to keys
or values
kwarg test_zero is used to determine if 0 should be tested when value_lookup is false
lookup should be a dict with integers for keys
... | python | def _dict_lookup_bitwise_add(cls, item, **kwargs):
'''
kwarg value_lookup bool to determine if item_list should be compared to keys
or values
kwarg test_zero is used to determine if 0 should be tested when value_lookup is false
lookup should be a dict with integers for keys
... | [
"def",
"_dict_lookup_bitwise_add",
"(",
"cls",
",",
"item",
",",
"*",
"*",
"kwargs",
")",
":",
"value_lookup",
"=",
"kwargs",
".",
"get",
"(",
"'value_lookup'",
",",
"False",
")",
"test_zero",
"=",
"kwargs",
".",
"get",
"(",
"'test_zero'",
",",
"False",
... | kwarg value_lookup bool to determine if item_list should be compared to keys
or values
kwarg test_zero is used to determine if 0 should be tested when value_lookup is false
lookup should be a dict with integers for keys
if value_lookup is True, item is expected to be a list
... | [
"kwarg",
"value_lookup",
"bool",
"to",
"determine",
"if",
"item_list",
"should",
"be",
"compared",
"to",
"keys",
"or",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4669-L4710 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._multi_string_put_transform | def _multi_string_put_transform(cls, item, **kwargs):
'''
transform for a REG_MULTI_SZ to properly handle "Not Defined"
'''
if isinstance(item, list):
return item
elif isinstance(item, six.string_types):
if item.lower() == 'not defined':
re... | python | def _multi_string_put_transform(cls, item, **kwargs):
'''
transform for a REG_MULTI_SZ to properly handle "Not Defined"
'''
if isinstance(item, list):
return item
elif isinstance(item, six.string_types):
if item.lower() == 'not defined':
re... | [
"def",
"_multi_string_put_transform",
"(",
"cls",
",",
"item",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"list",
")",
":",
"return",
"item",
"elif",
"isinstance",
"(",
"item",
",",
"six",
".",
"string_types",
")",
":",
"i... | transform for a REG_MULTI_SZ to properly handle "Not Defined" | [
"transform",
"for",
"a",
"REG_MULTI_SZ",
"to",
"properly",
"handle",
"Not",
"Defined"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4713-L4725 | train |
saltstack/salt | salt/modules/win_lgpo.py | _policy_info._string_put_transform | def _string_put_transform(cls, item, **kwargs):
'''
transfrom for a REG_SZ to properly handle "Not Defined"
'''
if isinstance(item, six.string_types):
if item.lower() == 'not defined':
return None
else:
return item | python | def _string_put_transform(cls, item, **kwargs):
'''
transfrom for a REG_SZ to properly handle "Not Defined"
'''
if isinstance(item, six.string_types):
if item.lower() == 'not defined':
return None
else:
return item | [
"def",
"_string_put_transform",
"(",
"cls",
",",
"item",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"six",
".",
"string_types",
")",
":",
"if",
"item",
".",
"lower",
"(",
")",
"==",
"'not defined'",
":",
"return",
"None",
... | transfrom for a REG_SZ to properly handle "Not Defined" | [
"transfrom",
"for",
"a",
"REG_SZ",
"to",
"properly",
"handle",
"Not",
"Defined"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4728-L4736 | train |
saltstack/salt | salt/modules/snapper.py | _snapshot_to_data | def _snapshot_to_data(snapshot):
'''
Returns snapshot data from a D-Bus response.
A snapshot D-Bus response is a dbus.Struct containing the
information related to a snapshot:
[id, type, pre_snapshot, timestamp, user, description,
cleanup_algorithm, userdata]
id: dbus.UInt32
type: dbu... | python | def _snapshot_to_data(snapshot):
'''
Returns snapshot data from a D-Bus response.
A snapshot D-Bus response is a dbus.Struct containing the
information related to a snapshot:
[id, type, pre_snapshot, timestamp, user, description,
cleanup_algorithm, userdata]
id: dbus.UInt32
type: dbu... | [
"def",
"_snapshot_to_data",
"(",
"snapshot",
")",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"'id'",
"]",
"=",
"snapshot",
"[",
"0",
"]",
"data",
"[",
"'type'",
"]",
"=",
"[",
"'single'",
",",
"'pre'",
",",
"'post'",
"]",
"[",
"snapshot",
"[",
"1",
... | Returns snapshot data from a D-Bus response.
A snapshot D-Bus response is a dbus.Struct containing the
information related to a snapshot:
[id, type, pre_snapshot, timestamp, user, description,
cleanup_algorithm, userdata]
id: dbus.UInt32
type: dbus.UInt16
pre_snapshot: dbus.UInt32
ti... | [
"Returns",
"snapshot",
"data",
"from",
"a",
"D",
"-",
"Bus",
"response",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L99-L138 | train |
saltstack/salt | salt/modules/snapper.py | _dbus_exception_to_reason | def _dbus_exception_to_reason(exc, args):
'''
Returns a error message from a snapper DBusException
'''
error = exc.get_dbus_name()
if error == 'error.unknown_config':
return "Unknown configuration '{0}'".format(args['config'])
elif error == 'error.illegal_snapshot':
return 'Inval... | python | def _dbus_exception_to_reason(exc, args):
'''
Returns a error message from a snapper DBusException
'''
error = exc.get_dbus_name()
if error == 'error.unknown_config':
return "Unknown configuration '{0}'".format(args['config'])
elif error == 'error.illegal_snapshot':
return 'Inval... | [
"def",
"_dbus_exception_to_reason",
"(",
"exc",
",",
"args",
")",
":",
"error",
"=",
"exc",
".",
"get_dbus_name",
"(",
")",
"if",
"error",
"==",
"'error.unknown_config'",
":",
"return",
"\"Unknown configuration '{0}'\"",
".",
"format",
"(",
"args",
"[",
"'config... | Returns a error message from a snapper DBusException | [
"Returns",
"a",
"error",
"message",
"from",
"a",
"snapper",
"DBusException"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L141-L151 | train |
saltstack/salt | salt/modules/snapper.py | list_snapshots | def list_snapshots(config='root'):
'''
List available snapshots
CLI example:
.. code-block:: bash
salt '*' snapper.list_snapshots config=myconfig
'''
try:
snapshots = snapper.ListSnapshots(config)
return [_snapshot_to_data(s) for s in snapshots]
except dbus.DBusExc... | python | def list_snapshots(config='root'):
'''
List available snapshots
CLI example:
.. code-block:: bash
salt '*' snapper.list_snapshots config=myconfig
'''
try:
snapshots = snapper.ListSnapshots(config)
return [_snapshot_to_data(s) for s in snapshots]
except dbus.DBusExc... | [
"def",
"list_snapshots",
"(",
"config",
"=",
"'root'",
")",
":",
"try",
":",
"snapshots",
"=",
"snapper",
".",
"ListSnapshots",
"(",
"config",
")",
"return",
"[",
"_snapshot_to_data",
"(",
"s",
")",
"for",
"s",
"in",
"snapshots",
"]",
"except",
"dbus",
"... | List available snapshots
CLI example:
.. code-block:: bash
salt '*' snapper.list_snapshots config=myconfig | [
"List",
"available",
"snapshots"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L154-L171 | train |
saltstack/salt | salt/modules/snapper.py | get_snapshot | def get_snapshot(number=0, config='root'):
'''
Get detailed information about a given snapshot
CLI example:
.. code-block:: bash
salt '*' snapper.get_snapshot 1
'''
try:
snapshot = snapper.GetSnapshot(config, int(number))
return _snapshot_to_data(snapshot)
except d... | python | def get_snapshot(number=0, config='root'):
'''
Get detailed information about a given snapshot
CLI example:
.. code-block:: bash
salt '*' snapper.get_snapshot 1
'''
try:
snapshot = snapper.GetSnapshot(config, int(number))
return _snapshot_to_data(snapshot)
except d... | [
"def",
"get_snapshot",
"(",
"number",
"=",
"0",
",",
"config",
"=",
"'root'",
")",
":",
"try",
":",
"snapshot",
"=",
"snapper",
".",
"GetSnapshot",
"(",
"config",
",",
"int",
"(",
"number",
")",
")",
"return",
"_snapshot_to_data",
"(",
"snapshot",
")",
... | Get detailed information about a given snapshot
CLI example:
.. code-block:: bash
salt '*' snapper.get_snapshot 1 | [
"Get",
"detailed",
"information",
"about",
"a",
"given",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L174-L191 | train |
saltstack/salt | salt/modules/snapper.py | list_configs | def list_configs():
'''
List all available configs
CLI example:
.. code-block:: bash
salt '*' snapper.list_configs
'''
try:
configs = snapper.ListConfigs()
return dict((config[0], config[2]) for config in configs)
except dbus.DBusException as exc:
raise Com... | python | def list_configs():
'''
List all available configs
CLI example:
.. code-block:: bash
salt '*' snapper.list_configs
'''
try:
configs = snapper.ListConfigs()
return dict((config[0], config[2]) for config in configs)
except dbus.DBusException as exc:
raise Com... | [
"def",
"list_configs",
"(",
")",
":",
"try",
":",
"configs",
"=",
"snapper",
".",
"ListConfigs",
"(",
")",
"return",
"dict",
"(",
"(",
"config",
"[",
"0",
"]",
",",
"config",
"[",
"2",
"]",
")",
"for",
"config",
"in",
"configs",
")",
"except",
"dbu... | List all available configs
CLI example:
.. code-block:: bash
salt '*' snapper.list_configs | [
"List",
"all",
"available",
"configs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L194-L211 | train |
saltstack/salt | salt/modules/snapper.py | set_config | def set_config(name='root', **kwargs):
'''
Set configuration values
CLI example:
.. code-block:: bash
salt '*' snapper.set_config SYNC_ACL=True
Keys are case insensitive as they will be always uppercased to snapper
convention. The above example is equivalent to:
.. code-block:: ... | python | def set_config(name='root', **kwargs):
'''
Set configuration values
CLI example:
.. code-block:: bash
salt '*' snapper.set_config SYNC_ACL=True
Keys are case insensitive as they will be always uppercased to snapper
convention. The above example is equivalent to:
.. code-block:: ... | [
"def",
"set_config",
"(",
"name",
"=",
"'root'",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"data",
"=",
"dict",
"(",
"(",
"k",
".",
"upper",
"(",
")",
",",
"_config_filter",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
... | Set configuration values
CLI example:
.. code-block:: bash
salt '*' snapper.set_config SYNC_ACL=True
Keys are case insensitive as they will be always uppercased to snapper
convention. The above example is equivalent to:
.. code-block:: bash
salt '*' snapper.set_config sync_acl=... | [
"Set",
"configuration",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L220-L246 | train |
saltstack/salt | salt/modules/snapper.py | _get_last_snapshot | def _get_last_snapshot(config='root'):
'''
Returns the last existing created snapshot
'''
snapshot_list = sorted(list_snapshots(config), key=lambda x: x['id'])
return snapshot_list[-1] | python | def _get_last_snapshot(config='root'):
'''
Returns the last existing created snapshot
'''
snapshot_list = sorted(list_snapshots(config), key=lambda x: x['id'])
return snapshot_list[-1] | [
"def",
"_get_last_snapshot",
"(",
"config",
"=",
"'root'",
")",
":",
"snapshot_list",
"=",
"sorted",
"(",
"list_snapshots",
"(",
"config",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"'id'",
"]",
")",
"return",
"snapshot_list",
"[",
"-",
"1",
"... | Returns the last existing created snapshot | [
"Returns",
"the",
"last",
"existing",
"created",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L249-L254 | train |
saltstack/salt | salt/modules/snapper.py | status_to_string | def status_to_string(dbus_status):
'''
Converts a numeric dbus snapper status into a string
CLI Example:
.. code-block:: bash
salt '*' snapper.status_to_string <dbus_status>
'''
status_tuple = (
dbus_status & 0b000000001, dbus_status & 0b000000010, dbus_status & 0b000000100,
... | python | def status_to_string(dbus_status):
'''
Converts a numeric dbus snapper status into a string
CLI Example:
.. code-block:: bash
salt '*' snapper.status_to_string <dbus_status>
'''
status_tuple = (
dbus_status & 0b000000001, dbus_status & 0b000000010, dbus_status & 0b000000100,
... | [
"def",
"status_to_string",
"(",
"dbus_status",
")",
":",
"status_tuple",
"=",
"(",
"dbus_status",
"&",
"0b000000001",
",",
"dbus_status",
"&",
"0b000000010",
",",
"dbus_status",
"&",
"0b000000100",
",",
"dbus_status",
"&",
"0b000001000",
",",
"dbus_status",
"&",
... | Converts a numeric dbus snapper status into a string
CLI Example:
.. code-block:: bash
salt '*' snapper.status_to_string <dbus_status> | [
"Converts",
"a",
"numeric",
"dbus",
"snapper",
"status",
"into",
"a",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L257-L273 | train |
saltstack/salt | salt/modules/snapper.py | get_config | def get_config(name='root'):
'''
Retrieves all values from a given configuration
CLI example:
.. code-block:: bash
salt '*' snapper.get_config
'''
try:
config = snapper.GetConfig(name)
return config
except dbus.DBusException as exc:
raise CommandExecutionErro... | python | def get_config(name='root'):
'''
Retrieves all values from a given configuration
CLI example:
.. code-block:: bash
salt '*' snapper.get_config
'''
try:
config = snapper.GetConfig(name)
return config
except dbus.DBusException as exc:
raise CommandExecutionErro... | [
"def",
"get_config",
"(",
"name",
"=",
"'root'",
")",
":",
"try",
":",
"config",
"=",
"snapper",
".",
"GetConfig",
"(",
"name",
")",
"return",
"config",
"except",
"dbus",
".",
"DBusException",
"as",
"exc",
":",
"raise",
"CommandExecutionError",
"(",
"'Erro... | Retrieves all values from a given configuration
CLI example:
.. code-block:: bash
salt '*' snapper.get_config | [
"Retrieves",
"all",
"values",
"from",
"a",
"given",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L276-L293 | train |
saltstack/salt | salt/modules/snapper.py | create_config | def create_config(name=None,
subvolume=None,
fstype=None,
template=None,
extra_opts=None):
'''
Creates a new Snapper configuration
name
Name of the new Snapper configuration.
subvolume
Path to the related subvolume.... | python | def create_config(name=None,
subvolume=None,
fstype=None,
template=None,
extra_opts=None):
'''
Creates a new Snapper configuration
name
Name of the new Snapper configuration.
subvolume
Path to the related subvolume.... | [
"def",
"create_config",
"(",
"name",
"=",
"None",
",",
"subvolume",
"=",
"None",
",",
"fstype",
"=",
"None",
",",
"template",
"=",
"None",
",",
"extra_opts",
"=",
"None",
")",
":",
"def",
"raise_arg_error",
"(",
"argname",
")",
":",
"raise",
"CommandExec... | Creates a new Snapper configuration
name
Name of the new Snapper configuration.
subvolume
Path to the related subvolume.
fstype
Filesystem type of the subvolume.
template
Configuration template to use. (Default: default)
extra_opts
Extra Snapper configuration... | [
"Creates",
"a",
"new",
"Snapper",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L296-L347 | train |
saltstack/salt | salt/modules/snapper.py | create_snapshot | def create_snapshot(config='root', snapshot_type='single', pre_number=None,
description=None, cleanup_algorithm='number', userdata=None,
**kwargs):
'''
Creates an snapshot
config
Configuration name.
snapshot_type
Specifies the type of the new snap... | python | def create_snapshot(config='root', snapshot_type='single', pre_number=None,
description=None, cleanup_algorithm='number', userdata=None,
**kwargs):
'''
Creates an snapshot
config
Configuration name.
snapshot_type
Specifies the type of the new snap... | [
"def",
"create_snapshot",
"(",
"config",
"=",
"'root'",
",",
"snapshot_type",
"=",
"'single'",
",",
"pre_number",
"=",
"None",
",",
"description",
"=",
"None",
",",
"cleanup_algorithm",
"=",
"'number'",
",",
"userdata",
"=",
"None",
",",
"*",
"*",
"kwargs",
... | Creates an snapshot
config
Configuration name.
snapshot_type
Specifies the type of the new snapshot. Possible values are
single, pre and post.
pre_number
For post snapshots the number of the pre snapshot must be
provided.
description
Description for the s... | [
"Creates",
"an",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L350-L421 | train |
saltstack/salt | salt/modules/snapper.py | delete_snapshot | def delete_snapshot(snapshots_ids=None, config="root"):
'''
Deletes an snapshot
config
Configuration name. (Default: root)
snapshots_ids
List of the snapshots IDs to be deleted.
CLI example:
.. code-block:: bash
salt '*' snapper.delete_snapshot 54
salt '*' sn... | python | def delete_snapshot(snapshots_ids=None, config="root"):
'''
Deletes an snapshot
config
Configuration name. (Default: root)
snapshots_ids
List of the snapshots IDs to be deleted.
CLI example:
.. code-block:: bash
salt '*' snapper.delete_snapshot 54
salt '*' sn... | [
"def",
"delete_snapshot",
"(",
"snapshots_ids",
"=",
"None",
",",
"config",
"=",
"\"root\"",
")",
":",
"if",
"not",
"snapshots_ids",
":",
"raise",
"CommandExecutionError",
"(",
"'Error: No snapshot ID has been provided'",
")",
"try",
":",
"current_snapshots_ids",
"=",... | Deletes an snapshot
config
Configuration name. (Default: root)
snapshots_ids
List of the snapshots IDs to be deleted.
CLI example:
.. code-block:: bash
salt '*' snapper.delete_snapshot 54
salt '*' snapper.delete_snapshot config=root 54
salt '*' snapper.delete... | [
"Deletes",
"an",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L424-L457 | train |
saltstack/salt | salt/modules/snapper.py | modify_snapshot | def modify_snapshot(snapshot_id=None,
description=None,
userdata=None,
cleanup=None,
config="root"):
'''
Modify attributes of an existing snapshot.
config
Configuration name. (Default: root)
snapshot_id
ID ... | python | def modify_snapshot(snapshot_id=None,
description=None,
userdata=None,
cleanup=None,
config="root"):
'''
Modify attributes of an existing snapshot.
config
Configuration name. (Default: root)
snapshot_id
ID ... | [
"def",
"modify_snapshot",
"(",
"snapshot_id",
"=",
"None",
",",
"description",
"=",
"None",
",",
"userdata",
"=",
"None",
",",
"cleanup",
"=",
"None",
",",
"config",
"=",
"\"root\"",
")",
":",
"if",
"not",
"snapshot_id",
":",
"raise",
"CommandExecutionError"... | Modify attributes of an existing snapshot.
config
Configuration name. (Default: root)
snapshot_id
ID of the snapshot to be modified.
cleanup
Change the cleanup method of the snapshot. (str)
description
Change the description of the snapshot. (str)
userdata
... | [
"Modify",
"attributes",
"of",
"an",
"existing",
"snapshot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L460-L510 | train |
saltstack/salt | salt/modules/snapper.py | _get_num_interval | def _get_num_interval(config, num_pre, num_post):
'''
Returns numerical interval based on optionals num_pre, num_post values
'''
post = int(num_post) if num_post else 0
pre = int(num_pre) if num_pre is not None else _get_last_snapshot(config)['id']
return pre, post | python | def _get_num_interval(config, num_pre, num_post):
'''
Returns numerical interval based on optionals num_pre, num_post values
'''
post = int(num_post) if num_post else 0
pre = int(num_pre) if num_pre is not None else _get_last_snapshot(config)['id']
return pre, post | [
"def",
"_get_num_interval",
"(",
"config",
",",
"num_pre",
",",
"num_post",
")",
":",
"post",
"=",
"int",
"(",
"num_post",
")",
"if",
"num_post",
"else",
"0",
"pre",
"=",
"int",
"(",
"num_pre",
")",
"if",
"num_pre",
"is",
"not",
"None",
"else",
"_get_l... | Returns numerical interval based on optionals num_pre, num_post values | [
"Returns",
"numerical",
"interval",
"based",
"on",
"optionals",
"num_pre",
"num_post",
"values"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L513-L519 | train |
saltstack/salt | salt/modules/snapper.py | _is_text_file | def _is_text_file(filename):
'''
Checks if a file is a text file
'''
type_of_file = os.popen('file -bi {0}'.format(filename), 'r').read()
return type_of_file.startswith('text') | python | def _is_text_file(filename):
'''
Checks if a file is a text file
'''
type_of_file = os.popen('file -bi {0}'.format(filename), 'r').read()
return type_of_file.startswith('text') | [
"def",
"_is_text_file",
"(",
"filename",
")",
":",
"type_of_file",
"=",
"os",
".",
"popen",
"(",
"'file -bi {0}'",
".",
"format",
"(",
"filename",
")",
",",
"'r'",
")",
".",
"read",
"(",
")",
"return",
"type_of_file",
".",
"startswith",
"(",
"'text'",
")... | Checks if a file is a text file | [
"Checks",
"if",
"a",
"file",
"is",
"a",
"text",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L522-L527 | train |
saltstack/salt | salt/modules/snapper.py | run | def run(function, *args, **kwargs):
'''
Runs a function from an execution module creating pre and post snapshots
and associating the salt job id with those snapshots for easy undo and
cleanup.
function
Salt function to call.
config
Configuration name. (default: "root")
des... | python | def run(function, *args, **kwargs):
'''
Runs a function from an execution module creating pre and post snapshots
and associating the salt job id with those snapshots for easy undo and
cleanup.
function
Salt function to call.
config
Configuration name. (default: "root")
des... | [
"def",
"run",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"\"root\"",
")",
"description",
"=",
"kwargs",
".",
"pop",
"(",
"\"description\"",
",",
"\"snapper.run[{0}]\"... | Runs a function from an execution module creating pre and post snapshots
and associating the salt job id with those snapshots for easy undo and
cleanup.
function
Salt function to call.
config
Configuration name. (default: "root")
description
A description for the snapshots... | [
"Runs",
"a",
"function",
"from",
"an",
"execution",
"module",
"creating",
"pre",
"and",
"post",
"snapshots",
"and",
"associating",
"the",
"salt",
"job",
"id",
"with",
"those",
"snapshots",
"for",
"easy",
"undo",
"and",
"cleanup",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L530-L604 | train |
saltstack/salt | salt/modules/snapper.py | status | def status(config='root', num_pre=None, num_post=None):
'''
Returns a comparison between two snapshots
config
Configuration name.
num_pre
first snapshot ID to compare. Default is last snapshot
num_post
last snapshot ID to compare. Default is 0 (current state)
CLI exam... | python | def status(config='root', num_pre=None, num_post=None):
'''
Returns a comparison between two snapshots
config
Configuration name.
num_pre
first snapshot ID to compare. Default is last snapshot
num_post
last snapshot ID to compare. Default is 0 (current state)
CLI exam... | [
"def",
"status",
"(",
"config",
"=",
"'root'",
",",
"num_pre",
"=",
"None",
",",
"num_post",
"=",
"None",
")",
":",
"try",
":",
"pre",
",",
"post",
"=",
"_get_num_interval",
"(",
"config",
",",
"num_pre",
",",
"num_post",
")",
"snapper",
".",
"CreateCo... | Returns a comparison between two snapshots
config
Configuration name.
num_pre
first snapshot ID to compare. Default is last snapshot
num_post
last snapshot ID to compare. Default is 0 (current state)
CLI example:
.. code-block:: bash
salt '*' snapper.status
... | [
"Returns",
"a",
"comparison",
"between",
"two",
"snapshots"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L607-L643 | train |
saltstack/salt | salt/modules/snapper.py | undo | def undo(config='root', files=None, num_pre=None, num_post=None):
'''
Undo all file changes that happened between num_pre and num_post, leaving
the files into the state of num_pre.
.. warning::
If one of the files has changes after num_post, they will be overwritten
The snapshots are us... | python | def undo(config='root', files=None, num_pre=None, num_post=None):
'''
Undo all file changes that happened between num_pre and num_post, leaving
the files into the state of num_pre.
.. warning::
If one of the files has changes after num_post, they will be overwritten
The snapshots are us... | [
"def",
"undo",
"(",
"config",
"=",
"'root'",
",",
"files",
"=",
"None",
",",
"num_pre",
"=",
"None",
",",
"num_post",
"=",
"None",
")",
":",
"pre",
",",
"post",
"=",
"_get_num_interval",
"(",
"config",
",",
"num_pre",
",",
"num_post",
")",
"changes",
... | Undo all file changes that happened between num_pre and num_post, leaving
the files into the state of num_pre.
.. warning::
If one of the files has changes after num_post, they will be overwritten
The snapshots are used to determine the file list, but the current
version of the files wi... | [
"Undo",
"all",
"file",
"changes",
"that",
"happened",
"between",
"num_pre",
"and",
"num_post",
"leaving",
"the",
"files",
"into",
"the",
"state",
"of",
"num_pre",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L669-L711 | train |
saltstack/salt | salt/modules/snapper.py | _get_jid_snapshots | def _get_jid_snapshots(jid, config='root'):
'''
Returns pre/post snapshots made by a given Salt jid
Looks for 'salt_jid' entries into snapshots userdata which are created
when 'snapper.run' is executed.
'''
jid_snapshots = [x for x in list_snapshots(config) if x['userdata'].get("salt_jid") == j... | python | def _get_jid_snapshots(jid, config='root'):
'''
Returns pre/post snapshots made by a given Salt jid
Looks for 'salt_jid' entries into snapshots userdata which are created
when 'snapper.run' is executed.
'''
jid_snapshots = [x for x in list_snapshots(config) if x['userdata'].get("salt_jid") == j... | [
"def",
"_get_jid_snapshots",
"(",
"jid",
",",
"config",
"=",
"'root'",
")",
":",
"jid_snapshots",
"=",
"[",
"x",
"for",
"x",
"in",
"list_snapshots",
"(",
"config",
")",
"if",
"x",
"[",
"'userdata'",
"]",
".",
"get",
"(",
"\"salt_jid\"",
")",
"==",
"jid... | Returns pre/post snapshots made by a given Salt jid
Looks for 'salt_jid' entries into snapshots userdata which are created
when 'snapper.run' is executed. | [
"Returns",
"pre",
"/",
"post",
"snapshots",
"made",
"by",
"a",
"given",
"Salt",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L714-L731 | train |
saltstack/salt | salt/modules/snapper.py | undo_jid | def undo_jid(jid, config='root'):
'''
Undo the changes applied by a salt job
jid
The job id to lookup
config
Configuration name.
CLI Example:
.. code-block:: bash
salt '*' snapper.undo_jid jid=20160607130930720112
'''
pre_snapshot, post_snapshot = _get_jid_sn... | python | def undo_jid(jid, config='root'):
'''
Undo the changes applied by a salt job
jid
The job id to lookup
config
Configuration name.
CLI Example:
.. code-block:: bash
salt '*' snapper.undo_jid jid=20160607130930720112
'''
pre_snapshot, post_snapshot = _get_jid_sn... | [
"def",
"undo_jid",
"(",
"jid",
",",
"config",
"=",
"'root'",
")",
":",
"pre_snapshot",
",",
"post_snapshot",
"=",
"_get_jid_snapshots",
"(",
"jid",
",",
"config",
"=",
"config",
")",
"return",
"undo",
"(",
"config",
",",
"num_pre",
"=",
"pre_snapshot",
","... | Undo the changes applied by a salt job
jid
The job id to lookup
config
Configuration name.
CLI Example:
.. code-block:: bash
salt '*' snapper.undo_jid jid=20160607130930720112 | [
"Undo",
"the",
"changes",
"applied",
"by",
"a",
"salt",
"job"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L734-L751 | train |
saltstack/salt | salt/modules/snapper.py | diff | def diff(config='root', filename=None, num_pre=None, num_post=None):
'''
Returns the differences between two snapshots
config
Configuration name.
filename
if not provided the showing differences between snapshots for
all "text" files
num_pre
first snapshot ID to co... | python | def diff(config='root', filename=None, num_pre=None, num_post=None):
'''
Returns the differences between two snapshots
config
Configuration name.
filename
if not provided the showing differences between snapshots for
all "text" files
num_pre
first snapshot ID to co... | [
"def",
"diff",
"(",
"config",
"=",
"'root'",
",",
"filename",
"=",
"None",
",",
"num_pre",
"=",
"None",
",",
"num_post",
"=",
"None",
")",
":",
"try",
":",
"pre",
",",
"post",
"=",
"_get_num_interval",
"(",
"config",
",",
"num_pre",
",",
"num_post",
... | Returns the differences between two snapshots
config
Configuration name.
filename
if not provided the showing differences between snapshots for
all "text" files
num_pre
first snapshot ID to compare. Default is last snapshot
num_post
last snapshot ID to compare... | [
"Returns",
"the",
"differences",
"between",
"two",
"snapshots"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L754-L852 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.