Fix issues with lgpo state and util

Fix py3 issues in win_lgpo_netsh
Make the state case insensitive for policy lookups
This commit is contained in:
twangboy 2018-12-11 16:49:39 -07:00
parent a8ad17aaa4
commit 56c0e55581
No known key found for this signature in database
GPG Key ID: 93FF3BDEB278C9EB
2 changed files with 5 additions and 1 deletions

View File

@ -114,6 +114,7 @@ import salt.utils.json
# Import 3rd party libs
from salt.ext import six
from requests.structures import CaseInsensitiveDict
log = logging.getLogger(__name__)
__virtualname__ = 'lgpo'
@ -250,6 +251,9 @@ def set_(name,
for policy_section, policy_data in six.iteritems(pol_data):
pol_id = None
if policy_data and policy_data['output_section'] in current_policy:
# Make the subdict keys case insensitive
current_policy[policy_data['output_section']] = CaseInsensitiveDict(
current_policy[policy_data['output_section']])
for policy_name, policy_setting in six.iteritems(policy_data['requested_policy']):
currently_set = False
if policy_name in current_policy[policy_data['output_section']]:

View File

@ -196,7 +196,7 @@ def get_settings(profile, section, store='local'):
ret = {}
# Skip the first 2 lines. Add everything else to a dictionary
for line in results[3:]:
ret.update(dict(map(None, *[iter(re.split(r"\s{2,}", line))]*2))) # pylint: disable=incompatible-py3-code
ret.update(dict(zip(*[iter(re.split(r"\s{2,}", line))]*2)))
# Remove spaces from the values so that `Not Configured` is detected
# correctly