New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xml module: Error w/ valid Xpath #29078
Comments
This is a common mistake. There's XML namespace set in your XML document: |
worked! Thanks @sm4rk0 |
BTW, @dagwieers - this bug report reveals three things. (Should I open a new issue(s) for them?) First is a need for specific error message in case of XPath exceptions due to the missing namespace argument (I'm adding this as an idea to the Module wiki). Second is missing try block around a call to def xpath_matches(tree, xpath, namespaces):
""" Test if a node exists """
if tree.xpath(xpath, namespaces=namespaces):
return True
return False Third is a bug in exception handling introduced by this commit prior to module upstreaming. This is the solution that should work (not tested). Here's the formatted
|
@sm4rk0 Please open issues for everything you consider needs a discussion, and PRs for everything you'd like to see changed. And thanks again for your help. |
ISSUE TYPE
COMPONENT NAME
XML Module
ANSIBLE VERSION
CONFIGURATION
[defaults]
inventory = ./hosts
roles_path = ~/.ansible/roles:../
ansible_python_interpreter = python2
OS / ENVIRONMENT
OSX running ansible against a ArchLinux VM
SUMMARY
Getting invalid XPath
STEPS TO REPRODUCE
I want to set the value of the xml tag to 3. XML file looks like this
EXPECTED RESULTS
Expected the value changed from 4 to 3
ACTUAL RESULTS
getting this error
The text was updated successfully, but these errors were encountered: