mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
check if a policy has either an enabled value or enabled list entry or
a disabled value or disabled list entry when determining the state of the policy Some policies have one but not the other (in which case different entries in the registry.pol file are added for 'Enabled' or 'Disabled'). A partial fix for this was previously added, but did not check for all possible types when trying to determine if the policy is enabled/disabled and also did not perform the same check in the enabled/disabled list checks. This would result in some policies being reported by the module as Enabled even though they were disabled (for example "Windows Components\Internet Explorer\Make proxy settings per-machine (rather than per-user)" if set to 'Disabled' would report 'Enabled')
This commit is contained in:
parent
b14e974b5f
commit
4902f1e2ba
1 changed files with 14 additions and 12 deletions
|
@ -3679,7 +3679,7 @@ def _checkAllAdmxPolicies(policy_class,
|
|||
if ENABLED_VALUE_XPATH(admx_policy) and this_policy_setting == 'Not Configured':
|
||||
# some policies have a disabled list but not an enabled list
|
||||
# added this to address those issues
|
||||
if DISABLED_LIST_XPATH(admx_policy):
|
||||
if DISABLED_LIST_XPATH(admx_policy) or DISABLED_VALUE_XPATH(admx_policy):
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if _checkValueItemParent(admx_policy,
|
||||
|
@ -3689,14 +3689,14 @@ def _checkAllAdmxPolicies(policy_class,
|
|||
ENABLED_VALUE_XPATH,
|
||||
policy_filedata):
|
||||
this_policy_setting = 'Enabled'
|
||||
log.debug('{0} is enabled'.format(this_policyname))
|
||||
log.debug('{0} is enabled by detected ENABLED_VALUE_XPATH'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
if DISABLED_VALUE_XPATH(admx_policy) and this_policy_setting == 'Not Configured':
|
||||
# some policies have a disabled list but not an enabled list
|
||||
# added this to address those issues
|
||||
if ENABLED_LIST_XPATH(admx_policy):
|
||||
if ENABLED_LIST_XPATH(admx_policy) or ENABLED_VALUE_XPATH(admx_policy):
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if _checkValueItemParent(admx_policy,
|
||||
|
@ -3706,25 +3706,27 @@ def _checkAllAdmxPolicies(policy_class,
|
|||
DISABLED_VALUE_XPATH,
|
||||
policy_filedata):
|
||||
this_policy_setting = 'Disabled'
|
||||
log.debug('{0} is disabled'.format(this_policyname))
|
||||
log.debug('{0} is disabled by detected DISABLED_VALUE_XPATH'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
if ENABLED_LIST_XPATH(admx_policy) and this_policy_setting == 'Not Configured':
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if DISABLED_LIST_XPATH(admx_policy) or DISABLED_VALUE_XPATH(admx_policy):
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if _checkListItem(admx_policy, this_policyname, this_key, ENABLED_LIST_XPATH, policy_filedata):
|
||||
this_policy_setting = 'Enabled'
|
||||
log.debug('{0} is enabled'.format(this_policyname))
|
||||
log.debug('{0} is enabled by detected ENABLED_LIST_XPATH'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
if DISABLED_LIST_XPATH(admx_policy) and this_policy_setting == 'Not Configured':
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if ENABLED_LIST_XPATH(admx_policy) or ENABLED_VALUE_XPATH(admx_policy):
|
||||
element_only_enabled_disabled = False
|
||||
explicit_enable_disable_value_setting = True
|
||||
if _checkListItem(admx_policy, this_policyname, this_key, DISABLED_LIST_XPATH, policy_filedata):
|
||||
this_policy_setting = 'Disabled'
|
||||
log.debug('{0} is disabled'.format(this_policyname))
|
||||
log.debug('{0} is disabled by detected DISABLED_LIST_XPATH'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
|
@ -3739,7 +3741,7 @@ def _checkAllAdmxPolicies(policy_class,
|
|||
'1')),
|
||||
policy_filedata):
|
||||
this_policy_setting = 'Enabled'
|
||||
log.debug('{0} is enabled'.format(this_policyname))
|
||||
log.debug('{0} is enabled by no explicit enable/disable list or value'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
|
@ -3750,7 +3752,7 @@ def _checkAllAdmxPolicies(policy_class,
|
|||
check_deleted=True)),
|
||||
policy_filedata):
|
||||
this_policy_setting = 'Disabled'
|
||||
log.debug('{0} is disabled'.format(this_policyname))
|
||||
log.debug('{0} is disabled by no explicit enable/disable list or value'.format(this_policyname))
|
||||
if this_policynamespace not in policy_vals:
|
||||
policy_vals[this_policynamespace] = {}
|
||||
policy_vals[this_policynamespace][this_policyname] = this_policy_setting
|
||||
|
|
Loading…
Add table
Reference in a new issue