-
Notifications
You must be signed in to change notification settings - Fork 64
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
"Xpath /settings/setting[@id="setting.key"]/@value does not reference a node!" when trying to set an attribute value #15
Comments
I'm also having the issue described above when trying to set a value for an attribute. After peaking at the code it doesn't seem to account for changing an attribute? |
Any solutions to this? |
I also come here with intention fill bug...
Please note few thing there:
|
I'll use this issue to track updating the documentation's clarity concerning this. |
The xml module is upstream now (and ships with Ansible v2.4). Please close this issue, and retest against the new upstream xml module. If needed, open a new issue at: https://github.com/ansible/ansible/issues |
@Hubbitus Are you willing to create a PR for this at: https://github.com/ansible/ansible ? I just verified the same thing. This does not work: [dag@moria ansible.git]$ ansible -m xml --diff -a 'xpath=/settings/setting[@id="setting.key"]/@value value=true file=/tmp/test.xml ' -C localhost
localhost | FAILED! => {
"changed": false,
"failed": true,
"msg": "Xpath /settings/setting[@id=\"setting.key\"]/@value does not reference a node! tree is <settings>\n <setting id=\"setting.key\" value=\"\"/>\n</settings>\n"
}
[dag@moria ansible.git]$ ansible -m xml --diff -a 'xpath=/settings/setting[@id="setting.key"]/@value attribute=value value=true file=/tmp/test.xml' -C localhost
localhost | FAILED! => {
"changed": false,
"failed": true,
"msg": "Xpath /settings/setting[@id=\"setting.key\"]/@value does not reference a node! tree is <settings>\n <setting id=\"setting.key\" value=\"\"/>\n</settings>\n"
} But this works fine: [dag@moria ansible.git]$ ansible -m xml --diff -a 'xpath=/settings/setting[@id="setting.key"] attribute=value value=true file=/tmp/test.xml' -C localhost
--- before
+++ after
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<settings>
- <setting id="setting.key" value="false"/>
+ <setting id="setting.key" value="true"/>
</settings>
localhost | SUCCESS => {
"actions": {
"namespaces": {},
"state": "present",
"xpath": "/settings/setting[@id=\"setting.key\"]"
},
"changed": true,
"failed": false,
} |
I have updated the documentation. Setting attribute values using xpath only would be very useful, but is a feature request. We are welcoming anyone who can do this. |
Give this Ansible task:
and this remote XML file:
I get this error:
The documentation (through showing how to remove an attribute) suggests that I should be able to alter an attribute's value. Am I doing something wrong?
The text was updated successfully, but these errors were encountered: