mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
update adml text search to use 'starts-with' as some policies text has trailing spaces (#39090)
This commit is contained in:
parent
9dccb9fbe3
commit
8a00ecfb79
1 changed files with 4 additions and 1 deletions
|
@ -104,7 +104,7 @@ try:
|
|||
VALUE_LIST_XPATH = etree.XPath('.//*[local-name() = "valueList"]')
|
||||
ENUM_ITEM_DISPLAY_NAME_XPATH = etree.XPath('.//*[local-name() = "item" and @*[local-name() = "displayName" = $display_name]]')
|
||||
ADMX_SEARCH_XPATH = etree.XPath('//*[local-name() = "policy" and @*[local-name() = "name"] = $policy_name and (@*[local-name() = "class"] = "Both" or @*[local-name() = "class"] = $registry_class)]')
|
||||
ADML_SEARCH_XPATH = etree.XPath('//*[text() = $policy_name and @*[local-name() = "id"]]')
|
||||
ADML_SEARCH_XPATH = etree.XPath('//*[starts-with(text(), $policy_name) and @*[local-name() = "id"]]')
|
||||
ADMX_DISPLAYNAME_SEARCH_XPATH = etree.XPath('//*[local-name() = "policy" and @*[local-name() = "displayName"] = $display_name and (@*[local-name() = "class"] = "Both" or @*[local-name() = "class"] = $registry_class) ]')
|
||||
PRESENTATION_ANCESTOR_XPATH = etree.XPath('ancestor::*[local-name() = "presentation"]')
|
||||
TEXT_ELEMENT_XPATH = etree.XPath('.//*[local-name() = "text"]')
|
||||
|
@ -3857,6 +3857,9 @@ def _lookup_admin_template(policy_name,
|
|||
suggested_policies = ''
|
||||
if len(adml_search_results) > 1:
|
||||
multiple_adml_entries = True
|
||||
for adml_search_result in adml_search_results:
|
||||
if not adml_search_result.attrib['text'].strip() == policy_name:
|
||||
adml_search_results.remove(adml_search_result)
|
||||
for adml_search_result in adml_search_results:
|
||||
dmsg = 'found an adml entry matching the string! {0} -- {1}'
|
||||
log.debug(dmsg.format(adml_search_result.tag,
|
||||
|
|
Loading…
Add table
Reference in a new issue