Coder Social home page Coder Social logo

Errors with ansible 2.1 about ansible-xml HOT 6 CLOSED

cmprescott avatar cmprescott commented on July 29, 2024
Errors with ansible 2.1

from ansible-xml.

Comments (6)

mss avatar mss commented on July 29, 2024

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.

mss avatar mss commented on July 29, 2024

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.

h0nIg avatar h0nIg commented on July 29, 2024

just checkout 38b84e1

from ansible-xml.

mss avatar mss commented on July 29, 2024

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.

cmprescott avatar cmprescott commented on July 29, 2024

@mss - you read my mind.

@h0nIg - Do you mind separating out the fix from the new features?

from ansible-xml.

mss avatar mss commented on July 29, 2024

I cherry picked the fix into #66.

from ansible-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.