From 7376cb9151a12adcdcbfe8d8d1c7cbf817863c4b Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 12 Feb 2019 14:38:20 -0700 Subject: [PATCH] Handle explicit lists properly --- salt/modules/win_lgpo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/salt/modules/win_lgpo.py b/salt/modules/win_lgpo.py index 3c469dc833..28a9fea37c 100644 --- a/salt/modules/win_lgpo.py +++ b/salt/modules/win_lgpo.py @@ -5605,7 +5605,7 @@ def _getDataFromRegPolData(search_string, policy_data, return_value_name=False): ) ].split(encoded_semicolon) if len(pol_entry) >= 2: - valueName = pol_entry[1] + valueName = pol_entry[1].decode('utf-16-le').rstrip(chr(0)) if len(pol_entry) >= 5: value = pol_entry[4] if vtype == 'REG_DWORD' or vtype == 'REG_QWORD': @@ -5923,18 +5923,18 @@ def _processValueItem(element, reg_key, reg_valuename, policy, parent_element, ']'.encode('utf-16-le')]) if 'expandable' in element.attrib: this_vtype = 'REG_EXPAND_SZ' - if 'explicitValue' in element.attrib and element.attrib['explicitValue'].lower() == 'true': + if element.attrib.get('explicitValue', 'false').lower() == 'true': if this_element_value is not None: - element_valuenames = this_element_value.keys() - element_values = this_element_value.values() - if 'valuePrefix' in element.attrib: + element_valuenames = [str(k) for k in this_element_value.keys()] + element_values = [str(v) for v in this_element_value.values()] + elif 'valuePrefix' in element.attrib: # if the valuePrefix attribute exists, the valuenames are # most prefixes attributes are empty in the admx files, so the valuenames # end up being just numbers if element.attrib['valuePrefix'] != '': if this_element_value is not None: - element_valuenames = ['{0}{1}'.format(element.attrib['valuePrefix'], - k) for k in element_valuenames] + element_valuenames = ['{0}{1}'.format( + element.attrib['valuePrefix'], k) for k in element_valuenames] else: # if there is no valuePrefix attribute, the valuename is the value if element_values is not None: