partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_get_audit_defaults
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...
salt/modules/win_lgpo.py
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): ''' 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...
[ "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"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4973-L5056
[ "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", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_findOptionValueAdvAudit
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``
salt/modules/win_lgpo.py
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): ''' 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 '...
[ "Get", "the", "Advanced", "Auditing", "policy", "as", "configured", "in", "C", ":", "\\\\", "Windows", "\\\\", "Security", "\\\\", "Audit", "\\\\", "audit", ".", "csv" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5059-L5099
[ "def", "_findOptionValueAdvAudit", "(", "option", ")", ":", "if", "'lgpo.adv_audit_data'", "not", "in", "__context__", ":", "system_root", "=", "os", ".", "environ", ".", "get", "(", "'SystemRoot'", ",", "'C:\\\\Windows'", ")", "f_audit", "=", "os", ".", "path...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_audit_file_data
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 ...
salt/modules/win_lgpo.py
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): ''' 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: ...
[ "Helper", "function", "that", "sets", "the", "Advanced", "Audit", "settings", "in", "the", "two", ".", "csv", "files", "on", "Windows", ".", "Those", "files", "are", "located", "at", ":", "C", ":", "\\\\", "Windows", "\\\\", "Security", "\\\\", "Audit", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5102-L5196
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_set_auditpol_data
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:...
salt/modules/win_lgpo.py
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): ''' 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...
[ "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", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5199-L5220
[ "def", "_set_auditpol_data", "(", "option", ",", "value", ")", ":", "auditpol_values", "=", "{", "'None'", ":", "'No Auditing'", ",", "'0'", ":", "'No Auditing'", ",", "'1'", ":", "'Success'", ",", "'2'", ":", "'Failure'", ",", "'3'", ":", "'Success and Fail...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_setOptionValueAdvAudit
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...
salt/modules/win_lgpo.py
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): ''' 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 ...
[ "Helper", "function", "to", "update", "the", "Advanced", "Audit", "policy", "on", "the", "machine", ".", "This", "function", "modifies", "the", "two", "audit", ".", "csv", "files", "in", "the", "following", "locations", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5223-L5261
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_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
salt/modules/win_lgpo.py
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(): ''' 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__['...
[ "Helper", "function", "that", "loads", "secedit", "data", ".", "It", "runs", "secedit", "/", "export", "/", "cfg", "<file_name", ">", "which", "creates", "a", "file", "that", "contains", "the", "secedit", "data", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5312-L5329
[ "def", "_load_secedit_data", "(", ")", ":", "try", ":", "f_exp", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "'cachedir'", "]", ",", "'secedit-{0}.txt'", ".", "format", "(", "UUID", ")", ")", "__salt__", "[", "'cmd.run'", "]", "(", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_secedit_value
Helper function that looks for the passed option in the secedit data
salt/modules/win_lgpo.py
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): ''' 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'
[ "Helper", "function", "that", "looks", "for", "the", "passed", "option", "in", "the", "secedit", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5346-L5354
[ "def", "_get_secedit_value", "(", "option", ")", ":", "secedit_data", "=", "_get_secedit_data", "(", ")", "for", "_line", "in", "secedit_data", ":", "if", "_line", ".", "startswith", "(", "option", ")", ":", "return", "_line", ".", "split", "(", "'='", ")"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_write_secedit_data
Helper function to write secedit data to the database
salt/modules/win_lgpo.py
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): ''' 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...
[ "Helper", "function", "to", "write", "secedit", "data", "to", "the", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5357-L5383
[ "def", "_write_secedit_data", "(", "inf_data", ")", ":", "# Set file names", "f_sdb", "=", "os", ".", "path", ".", "join", "(", "__opts__", "[", "'cachedir'", "]", ",", "'secedit-{0}.sdb'", ".", "format", "(", "UUID", ")", ")", "f_inf", "=", "os", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_transform_value
helper function to transform the policy value into something that more closely matches how the policy is displayed in the gpedit GUI
salt/modules/win_lgpo.py
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): ''' 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']: ...
[ "helper", "function", "to", "transform", "the", "policy", "value", "into", "something", "that", "more", "closely", "matches", "how", "the", "policy", "is", "displayed", "in", "the", "gpedit", "GUI" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5386-L5404
[ "def", "_transform_value", "(", "value", ",", "policy", ",", "transform_type", ")", ":", "t_kwargs", "=", "{", "}", "if", "'Transform'", "in", "policy", ":", "if", "transform_type", "in", "policy", "[", "'Transform'", "]", ":", "_policydata", "=", "_policy_i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_validateSetting
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 ...
salt/modules/win_lgpo.py
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): ''' 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...
[ "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",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5407-L5431
[ "def", "_validateSetting", "(", "value", ",", "policy", ")", ":", "log", ".", "debug", "(", "'validating %s for policy %s'", ",", "value", ",", "policy", ")", "if", "'Settings'", "in", "policy", ":", "if", "policy", "[", "'Settings'", "]", ":", "if", "isin...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_addAccountRights
helper function to add an account right to a user
salt/modules/win_lgpo.py
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): ''' 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...
[ "helper", "function", "to", "add", "an", "account", "right", "to", "a", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5434-L5448
[ "def", "_addAccountRights", "(", "sidObject", ",", "user_right", ")", ":", "try", ":", "if", "sidObject", ":", "_polHandle", "=", "win32security", ".", "LsaOpenPolicy", "(", "None", ",", "win32security", ".", "POLICY_ALL_ACCESS", ")", "user_rights_list", "=", "[...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_delAccountRights
helper function to remove an account right from a user
salt/modules/win_lgpo.py
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): ''' 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...
[ "helper", "function", "to", "remove", "an", "account", "right", "from", "a", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5451-L5462
[ "def", "_delAccountRights", "(", "sidObject", ",", "user_right", ")", ":", "try", ":", "_polHandle", "=", "win32security", ".", "LsaOpenPolicy", "(", "None", ",", "win32security", ".", "POLICY_ALL_ACCESS", ")", "user_rights_list", "=", "[", "user_right", "]", "_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getRightsAssignments
helper function to return all the user rights assignments/users
salt/modules/win_lgpo.py
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): ''' 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
[ "helper", "function", "to", "return", "all", "the", "user", "rights", "assignments", "/", "users" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5465-L5472
[ "def", "_getRightsAssignments", "(", "user_right", ")", ":", "sids", "=", "[", "]", "polHandle", "=", "win32security", ".", "LsaOpenPolicy", "(", "None", ",", "win32security", ".", "POLICY_ALL_ACCESS", ")", "sids", "=", "win32security", ".", "LsaEnumerateAccountsW...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getAdmlDisplayName
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
salt/modules/win_lgpo.py
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): ''' 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 ...
[ "helper", "function", "to", "take", "the", "displayName", "attribute", "of", "an", "element", "and", "find", "the", "value", "from", "the", "ADML", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5475-L5496
[ "def", "_getAdmlDisplayName", "(", "adml_xml_data", ",", "display_name", ")", ":", "if", "display_name", ".", "startswith", "(", "'$('", ")", "and", "display_name", ".", "endswith", "(", "')'", ")", ":", "display_name", "=", "re", ".", "sub", "(", "r'(^\\$\\...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getAdmlPresentationRefId
helper function to check for a presentation label for a policy element
salt/modules/win_lgpo.py
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): ''' 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:...
[ "helper", "function", "to", "check", "for", "a", "presentation", "label", "for", "a", "policy", "element" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5499-L5540
[ "def", "_getAdmlPresentationRefId", "(", "adml_data", ",", "ref_id", ")", ":", "search_results", "=", "adml_data", ".", "xpath", "(", "'//*[@*[local-name() = \"refId\"] = \"{0}\"]'", ".", "format", "(", "ref_id", ")", ")", "prepended_text", "=", "''", "if", "search_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getFullPolicyName
helper function to retrieve the full policy name if needed
salt/modules/win_lgpo.py
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): ''' helper function to retrieve the full policy name if needed ''' adml_data = _get_policy_resources(language=adml_language) if policy_name ...
[ "helper", "function", "to", "retrieve", "the", "full", "policy", "name", "if", "needed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5543-L5564
[ "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",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_regexSearchRegPolData
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
salt/modules/win_lgpo.py
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): ''' 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,...
[ "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" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5567-L5577
[ "def", "_regexSearchRegPolData", "(", "search_string", ",", "policy_data", ")", ":", "if", "policy_data", ":", "if", "search_string", ":", "match", "=", "re", ".", "search", "(", "search_string", ",", "policy_data", ",", "re", ".", "IGNORECASE", ")", "if", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getDataFromRegPolData
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]
salt/modules/win_lgpo.py
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): ''' 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...
[ "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", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5580-L5634
[ "def", "_getDataFromRegPolData", "(", "search_string", ",", "policy_data", ",", "return_value_name", "=", "False", ")", ":", "value", "=", "None", "values", "=", "[", "]", "encoded_semicolon", "=", "';'", ".", "encode", "(", "'utf-16-le'", ")", "if", "return_v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_checkListItem
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 ...
salt/modules/win_lgpo.py
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): ''' 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...
[ "helper", "function", "to", "process", "an", "enabled", "/", "disabled", "/", "true", "/", "falseList", "set" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5637-L5695
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_checkValueItemParent
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...
salt/modules/win_lgpo.py
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): ''' helper function to process the parent of a value item object if test_item is True, it will determ...
[ "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"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5698-L5728
[ "def", "_checkValueItemParent", "(", "policy_element", ",", "policy_name", ",", "policy_key", ",", "policy_valueName", ",", "xpath_object", ",", "policy_file_data", ",", "check_deleted", "=", "False", ",", "test_item", "=", "True", ")", ":", "for", "element", "in"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_buildKnownDataSearchString
helper function similar to _processValueItem to build a search string for a known key/value/type/data
salt/modules/win_lgpo.py
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): ''' helper function similar to _processValueItem to build a search string for a known key/value/type/data ''' registry = Registry() this_element_value = None exp...
[ "helper", "function", "similar", "to", "_processValueItem", "to", "build", "a", "search", "string", "for", "a", "known", "key", "/", "value", "/", "type", "/", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5731-L5785
[ "def", "_buildKnownDataSearchString", "(", "reg_key", ",", "reg_valueName", ",", "reg_vtype", ",", "reg_data", ",", "check_deleted", "=", "False", ")", ":", "registry", "=", "Registry", "(", ")", "this_element_value", "=", "None", "expected_string", "=", "b''", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_processValueItem
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...
salt/modules/win_lgpo.py
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): ''' 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...
[ "helper", "function", "to", "process", "a", "value", "type", "item", "and", "generate", "the", "expected", "string", "in", "the", "Registry", ".", "pol", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L5788-L6047
[ "def", "_processValueItem", "(", "element", ",", "reg_key", ",", "reg_valuename", ",", "policy", ",", "parent_element", ",", "check_deleted", "=", "False", ",", "this_element_value", "=", "None", ")", ":", "registry", "=", "Registry", "(", ")", "expected_string"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_checkAllAdmxPolicies
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
salt/modules/win_lgpo.py
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): ''' rewrite of _getAllAdminTemplateSettingsFromRegPolFil...
[ "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", "."...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6050-L6507
[ "def", "_checkAllAdmxPolicies", "(", "policy_class", ",", "adml_language", "=", "'en-US'", ",", "return_full_policy_names", "=", "False", ",", "hierarchical_return", "=", "False", ",", "return_not_configured", "=", "False", ")", ":", "log", ".", "debug", "(", "'PO...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_build_parent_list
helper function to build a list containing parent elements of the ADMX policy
salt/modules/win_lgpo.py
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): ''' helper function to build a list containing parent elements of the ADMX policy ''' parent_list = [] policy_namespace = list(policy_definition.nsmap.keys())[0] ...
[ "helper", "function", "to", "build", "a", "list", "containing", "parent", "elements", "of", "the", "ADMX", "policy" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6510-L6539
[ "def", "_build_parent_list", "(", "policy_definition", ",", "return_full_policy_names", ",", "adml_language", ")", ":", "parent_list", "=", "[", "]", "policy_namespace", "=", "list", "(", "policy_definition", ".", "nsmap", ".", "keys", "(", ")", ")", "[", "0", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_admx_policy_parent_walk
helper function to recursively walk up the ADMX namespaces and build the hierarchy for the policy
salt/modules/win_lgpo.py
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): ''' helper function to recursively walk u...
[ "helper", "function", "to", "recursively", "walk", "up", "the", "ADMX", "namespaces", "and", "build", "the", "hierarchy", "for", "the", "policy" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6542-L6582
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_read_regpol_file
helper function to read a reg policy file and return decoded data
salt/modules/win_lgpo.py
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): ''' 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
[ "helper", "function", "to", "read", "a", "reg", "policy", "file", "and", "return", "decoded", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6585-L6593
[ "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'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_regexSearchKeyValueCombo
helper function to do a search of Policy data from a registry.pol file for a policy_regpath and policy_regkey combo
salt/modules/win_lgpo.py
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): ''' 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\...
[ "helper", "function", "to", "do", "a", "search", "of", "Policy", "data", "from", "a", "registry", ".", "pol", "file", "for", "a", "policy_regpath", "and", "policy_regkey", "combo" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6596-L6615
[ "def", "_regexSearchKeyValueCombo", "(", "policy_data", ",", "policy_regpath", ",", "policy_regkey", ")", ":", "if", "policy_data", ":", "specialValueRegex", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "r'(\\*\\*Del\\.|\\*\\*DelVals\\.){0,1}'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_write_regpol_data
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...
salt/modules/win_lgpo.py
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): ''' helper function to actually write the data to a Registry.pol file also updates/edits the gpt.ini file to ...
[ "helper", "function", "to", "actually", "write", "the", "data", "to", "a", "Registry", ".", "pol", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6618-L6719
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policyFileReplaceOrAppendList
helper function to take a list of strings for registry.pol file data and update existing strings or append the strings
salt/modules/win_lgpo.py
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): ''' 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 ...
[ "helper", "function", "to", "take", "a", "list", "of", "strings", "for", "registry", ".", "pol", "file", "data", "and", "update", "existing", "strings", "or", "append", "the", "strings" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6722-L6747
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policyFileReplaceOrAppend
helper function to take a ADMX policy string for registry.pol file data and update existing string or append the string to the data
salt/modules/win_lgpo.py
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): ''' 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 ...
[ "helper", "function", "to", "take", "a", "ADMX", "policy", "string", "for", "registry", ".", "pol", "file", "data", "and", "update", "existing", "string", "or", "append", "the", "string", "to", "the", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6750-L6777
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_writeAdminTemplateRegPolFile
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 ...
salt/modules/win_lgpo.py
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'): r''' helper function to prep/write adm template data to the Registry.pol file each file begins with REGFILE_SIGNATURE (u'\u5250\u6765') a...
[ "r", "helper", "function", "to", "prep", "/", "write", "adm", "template", "data", "to", "the", "Registry", ".", "pol", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L6780-L7114
[ "def", "_writeAdminTemplateRegPolFile", "(", "admtemplate_data", ",", "adml_language", "=", "'en-US'", ",", "registry_class", "=", "'Machine'", ")", ":", "existing_data", "=", "b''", "policy_data", "=", "_policy_info", "(", ")", "policySearchXpath", "=", "'//ns1:*[@id...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_getScriptSettingsFromIniFile
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
salt/modules/win_lgpo.py
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): ''' 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" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7117-L7148
[ "def", "_getScriptSettingsFromIniFile", "(", "policy_info", ")", ":", "_existingData", "=", "None", "if", "os", ".", "path", ".", "isfile", "(", "policy_info", "[", "'ScriptIni'", "]", "[", "'IniPath'", "]", ")", ":", "with", "salt", ".", "utils", ".", "fi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_writeGpoScript
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...
salt/modules/win_lgpo.py
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): ''' 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: ...
[ "helper", "function", "to", "write", "local", "GPO", "startup", "/", "shutdown", "script" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7151-L7203
[ "def", "_writeGpoScript", "(", "psscript", "=", "False", ")", ":", "_machineScriptPolicyPath", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getenv", "(", "'WINDIR'", ")", ",", "'System32'", ",", "'GroupPolicy'", ",", "'Machine'", ",", "'Scripts'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_lookup_admin_template
(success_flag, policy_xml_item, policy_name_list, message)
salt/modules/win_lgpo.py
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'): ''' (success_flag, policy_xml_item, policy_name_list, message) ''' policy_aliases = [] admx_policy_definitions = _get_policy_definitions(language=adml_language) adm...
[ "(", "success_flag", "policy_xml_item", "policy_name_list", "message", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7206-L7393
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_policy_info
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...
salt/modules/win_lgpo.py
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'): 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...
[ "r", "Returns", "information", "about", "a", "specified", "policy" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7396-L7592
[ "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", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
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...
salt/modules/win_lgpo.py
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): ''' Get a policy value Args: policy_class (str): Some policies are both user and computer, by default all policies will ...
[ "Get", "a", "policy", "value" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7595-L7740
[ "def", "get", "(", "policy_class", "=", "None", ",", "return_full_policy_names", "=", "True", ",", "hierarchical_return", "=", "False", ",", "adml_language", "=", "'en-US'", ",", "return_not_configured", "=", "False", ")", ":", "vals", "=", "{", "}", "modal_re...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_computer_policy
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,...
salt/modules/win_lgpo.py
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'): ''' Set a single computer policy Args: name (str): The name of the policy to configure setting (str): ...
[ "Set", "a", "single", "computer", "policy" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7743-L7782
[ "def", "set_computer_policy", "(", "name", ",", "setting", ",", "cumulative_rights_assignments", "=", "True", ",", "adml_language", "=", "'en-US'", ")", ":", "pol", "=", "{", "}", "pol", "[", "name", "]", "=", "setting", "ret", "=", "set_", "(", "computer_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
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 ...
salt/modules/win_lgpo.py
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'): ''' Set a local server policy. Args: computer_policy (dict): A dictionary of "policyname: value" pairs of computer policies to set. 'value...
[ "Set", "a", "local", "server", "policy", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L7822-L8202
[ "def", "set_", "(", "computer_policy", "=", "None", ",", "user_policy", "=", "None", ",", "cumulative_rights_assignments", "=", "True", ",", "adml_language", "=", "'en-US'", ")", ":", "if", "computer_policy", "and", "not", "isinstance", "(", "computer_policy", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._seconds_to_days
converts a number of seconds to days
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "a", "number", "of", "seconds", "to", "days" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4369-L4379
[ "def", "_seconds_to_days", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "zero_value", "=", "kwargs", ".", "get", "(", "'zero_value'", ",", "0", ")", "if", "val", "is", "not", "None", ":", "if", "val", "==", "zero_value", ":", "return", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._days_to_seconds
converts a number of days to seconds
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "a", "number", "of", "days", "to", "seconds" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4382-L4392
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._binary_enable_zero_disable_one_conversion
converts a binary 0/1 to Disabled/Enabled
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "a", "binary", "0", "/", "1", "to", "Disabled", "/", "Enabled" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4429-L4444
[ "def", "_binary_enable_zero_disable_one_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "val", "is", "not", "None", ":", "if", "ord", "(", "val", ")", "==", "0", ":", "return", "'Disabled'", "elif", "ord", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._binary_enable_zero_disable_one_reverse_conversion
converts Enabled/Disabled to unicode char to write to a REG_BINARY value
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "Enabled", "/", "Disabled", "to", "unicode", "char", "to", "write", "to", "a", "REG_BINARY", "value" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4447-L4459
[ "def", "_binary_enable_zero_disable_one_reverse_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", ".", "upper", "(", ")", "==", "'DISABLED'", ":", "return", "chr", "(", "0", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._dasd_conversion
converts 0/1/2 for dasd reg key
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "0", "/", "1", "/", "2", "for", "dasd", "reg", "key" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4462-L4476
[ "def", "_dasd_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", "==", "'0'", "or", "val", "==", "0", "or", "val", "==", "''", ":", "return", "'Administrators'", "elif", "val"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._dasd_reverse_conversion
converts DASD String values to the reg_sz value
salt/modules/win_lgpo.py
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): ''' 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(...
[ "converts", "DASD", "String", "values", "to", "the", "reg_sz", "value" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4479-L4498
[ "def", "_dasd_reverse_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", ".", "upper", "(", ")", "==", "'ADMINISTRATORS'", ":", "# \"\" also shows 'administrators' in the GUI", "return", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._in_range_inclusive
checks that a value is in an inclusive range The value for 0 used by Max Password Age is actually 0xffffffff
salt/modules/win_lgpo.py
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): ''' 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)...
[ "checks", "that", "a", "value", "is", "in", "an", "inclusive", "range", "The", "value", "for", "0", "used", "by", "Max", "Password", "Age", "is", "actually", "0xffffffff" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4501-L4524
[ "def", "_in_range_inclusive", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "minimum", "=", "kwargs", ".", "get", "(", "'min'", ",", "0", ")", "maximum", "=", "kwargs", ".", "get", "(", "'max'", ",", "1", ")", "zero_value", "=", "kwarg...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._driver_signing_reg_conversion
converts the binary value in the registry for driver signing into the correct string representation
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "the", "binary", "value", "in", "the", "registry", "for", "driver", "signing", "into", "the", "correct", "string", "representation" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4527-L4550
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._driver_signing_reg_reverse_conversion
converts the string value seen in the GUI to the correct registry value for secedit
salt/modules/win_lgpo.py
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): ''' 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']) ...
[ "converts", "the", "string", "value", "seen", "in", "the", "GUI", "to", "the", "correct", "registry", "value", "for", "secedit" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4553-L4568
[ "def", "_driver_signing_reg_reverse_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", ".", "upper", "(", ")", "==", "'SILENTLY SUCCEED'", ":", "return", "','", ".", "join", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._sidConversion
converts a list of pysid objects to string representations
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "a", "list", "of", "pysid", "objects", "to", "string", "representations" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4571-L4590
[ "def", "_sidConversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "val", ",", "six", ".", "string_types", ")", ":", "val", "=", "val", ".", "split", "(", "','", ")", "usernames", "=", "[", "]", "for", "_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._usernamesToSidObjects
converts a list of usernames to sid objects
salt/modules/win_lgpo.py
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): ''' 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: ...
[ "converts", "a", "list", "of", "usernames", "to", "sid", "objects" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4593-L4613
[ "def", "_usernamesToSidObjects", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "not", "val", ":", "return", "val", "if", "isinstance", "(", "val", ",", "six", ".", "string_types", ")", ":", "val", "=", "val", ".", "split", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._powershell_script_order_conversion
converts true/false/None to the GUI representation of the powershell startup/shutdown script order
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "true", "/", "false", "/", "None", "to", "the", "GUI", "representation", "of", "the", "powershell", "startup", "/", "shutdown", "script", "order" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4616-L4629
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._powershell_script_order_reverse_conversion
converts powershell script GUI strings representations to True/False/None
salt/modules/win_lgpo.py
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): ''' 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...
[ "converts", "powershell", "script", "GUI", "strings", "representations", "to", "True", "/", "False", "/", "None" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4632-L4644
[ "def", "_powershell_script_order_reverse_conversion", "(", "cls", ",", "val", ",", "*", "*", "kwargs", ")", ":", "if", "val", ".", "upper", "(", ")", "==", "'Run Windows PowerShell scripts first'", ".", "upper", "(", ")", ":", "return", "'true'", "elif", "val"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._dict_lookup
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
salt/modules/win_lgpo.py
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): ''' 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...
[ "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...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4647-L4666
[ "def", "_dict_lookup", "(", "cls", ",", "item", ",", "*", "*", "kwargs", ")", ":", "log", ".", "debug", "(", "'item == %s'", ",", "item", ")", "value_lookup", "=", "kwargs", ".", "get", "(", "'value_lookup'", ",", "False", ")", "if", "'lookup'", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._dict_lookup_bitwise_add
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 ...
salt/modules/win_lgpo.py
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): ''' 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 ...
[ "kwarg", "value_lookup", "bool", "to", "determine", "if", "item_list", "should", "be", "compared", "to", "keys", "or", "values" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4669-L4710
[ "def", "_dict_lookup_bitwise_add", "(", "cls", ",", "item", ",", "*", "*", "kwargs", ")", ":", "value_lookup", "=", "kwargs", ".", "get", "(", "'value_lookup'", ",", "False", ")", "test_zero", "=", "kwargs", ".", "get", "(", "'test_zero'", ",", "False", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._multi_string_put_transform
transform for a REG_MULTI_SZ to properly handle "Not Defined"
salt/modules/win_lgpo.py
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): ''' 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...
[ "transform", "for", "a", "REG_MULTI_SZ", "to", "properly", "handle", "Not", "Defined" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4713-L4725
[ "def", "_multi_string_put_transform", "(", "cls", ",", "item", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "item", ",", "list", ")", ":", "return", "item", "elif", "isinstance", "(", "item", ",", "six", ".", "string_types", ")", ":", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_policy_info._string_put_transform
transfrom for a REG_SZ to properly handle "Not Defined"
salt/modules/win_lgpo.py
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): ''' 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
[ "transfrom", "for", "a", "REG_SZ", "to", "properly", "handle", "Not", "Defined" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_lgpo.py#L4728-L4736
[ "def", "_string_put_transform", "(", "cls", ",", "item", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "item", ",", "six", ".", "string_types", ")", ":", "if", "item", ".", "lower", "(", ")", "==", "'not defined'", ":", "return", "None", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_snapshot_to_data
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...
salt/modules/snapper.py
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): ''' 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...
[ "Returns", "snapshot", "data", "from", "a", "D", "-", "Bus", "response", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L99-L138
[ "def", "_snapshot_to_data", "(", "snapshot", ")", ":", "data", "=", "{", "}", "data", "[", "'id'", "]", "=", "snapshot", "[", "0", "]", "data", "[", "'type'", "]", "=", "[", "'single'", ",", "'pre'", ",", "'post'", "]", "[", "snapshot", "[", "1", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_dbus_exception_to_reason
Returns a error message from a snapper DBusException
salt/modules/snapper.py
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): ''' 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...
[ "Returns", "a", "error", "message", "from", "a", "snapper", "DBusException" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L141-L151
[ "def", "_dbus_exception_to_reason", "(", "exc", ",", "args", ")", ":", "error", "=", "exc", ".", "get_dbus_name", "(", ")", "if", "error", "==", "'error.unknown_config'", ":", "return", "\"Unknown configuration '{0}'\"", ".", "format", "(", "args", "[", "'config...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_snapshots
List available snapshots CLI example: .. code-block:: bash salt '*' snapper.list_snapshots config=myconfig
salt/modules/snapper.py
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'): ''' 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...
[ "List", "available", "snapshots" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L154-L171
[ "def", "list_snapshots", "(", "config", "=", "'root'", ")", ":", "try", ":", "snapshots", "=", "snapper", ".", "ListSnapshots", "(", "config", ")", "return", "[", "_snapshot_to_data", "(", "s", ")", "for", "s", "in", "snapshots", "]", "except", "dbus", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_snapshot
Get detailed information about a given snapshot CLI example: .. code-block:: bash salt '*' snapper.get_snapshot 1
salt/modules/snapper.py
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'): ''' 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...
[ "Get", "detailed", "information", "about", "a", "given", "snapshot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L174-L191
[ "def", "get_snapshot", "(", "number", "=", "0", ",", "config", "=", "'root'", ")", ":", "try", ":", "snapshot", "=", "snapper", ".", "GetSnapshot", "(", "config", ",", "int", "(", "number", ")", ")", "return", "_snapshot_to_data", "(", "snapshot", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_configs
List all available configs CLI example: .. code-block:: bash salt '*' snapper.list_configs
salt/modules/snapper.py
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(): ''' 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...
[ "List", "all", "available", "configs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L194-L211
[ "def", "list_configs", "(", ")", ":", "try", ":", "configs", "=", "snapper", ".", "ListConfigs", "(", ")", "return", "dict", "(", "(", "config", "[", "0", "]", ",", "config", "[", "2", "]", ")", "for", "config", "in", "configs", ")", "except", "dbu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_config
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=...
salt/modules/snapper.py
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): ''' 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:: ...
[ "Set", "configuration", "values" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L220-L246
[ "def", "set_config", "(", "name", "=", "'root'", ",", "*", "*", "kwargs", ")", ":", "try", ":", "data", "=", "dict", "(", "(", "k", ".", "upper", "(", ")", ",", "_config_filter", "(", "v", ")", ")", "for", "k", ",", "v", "in", "kwargs", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_last_snapshot
Returns the last existing created snapshot
salt/modules/snapper.py
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'): ''' Returns the last existing created snapshot ''' snapshot_list = sorted(list_snapshots(config), key=lambda x: x['id']) return snapshot_list[-1]
[ "Returns", "the", "last", "existing", "created", "snapshot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L249-L254
[ "def", "_get_last_snapshot", "(", "config", "=", "'root'", ")", ":", "snapshot_list", "=", "sorted", "(", "list_snapshots", "(", "config", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "'id'", "]", ")", "return", "snapshot_list", "[", "-", "1", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
status_to_string
Converts a numeric dbus snapper status into a string CLI Example: .. code-block:: bash salt '*' snapper.status_to_string <dbus_status>
salt/modules/snapper.py
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): ''' 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, ...
[ "Converts", "a", "numeric", "dbus", "snapper", "status", "into", "a", "string" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L257-L273
[ "def", "status_to_string", "(", "dbus_status", ")", ":", "status_tuple", "=", "(", "dbus_status", "&", "0b000000001", ",", "dbus_status", "&", "0b000000010", ",", "dbus_status", "&", "0b000000100", ",", "dbus_status", "&", "0b000001000", ",", "dbus_status", "&", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_config
Retrieves all values from a given configuration CLI example: .. code-block:: bash salt '*' snapper.get_config
salt/modules/snapper.py
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'): ''' 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...
[ "Retrieves", "all", "values", "from", "a", "given", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L276-L293
[ "def", "get_config", "(", "name", "=", "'root'", ")", ":", "try", ":", "config", "=", "snapper", ".", "GetConfig", "(", "name", ")", "return", "config", "except", "dbus", ".", "DBusException", "as", "exc", ":", "raise", "CommandExecutionError", "(", "'Erro...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_config
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...
salt/modules/snapper.py
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): ''' Creates a new Snapper configuration name Name of the new Snapper configuration. subvolume Path to the related subvolume....
[ "Creates", "a", "new", "Snapper", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L296-L347
[ "def", "create_config", "(", "name", "=", "None", ",", "subvolume", "=", "None", ",", "fstype", "=", "None", ",", "template", "=", "None", ",", "extra_opts", "=", "None", ")", ":", "def", "raise_arg_error", "(", "argname", ")", ":", "raise", "CommandExec...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_snapshot
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...
salt/modules/snapper.py
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 snap...
[ "Creates", "an", "snapshot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L350-L421
[ "def", "create_snapshot", "(", "config", "=", "'root'", ",", "snapshot_type", "=", "'single'", ",", "pre_number", "=", "None", ",", "description", "=", "None", ",", "cleanup_algorithm", "=", "'number'", ",", "userdata", "=", "None", ",", "*", "*", "kwargs", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_snapshot
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...
salt/modules/snapper.py
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"): ''' 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...
[ "Deletes", "an", "snapshot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L424-L457
[ "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", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
modify_snapshot
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 ...
salt/modules/snapper.py
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"): ''' Modify attributes of an existing snapshot. config Configuration name. (Default: root) snapshot_id ID ...
[ "Modify", "attributes", "of", "an", "existing", "snapshot", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L460-L510
[ "def", "modify_snapshot", "(", "snapshot_id", "=", "None", ",", "description", "=", "None", ",", "userdata", "=", "None", ",", "cleanup", "=", "None", ",", "config", "=", "\"root\"", ")", ":", "if", "not", "snapshot_id", ":", "raise", "CommandExecutionError"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_num_interval
Returns numerical interval based on optionals num_pre, num_post values
salt/modules/snapper.py
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): ''' 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
[ "Returns", "numerical", "interval", "based", "on", "optionals", "num_pre", "num_post", "values" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L513-L519
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_is_text_file
Checks if a file is a text file
salt/modules/snapper.py
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): ''' 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')
[ "Checks", "if", "a", "file", "is", "a", "text", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L522-L527
[ "def", "_is_text_file", "(", "filename", ")", ":", "type_of_file", "=", "os", ".", "popen", "(", "'file -bi {0}'", ".", "format", "(", "filename", ")", ",", "'r'", ")", ".", "read", "(", ")", "return", "type_of_file", ".", "startswith", "(", "'text'", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
run
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...
salt/modules/snapper.py
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): ''' 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...
[ "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", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L530-L604
[ "def", "run", "(", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "config", "=", "kwargs", ".", "pop", "(", "\"config\"", ",", "\"root\"", ")", "description", "=", "kwargs", ".", "pop", "(", "\"description\"", ",", "\"snapper.run[{0}]\"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
status
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 ...
salt/modules/snapper.py
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): ''' 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...
[ "Returns", "a", "comparison", "between", "two", "snapshots" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L607-L643
[ "def", "status", "(", "config", "=", "'root'", ",", "num_pre", "=", "None", ",", "num_post", "=", "None", ")", ":", "try", ":", "pre", ",", "post", "=", "_get_num_interval", "(", "config", ",", "num_pre", ",", "num_post", ")", "snapper", ".", "CreateCo...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
undo
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...
salt/modules/snapper.py
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): ''' 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...
[ "Undo", "all", "file", "changes", "that", "happened", "between", "num_pre", "and", "num_post", "leaving", "the", "files", "into", "the", "state", "of", "num_pre", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L669-L711
[ "def", "undo", "(", "config", "=", "'root'", ",", "files", "=", "None", ",", "num_pre", "=", "None", ",", "num_post", "=", "None", ")", ":", "pre", ",", "post", "=", "_get_num_interval", "(", "config", ",", "num_pre", ",", "num_post", ")", "changes", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_jid_snapshots
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.
salt/modules/snapper.py
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'): ''' 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...
[ "Returns", "pre", "/", "post", "snapshots", "made", "by", "a", "given", "Salt", "jid" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L714-L731
[ "def", "_get_jid_snapshots", "(", "jid", ",", "config", "=", "'root'", ")", ":", "jid_snapshots", "=", "[", "x", "for", "x", "in", "list_snapshots", "(", "config", ")", "if", "x", "[", "'userdata'", "]", ".", "get", "(", "\"salt_jid\"", ")", "==", "jid...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
undo_jid
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
salt/modules/snapper.py
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'): ''' 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...
[ "Undo", "the", "changes", "applied", "by", "a", "salt", "job" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L734-L751
[ "def", "undo_jid", "(", "jid", ",", "config", "=", "'root'", ")", ":", "pre_snapshot", ",", "post_snapshot", "=", "_get_jid_snapshots", "(", "jid", ",", "config", "=", "config", ")", "return", "undo", "(", "config", ",", "num_pre", "=", "pre_snapshot", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
diff
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...
salt/modules/snapper.py
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): ''' 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...
[ "Returns", "the", "differences", "between", "two", "snapshots" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L754-L852
[ "def", "diff", "(", "config", "=", "'root'", ",", "filename", "=", "None", ",", "num_pre", "=", "None", ",", "num_post", "=", "None", ")", ":", "try", ":", "pre", ",", "post", "=", "_get_num_interval", "(", "config", ",", "num_pre", ",", "num_post", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
diff_jid
Returns the changes applied by a `jid` jid The job id to lookup config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.diff_jid jid=20160607130930720112
salt/modules/snapper.py
def diff_jid(jid, config='root'): ''' Returns the changes applied by a `jid` jid The job id to lookup config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.diff_jid jid=20160607130930720112 ''' pre_snapshot, post_snapshot = _get_jid_sn...
def diff_jid(jid, config='root'): ''' Returns the changes applied by a `jid` jid The job id to lookup config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.diff_jid jid=20160607130930720112 ''' pre_snapshot, post_snapshot = _get_jid_sn...
[ "Returns", "the", "changes", "applied", "by", "a", "jid" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L855-L872
[ "def", "diff_jid", "(", "jid", ",", "config", "=", "'root'", ")", ":", "pre_snapshot", ",", "post_snapshot", "=", "_get_jid_snapshots", "(", "jid", ",", "config", "=", "config", ")", "return", "diff", "(", "config", ",", "num_pre", "=", "pre_snapshot", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_baseline
Creates a snapshot marked as baseline tag Tag name for the baseline config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.create_baseline salt '*' snapper.create_baseline my_custom_baseline
salt/modules/snapper.py
def create_baseline(tag="baseline", config='root'): ''' Creates a snapshot marked as baseline tag Tag name for the baseline config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.create_baseline salt '*' snapper.create_baseline my_custo...
def create_baseline(tag="baseline", config='root'): ''' Creates a snapshot marked as baseline tag Tag name for the baseline config Configuration name. CLI Example: .. code-block:: bash salt '*' snapper.create_baseline salt '*' snapper.create_baseline my_custo...
[ "Creates", "a", "snapshot", "marked", "as", "baseline" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snapper.py#L875-L896
[ "def", "create_baseline", "(", "tag", "=", "\"baseline\"", ",", "config", "=", "'root'", ")", ":", "return", "__salt__", "[", "'snapper.create_snapshot'", "]", "(", "config", "=", "config", ",", "snapshot_type", "=", "'single'", ",", "description", "=", "\"bas...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
setenv
Set the salt process environment variables. name The environment key to set. Must be a string. value Either a string or dict. When string, it will be the value set for the environment key of 'name' above. When a dict, each key/value pair represents an environment variab...
salt/states/environ.py
def setenv(name, value, false_unsets=False, clear_all=False, update_minion=False, permanent=False): ''' Set the salt process environment variables. name The environment key to set. Must be a string. value Either a string or dict. W...
def setenv(name, value, false_unsets=False, clear_all=False, update_minion=False, permanent=False): ''' Set the salt process environment variables. name The environment key to set. Must be a string. value Either a string or dict. W...
[ "Set", "the", "salt", "process", "environment", "variables", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/environ.py#L34-L184
[ "def", "setenv", "(", "name", ",", "value", ",", "false_unsets", "=", "False", ",", "clear_all", "=", "False", ",", "update_minion", "=", "False", ",", "permanent", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_makepass
Create a znc compatible hashed password
salt/modules/znc.py
def _makepass(password, hasher='sha256'): ''' Create a znc compatible hashed password ''' # Setup the hasher if hasher == 'sha256': h = hashlib.sha256(password) elif hasher == 'md5': h = hashlib.md5(password) else: return NotImplemented c = "abcdefghijklmnopqrstu...
def _makepass(password, hasher='sha256'): ''' Create a znc compatible hashed password ''' # Setup the hasher if hasher == 'sha256': h = hashlib.sha256(password) elif hasher == 'md5': h = hashlib.md5(password) else: return NotImplemented c = "abcdefghijklmnopqrstu...
[ "Create", "a", "znc", "compatible", "hashed", "password" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/znc.py#L34-L58
[ "def", "_makepass", "(", "password", ",", "hasher", "=", "'sha256'", ")", ":", "# Setup the hasher", "if", "hasher", "==", "'sha256'", ":", "h", "=", "hashlib", ".", "sha256", "(", "password", ")", "elif", "hasher", "==", "'md5'", ":", "h", "=", "hashlib...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
buildmod
Build module using znc-buildmod CLI Example: .. code-block:: bash salt '*' znc.buildmod module.cpp [...]
salt/modules/znc.py
def buildmod(*modules): ''' Build module using znc-buildmod CLI Example: .. code-block:: bash salt '*' znc.buildmod module.cpp [...] ''' # Check if module files are missing missing = [module for module in modules if not os.path.exists(module)] if missing: return 'Error...
def buildmod(*modules): ''' Build module using znc-buildmod CLI Example: .. code-block:: bash salt '*' znc.buildmod module.cpp [...] ''' # Check if module files are missing missing = [module for module in modules if not os.path.exists(module)] if missing: return 'Error...
[ "Build", "module", "using", "znc", "-", "buildmod" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/znc.py#L61-L79
[ "def", "buildmod", "(", "*", "modules", ")", ":", "# Check if module files are missing", "missing", "=", "[", "module", "for", "module", "in", "modules", "if", "not", "os", ".", "path", ".", "exists", "(", "module", ")", "]", "if", "missing", ":", "return"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Return server version from znc --version CLI Example: .. code-block:: bash salt '*' znc.version
salt/modules/znc.py
def version(): ''' Return server version from znc --version CLI Example: .. code-block:: bash salt '*' znc.version ''' cmd = ['znc', '--version'] out = __salt__['cmd.run'](cmd, python_shell=False).splitlines() ret = out[0].split(' - ') return ret[0]
def version(): ''' Return server version from znc --version CLI Example: .. code-block:: bash salt '*' znc.version ''' cmd = ['znc', '--version'] out = __salt__['cmd.run'](cmd, python_shell=False).splitlines() ret = out[0].split(' - ') return ret[0]
[ "Return", "server", "version", "from", "znc", "--", "version" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/znc.py#L108-L121
[ "def", "version", "(", ")", ":", "cmd", "=", "[", "'znc'", ",", "'--version'", "]", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", ".", "splitlines", "(", ")", "ret", "=", "out", "[", "0", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_conn
Return a MSSQL connection.
salt/returners/odbc.py
def _get_conn(ret=None): ''' Return a MSSQL connection. ''' _options = _get_options(ret) dsn = _options.get('dsn') user = _options.get('user') passwd = _options.get('passwd') return pyodbc.connect('DSN={0};UID={1};PWD={2}'.format( dsn, user, passwd))
def _get_conn(ret=None): ''' Return a MSSQL connection. ''' _options = _get_options(ret) dsn = _options.get('dsn') user = _options.get('user') passwd = _options.get('passwd') return pyodbc.connect('DSN={0};UID={1};PWD={2}'.format( dsn, user, passwd))
[ "Return", "a", "MSSQL", "connection", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/odbc.py#L169-L181
[ "def", "_get_conn", "(", "ret", "=", "None", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "dsn", "=", "_options", ".", "get", "(", "'dsn'", ")", "user", "=", "_options", ".", "get", "(", "'user'", ")", "passwd", "=", "_options", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Return data to an odbc server
salt/returners/odbc.py
def returner(ret): ''' Return data to an odbc server ''' conn = _get_conn(ret) cur = conn.cursor() sql = '''INSERT INTO salt_returns (fun, jid, retval, id, success, full_ret) VALUES (?, ?, ?, ?, ?, ?)''' cur.execute( sql, ( ret['fun'], ...
def returner(ret): ''' Return data to an odbc server ''' conn = _get_conn(ret) cur = conn.cursor() sql = '''INSERT INTO salt_returns (fun, jid, retval, id, success, full_ret) VALUES (?, ?, ?, ?, ?, ?)''' cur.execute( sql, ( ret['fun'], ...
[ "Return", "data", "to", "an", "odbc", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/odbc.py#L192-L211
[ "def", "returner", "(", "ret", ")", ":", "conn", "=", "_get_conn", "(", "ret", ")", "cur", "=", "conn", ".", "cursor", "(", ")", "sql", "=", "'''INSERT INTO salt_returns\n (fun, jid, retval, id, success, full_ret)\n VALUES (?, ?, ?, ?, ?, ?)'''", "cu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_jid
Return the information returned when the specified job id was executed
salt/returners/odbc.py
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = ?''' cur.execute(sql, (jid,)) data = cur.fetchall() ret = {} if data: ...
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = ?''' cur.execute(sql, (jid,)) data = cur.fetchall() ret = {} if data: ...
[ "Return", "the", "information", "returned", "when", "the", "specified", "job", "id", "was", "executed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/odbc.py#L249-L264
[ "def", "get_jid", "(", "jid", ")", ":", "conn", "=", "_get_conn", "(", "ret", "=", "None", ")", "cur", "=", "conn", ".", "cursor", "(", ")", "sql", "=", "'''SELECT id, full_ret FROM salt_returns WHERE jid = ?'''", "cur", ".", "execute", "(", "sql", ",", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_fun
Return a dict of the last function called for all minions
salt/returners/odbc.py
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT s.id,s.jid, s.full_ret FROM salt_returns s JOIN ( SELECT MAX(jid) AS jid FROM salt_returns GROUP BY fun, id) max ...
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT s.id,s.jid, s.full_ret FROM salt_returns s JOIN ( SELECT MAX(jid) AS jid FROM salt_returns GROUP BY fun, id) max ...
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/odbc.py#L267-L288
[ "def", "get_fun", "(", "fun", ")", ":", "conn", "=", "_get_conn", "(", "ret", "=", "None", ")", "cur", "=", "conn", ".", "cursor", "(", ")", "sql", "=", "'''SELECT s.id,s.jid, s.full_ret\n FROM salt_returns s\n JOIN ( SELECT MAX(jid) AS jid FROM sa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_jids
Return a list of all job ids
salt/returners/odbc.py
def get_jids(): ''' Return a list of all job ids ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT distinct jid, load FROM jids''' cur.execute(sql) data = cur.fetchall() ret = {} for jid, load in data: ret[jid] = salt.utils.jid.format_jid_instance(jid, s...
def get_jids(): ''' Return a list of all job ids ''' conn = _get_conn(ret=None) cur = conn.cursor() sql = '''SELECT distinct jid, load FROM jids''' cur.execute(sql) data = cur.fetchall() ret = {} for jid, load in data: ret[jid] = salt.utils.jid.format_jid_instance(jid, s...
[ "Return", "a", "list", "of", "all", "job", "ids" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/odbc.py#L291-L305
[ "def", "get_jids", "(", ")", ":", "conn", "=", "_get_conn", "(", "ret", "=", "None", ")", "cur", "=", "conn", ".", "cursor", "(", ")", "sql", "=", "'''SELECT distinct jid, load FROM jids'''", "cur", ".", "execute", "(", "sql", ")", "data", "=", "cur", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_load_config
Loads and parses /usbkey/config
salt/states/smartos.py
def _load_config(): ''' Loads and parses /usbkey/config ''' config = {} if os.path.isfile('/usbkey/config'): with salt.utils.files.fopen('/usbkey/config', 'r') as config_file: for optval in config_file: optval = salt.utils.stringutils.to_unicode(optval) ...
def _load_config(): ''' Loads and parses /usbkey/config ''' config = {} if os.path.isfile('/usbkey/config'): with salt.utils.files.fopen('/usbkey/config', 'r') as config_file: for optval in config_file: optval = salt.utils.stringutils.to_unicode(optval) ...
[ "Loads", "and", "parses", "/", "usbkey", "/", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L185-L202
[ "def", "_load_config", "(", ")", ":", "config", "=", "{", "}", "if", "os", ".", "path", ".", "isfile", "(", "'/usbkey/config'", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "'/usbkey/config'", ",", "'r'", ")", "as", "confi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_write_config
writes /usbkey/config
salt/states/smartos.py
def _write_config(config): ''' writes /usbkey/config ''' try: with salt.utils.atomicfile.atomic_open('/usbkey/config', 'w') as config_file: config_file.write("#\n# This file was generated by salt\n#\n") for prop in salt.utils.odict.OrderedDict(sorted(config.items())): ...
def _write_config(config): ''' writes /usbkey/config ''' try: with salt.utils.atomicfile.atomic_open('/usbkey/config', 'w') as config_file: config_file.write("#\n# This file was generated by salt\n#\n") for prop in salt.utils.odict.OrderedDict(sorted(config.items())): ...
[ "writes", "/", "usbkey", "/", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L205-L225
[ "def", "_write_config", "(", "config", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "atomicfile", ".", "atomic_open", "(", "'/usbkey/config'", ",", "'w'", ")", "as", "config_file", ":", "config_file", ".", "write", "(", "\"#\\n# This file was gener...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_vmconfig
Parse vm_present vm config
salt/states/smartos.py
def _parse_vmconfig(config, instances): ''' Parse vm_present vm config ''' vmconfig = None if isinstance(config, (salt.utils.odict.OrderedDict)): vmconfig = salt.utils.odict.OrderedDict() for prop in config: if prop not in instances: vmconfig[prop] = conf...
def _parse_vmconfig(config, instances): ''' Parse vm_present vm config ''' vmconfig = None if isinstance(config, (salt.utils.odict.OrderedDict)): vmconfig = salt.utils.odict.OrderedDict() for prop in config: if prop not in instances: vmconfig[prop] = conf...
[ "Parse", "vm_present", "vm", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L228-L253
[ "def", "_parse_vmconfig", "(", "config", ",", "instances", ")", ":", "vmconfig", "=", "None", "if", "isinstance", "(", "config", ",", "(", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", ")", ")", ":", "vmconfig", "=", "salt", ".", "utils", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_instance_changes
get modified properties
salt/states/smartos.py
def _get_instance_changes(current, state): ''' get modified properties ''' # get keys current_keys = set(current.keys()) state_keys = set(state.keys()) # compare configs changed = salt.utils.data.compare_dicts(current, state) for change in salt.utils.data.compare_dicts(current, stat...
def _get_instance_changes(current, state): ''' get modified properties ''' # get keys current_keys = set(current.keys()) state_keys = set(state.keys()) # compare configs changed = salt.utils.data.compare_dicts(current, state) for change in salt.utils.data.compare_dicts(current, stat...
[ "get", "modified", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L256-L272
[ "def", "_get_instance_changes", "(", "current", ",", "state", ")", ":", "# get keys", "current_keys", "=", "set", "(", "current", ".", "keys", "(", ")", ")", "state_keys", "=", "set", "(", "state", ".", "keys", "(", ")", ")", "# compare configs", "changed"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
config_present
Ensure configuration property is set to value in /usbkey/config name : string name of property value : string value of property
salt/states/smartos.py
def config_present(name, value): ''' Ensure configuration property is set to value in /usbkey/config name : string name of property value : string value of property ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, ...
def config_present(name, value): ''' Ensure configuration property is set to value in /usbkey/config name : string name of property value : string value of property ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, ...
[ "Ensure", "configuration", "property", "is", "set", "to", "value", "in", "/", "usbkey", "/", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L329-L376
[ "def", "config_present", "(", "name", ",", "value", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "#...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
config_absent
Ensure configuration property is absent in /usbkey/config name : string name of property
salt/states/smartos.py
def config_absent(name): ''' Ensure configuration property is absent in /usbkey/config name : string name of property ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} # load configuration config = _load...
def config_absent(name): ''' Ensure configuration property is absent in /usbkey/config name : string name of property ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} # load configuration config = _load...
[ "Ensure", "configuration", "property", "is", "absent", "in", "/", "usbkey", "/", "config" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L379-L411
[ "def", "config_absent", "(", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "# load configuration...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
source_present
Ensure an image source is present on the computenode name : string source url source_type : string source type (imgapi or docker)
salt/states/smartos.py
def source_present(name, source_type='imgapi'): ''' Ensure an image source is present on the computenode name : string source url source_type : string source type (imgapi or docker) ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment...
def source_present(name, source_type='imgapi'): ''' Ensure an image source is present on the computenode name : string source url source_type : string source type (imgapi or docker) ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment...
[ "Ensure", "an", "image", "source", "is", "present", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L414-L449
[ "def", "source_present", "(", "name", ",", "source_type", "=", "'imgapi'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "name", "in", "__salt_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
source_absent
Ensure an image source is absent on the computenode name : string source url
salt/states/smartos.py
def source_absent(name): ''' Ensure an image source is absent on the computenode name : string source url ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if name not in __salt__['imgadm.sources'](): # source is absent ...
def source_absent(name): ''' Ensure an image source is absent on the computenode name : string source url ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if name not in __salt__['imgadm.sources'](): # source is absent ...
[ "Ensure", "an", "image", "source", "is", "absent", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L452-L485
[ "def", "source_absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "name", "not", "in", "__salt__", "[", "'imgadm.sources'", "]...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
image_present
Ensure image is present on the computenode name : string uuid of image
salt/states/smartos.py
def image_present(name): ''' Ensure image is present on the computenode name : string uuid of image ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if _is_docker_uuid(name) and __salt__['imgadm.docker_to_uuid'](name): # do...
def image_present(name): ''' Ensure image is present on the computenode name : string uuid of image ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if _is_docker_uuid(name) and __salt__['imgadm.docker_to_uuid'](name): # do...
[ "Ensure", "image", "is", "present", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L488-L542
[ "def", "image_present", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "_is_docker_uuid", "(", "name", ")", "and", "__salt__", "[",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
image_absent
Ensure image is absent on the computenode name : string uuid of image .. note:: computenode.image_absent will only remove the image if it is not used by a vm.
salt/states/smartos.py
def image_absent(name): ''' Ensure image is absent on the computenode name : string uuid of image .. note:: computenode.image_absent will only remove the image if it is not used by a vm. ''' ret = {'name': name, 'changes': {}, 'result': None, ...
def image_absent(name): ''' Ensure image is absent on the computenode name : string uuid of image .. note:: computenode.image_absent will only remove the image if it is not used by a vm. ''' ret = {'name': name, 'changes': {}, 'result': None, ...
[ "Ensure", "image", "is", "absent", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L545-L604
[ "def", "image_absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "uuid", "=", "None", "if", "_is_uuid", "(", "name", ")", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
image_vacuum
Delete images not in use or installed via image_present .. warning:: Only image_present states that are included via the top file will be detected.
salt/states/smartos.py
def image_vacuum(name): ''' Delete images not in use or installed via image_present .. warning:: Only image_present states that are included via the top file will be detected. ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, ...
def image_vacuum(name): ''' Delete images not in use or installed via image_present .. warning:: Only image_present states that are included via the top file will be detected. ''' name = name.lower() ret = {'name': name, 'changes': {}, 'result': None, ...
[ "Delete", "images", "not", "in", "use", "or", "installed", "via", "image_present" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L607-L685
[ "def", "image_vacuum", "(", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "# list of images to k...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vm_present
Ensure vm is present on the computenode name : string hostname of vm vmconfig : dict options to set for the vm config : dict fine grain control over vm_present .. note:: The following configuration properties can be toggled in the config parameter. - kvm_rebo...
salt/states/smartos.py
def vm_present(name, vmconfig, config=None): ''' Ensure vm is present on the computenode name : string hostname of vm vmconfig : dict options to set for the vm config : dict fine grain control over vm_present .. note:: The following configuration properties can...
def vm_present(name, vmconfig, config=None): ''' Ensure vm is present on the computenode name : string hostname of vm vmconfig : dict options to set for the vm config : dict fine grain control over vm_present .. note:: The following configuration properties can...
[ "Ensure", "vm", "is", "present", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L688-L1120
[ "def", "vm_present", "(", "name", ",", "vmconfig", ",", "config", "=", "None", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'co...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vm_absent
Ensure vm is absent on the computenode name : string hostname of vm archive : boolean toggle archiving of vm on removal .. note:: State ID is used as hostname. Hostnames must be unique.
salt/states/smartos.py
def vm_absent(name, archive=False): ''' Ensure vm is absent on the computenode name : string hostname of vm archive : boolean toggle archiving of vm on removal .. note:: State ID is used as hostname. Hostnames must be unique. ''' name = name.lower() ret = {'na...
def vm_absent(name, archive=False): ''' Ensure vm is absent on the computenode name : string hostname of vm archive : boolean toggle archiving of vm on removal .. note:: State ID is used as hostname. Hostnames must be unique. ''' name = name.lower() ret = {'na...
[ "Ensure", "vm", "is", "absent", "on", "the", "computenode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smartos.py#L1123-L1165
[ "def", "vm_absent", "(", "name", ",", "archive", "=", "False", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46