mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Display conflicing policy names in error message
When conflicting policies are found display possible long names in the output message
This commit is contained in:
parent
284f4d10b3
commit
550b417d5c
3 changed files with 34 additions and 1 deletions
1
changelog/62594.fixed
Normal file
1
changelog/62594.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
win_lgpo: Display conflicting policy names when more than one policy is found
|
|
@ -8427,7 +8427,25 @@ def _lookup_admin_template(policy_name, policy_class, adml_language="en-US"):
|
|||
policy_aliases.append("\\".join(full_path_list))
|
||||
return True, the_policy, policy_aliases, None
|
||||
else:
|
||||
msg = 'ADMX policy name/id "{}" is used in multiple ADMX files'
|
||||
policy_aliases = []
|
||||
for the_policy in admx_search_results:
|
||||
policy_display_name = _getFullPolicyName(
|
||||
policy_item=the_policy,
|
||||
policy_name=the_policy.attrib["name"],
|
||||
return_full_policy_names=True,
|
||||
adml_language=adml_language,
|
||||
)
|
||||
full_path_list = _build_parent_list(
|
||||
policy_definition=the_policy,
|
||||
return_full_policy_names=True,
|
||||
adml_language=adml_language,
|
||||
)
|
||||
full_path_list.append(policy_display_name)
|
||||
policy_aliases.append("\\".join(full_path_list))
|
||||
policies = "\n - ".join(policy_aliases)
|
||||
msg = 'ADMX policy name/id "{}" is used in multiple ADMX files.\n' \
|
||||
"Try one of the following names:\n" \
|
||||
" - {}".format(policy_name, policies)
|
||||
return False, None, [], msg
|
||||
else:
|
||||
adml_search_results = ADML_SEARCH_XPATH(
|
||||
|
|
|
@ -32,3 +32,17 @@ def test_62058_whitespace(lgpo):
|
|||
)
|
||||
return
|
||||
assert False
|
||||
|
||||
|
||||
def test_62594(lgpo):
|
||||
expected = (
|
||||
'ADMX policy name/id "Pol_CipherSuiteOrder" is used in multiple ADMX files.\n'
|
||||
"Try one of the following names:\n"
|
||||
" - Lanman Server\\Network\\Cipher suite order\n"
|
||||
" - Lanman Workstation\\Network\\Cipher suite order"
|
||||
)
|
||||
result = lgpo.get_policy_info(
|
||||
policy_name="Pol_CipherSuiteOrder",
|
||||
policy_class="machine",
|
||||
)
|
||||
assert result["message"] == expected
|
||||
|
|
Loading…
Add table
Reference in a new issue