mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-18 16:31:26 -07:00
* Fix xml reports changed when node is not deleted
* Added changelog fragment
* Added tests for xml no change remove
* Added PR to changeling fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 0243eabd30
)
Co-authored-by: mklassen <lmklassen@gmail.com>
This commit is contained in:
parent
572e3f0814
commit
e4d3d24b26
8 changed files with 131 additions and 2 deletions
|
@ -411,8 +411,10 @@ def xpath_matches(tree, xpath, namespaces):
|
|||
|
||||
def delete_xpath_target(module, tree, xpath, namespaces):
|
||||
""" Delete an attribute or element from a tree """
|
||||
changed = False
|
||||
try:
|
||||
for result in tree.xpath(xpath, namespaces=namespaces):
|
||||
changed = True
|
||||
# Get the xpath for this result
|
||||
if is_attribute(tree, xpath, namespaces):
|
||||
# Delete an attribute
|
||||
|
@ -429,7 +431,7 @@ def delete_xpath_target(module, tree, xpath, namespaces):
|
|||
except Exception as e:
|
||||
module.fail_json(msg="Couldn't delete xpath target: %s (%s)" % (xpath, e))
|
||||
else:
|
||||
finish(module, tree, xpath, namespaces, changed=True)
|
||||
finish(module, tree, xpath, namespaces, changed=changed)
|
||||
|
||||
|
||||
def replace_children_of(children, match):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue