Only process ADMX files when loading policies

This commit is contained in:
twangboy 2020-03-04 18:13:37 -07:00
parent 2d78931eaf
commit 547d35cf4c
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -4986,6 +4986,10 @@ def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
for root, dirs, files in salt.utils.path.os_walk(path):
if root == path:
for t_admx_file in files:
admx_file_name, admx_file_ext = os.path.splitext(t_admx_file)
if not admx_file_ext == '.admx':
log.debug('{0} is not an ADMX file'.format(t_admx_file))
continue
admx_file = os.path.join(root, t_admx_file)
# Parse xml for the ADMX file
try:
@ -5038,7 +5042,7 @@ def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
adml_file = os.path.join(
root,
language,
os.path.splitext(t_admx_file)[0] + '.adml')
admx_file_name + '.adml')
if not __salt__['file.file_exists'](adml_file):
log.info('An ADML file in the specified ADML language '
'"%s" does not exist for the ADMX "%s", the '
@ -5048,7 +5052,7 @@ def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
adml_file = os.path.join(
root,
language.split('-')[0],
os.path.splitext(t_admx_file)[0] + '.adml')
admx_file_name + '.adml')
if not __salt__['file.file_exists'](adml_file):
log.info('An ADML file in the specified ADML language '
'code %s does not exist for the ADMX "%s", '
@ -5058,7 +5062,7 @@ def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
adml_file = os.path.join(
root,
display_language_fallback,
os.path.splitext(t_admx_file)[0] + '.adml')
admx_file_name + '.adml')
if not __salt__['file.file_exists'](adml_file):
log.info('An ADML file in the specified ADML '
'fallback language "%s" '
@ -5070,7 +5074,7 @@ def _load_policy_definitions(path='c:\\Windows\\PolicyDefinitions',
adml_file = os.path.join(
root,
display_language_fallback.split('-')[0],
os.path.splitext(t_admx_file)[0] + '.adml')
admx_file_name + '.adml')
if not __salt__['file.file_exists'](adml_file):
msg = ('An ADML file in the specified ADML language '
'"{0}" and the fallback language "{1}" do not '