mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-11 20:24:14 +00:00
[PR #12013/abef8f2a backport][stable-12] xml: fix print_match not populating matches return value (#12021)
xml: fix `print_match` not populating `matches` return value (#12013)
* fix(xml): populate matches when print_match is set, fix returned doc
* test(xml): add integration tests for print_match
* changelog: add fragment for PR 12013
---------
(cherry picked from commit abef8f2aed)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b1d88ae3c1
commit
bb539f1d56
4 changed files with 43 additions and 2 deletions
|
|
@ -348,7 +348,7 @@ count:
|
|||
matches:
|
||||
description: The xpath matches found.
|
||||
type: list
|
||||
returned: when parameter O(print_match) is set
|
||||
returned: when parameter O(print_match) is set, or when parameter O(content) is set
|
||||
xmlstring:
|
||||
description: An XML string of the resulting output.
|
||||
type: str
|
||||
|
|
@ -405,7 +405,7 @@ def do_print_match(module, tree, xpath, namespaces):
|
|||
match_xpaths.append(tree.getpath(m))
|
||||
match_str = json.dumps(match_xpaths)
|
||||
msg = f"selector '{xpath}' match: {match_str}"
|
||||
finish(module, tree, xpath, namespaces, changed=False, msg=msg)
|
||||
finish(module, tree, xpath, namespaces, changed=False, msg=msg, matches=match_xpaths)
|
||||
|
||||
|
||||
def count_nodes(module, tree, xpath, namespaces):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue