mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Merge pull request #50969 from twangboy/fix_lgpo
Fix issue with LGPO when returning empty dict
This commit is contained in:
commit
4faa4b9c74
@ -114,7 +114,6 @@ import salt.utils.json
|
||||
|
||||
# Import 3rd party libs
|
||||
from salt.ext import six
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
__virtualname__ = 'lgpo'
|
||||
@ -251,14 +250,20 @@ 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
|
||||
# Check Case sensitive first (faster)
|
||||
if policy_name in current_policy[policy_data['output_section']]:
|
||||
currently_set = True
|
||||
pol_id = policy_name
|
||||
# Check case insensitive
|
||||
elif policy_name.lower() in (k.lower() for k in current_policy[policy_data['output_section']]):
|
||||
for p_name in current_policy[policy_data['output_section']]:
|
||||
if policy_name.lower() == p_name.lower():
|
||||
currently_set = True
|
||||
pol_id = p_name
|
||||
break
|
||||
# Check aliases
|
||||
else:
|
||||
for alias in policy_data['policy_lookup'][policy_name]['policy_aliases']:
|
||||
log.debug('checking alias %s', alias)
|
||||
|
Loading…
Reference in New Issue
Block a user