Comments (6)
Same here.
With version 2.0.0.2 (Ubuntu 16.04):
TASK [Set general localconfig options] *****************************************
ok: [zmadm1.example.com] => (item={'value': u'no', 'key': u'smtp_notify'})
With version 2.1.0.0 (PPA):
failed: [zmadm1.example.com] (item={'value': u'no', 'key': u'smtp_notify'}) => {"failed": true, "item": {"key": "smtp_notify", "value": "no"}, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_M9m9a4/ansible_module_xml.py\", line 410, in <module>\r\n main()\r\n File \"/tmp/ansible_M9m9a4/ansible_module_xml.py\", line 406, in main\r\n set_target(x, xpath, namespaces, attribute, value, module)\r\n File \"/tmp/ansible_M9m9a4/ansible_module_xml.py\", line 223, in set_target\r\n if not is_node(tree, xpath, namespaces):\r\n File \"/tmp/ansible_M9m9a4/ansible_module_xml.py\", line 134, in is_node\r\n if xpath_matches(tree, xpath, namespaces):\r\n File \"/tmp/ansible_M9m9a4/ansible_module_xml.py\", line 154, in xpath_matches\r\n if tree.xpath(xpath, namespaces=namespaces):\r\n File \"lxml.etree.pyx\", line 2091, in lxml.etree._ElementTree.xpath (src/lxml/lxml.etree.c:53358)\r\n File \"xpath.pxi\", line 342, in lxml.etree.XPathDocumentEvaluator.__init__ (src/lxml/lxml.etree.c:133440)\r\n File \"xpath.pxi\", line 276, in lxml.etree.XPathElementEvaluator.__init__ (src/lxml/lxml.etree.c:132591)\r\n File \"xpath.pxi\", line 148, in lxml.etree._XPathEvaluatorBase.__init__ (src/lxml/lxml.etree.c:131208)\r\n File \"xpath.pxi\", line 57, in lxml.etree._XPathContext.__init__ (src/lxml/lxml.etree.c:130211)\r\n File \"extensions.pxi\", line 82, in lxml.etree._BaseContext.__init__ (src/lxml/lxml.etree.c:121254)\r\nValueError: need more than 1 value to unpack\r\n", "msg": "MODULE FAILURE", "parsed": false}
The tasks:
- name: Ensure python-lxml is installed
yum:
name: "python-lxml"
state: present
- name: Register localconfig state
stat:
path: "/opt/zimbra/conf/localconfig.xml"
register: zimbra_localconfig_stat
- name: Set general localconfig options
xml:
file: "/opt/zimbra/conf/localconfig.xml"
xpath: "/localconfig/key[@name='{{item.key}}']/value"
value: "{{item.value}}"
with_dict: "{{zimbra_localconfig}}"
when:
zimbra_localconfig_stat.stat.exists
And vars:
zimbra_localconfig:
smtp_notify: "no"
There are actually more than a single var, I stripped it down. Also, it seems like it fails on some hosts and works on others which is especially puzzling.
from ansible-xml.
The patch from @h0nIg's branch which was 72864f at some point but got rebased by now fixes the issue for me.
@h0nIg maybe you could create an extra branch and pull request just for this issue?
from ansible-xml.
just checkout 38b84e1
from ansible-xml.
I hope @cmprescott is more likely to merge your fix if it is submitted as a separate pull request instead of a devel_misc
branch.
from ansible-xml.
@mss - you read my mind.
@h0nIg - Do you mind separating out the fix from the new features?
from ansible-xml.
I cherry picked the fix into #66.
from ansible-xml.
Related Issues (20)
- '_ElementStringResult' object has no attribute 'attrname' HOT 2
- Older lxml versions have no predictable element attribute order HOT 1
- Fails on python3 due to unicode-related errors HOT 1
- How to create multiple nodes? HOT 8
- Feature idea: Add 'namespace catch' in issue_template.md HOT 8
- xpath is not a legal parameter in an Ansible task or handler HOT 1
- winrm send_input failed HOT 2
- Out-of sync with upstream
- No idempotency when combining namespace and set_children HOT 3
- Do we need an "issue template" HOT 5
- comprescott.xm fails with centos user HOT 1
- deliverable package HOT 3
- Update "xml:base" attribute HOT 4
- Convert xml file to yaml file using java
- Get entire xml node HOT 1
- add_children before other element HOT 6
- Make this repo readonly? HOT 2
- Add_children in an XML file is not working HOT 2
- How to assign mulity attribute value in xml node
- Ansible: Custom Tag field of a Dictionary. Error: Invalid tag name '}'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-xml.