From 85649876d0abdba679585552f89d4cf66cea7520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Stankovi=C4=87?= Date: Fri, 15 Sep 2017 11:00:04 +0200 Subject: [PATCH] Add a note about the limitations of a namespace check --- lib/ansible/modules/files/xml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/files/xml.py b/lib/ansible/modules/files/xml.py index 389a87b052..933371fce3 100644 --- a/lib/ansible/modules/files/xml.py +++ b/lib/ansible/modules/files/xml.py @@ -546,6 +546,8 @@ def set_target_inner(module, tree, xpath, namespaces, attribute, value): changed = check_or_make_target(module, tree, xpath, namespaces) except Exception as e: missing_namespace = "" + # NOTE: This checks only the namespaces defined in root element! + # TODO: Implement a more robust check to check for child namespaces' existance if len(tree.getroot().nsmap) > 0 and ":" not in xpath: missing_namespace = "XML document has namespace(s) defined, but no namespace prefix(es) used in xpath!\n" module.fail_json(msg="%sXpath %s causes a failure: %s\n -- tree is %s" %