Skip to content
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

'_ElementStringResult' object has no attribute 'attrname' #114

Closed
dagwieers opened this issue Jun 7, 2017 · 2 comments · Fixed by ansible/ansible#25323
Closed

'_ElementStringResult' object has no attribute 'attrname' #114

dagwieers opened this issue Jun 7, 2017 · 2 comments · Fixed by ansible/ansible#25323
Labels

Comments

@dagwieers
Copy link
Collaborator

When running the integration tests from this project on the Ansible CI framwork on CentOS-6 (with native lxml v2.2.3) we get the following error:

Couldn't delete xpath target: /business/rating/@subjective ('_ElementStringResult' object has no attribute 'attrname')

Here is the detailed output:

TASK [xml : Remove '/business/rating/@subjective'] *****************************
task path: /root/ansible/test/integration/targets/xml/tasks/test-remove-attribute.yml:7
Using module file /root/ansible/lib/ansible/modules/files/xml.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744 `" && echo ansible-tmp-1496840875.06-126128364675744="` echo /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpYpbF4J TO /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744/xml.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744/ /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744/xml.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/tmp/ansible-test-coverage-2aVbEu/coverage/injector.py /root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744/xml.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1496840875.06-126128364675744/" > /dev/null 2>&1 && sleep 0'
fatal: [testhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "add_children": null, 
            "attribute": null, 
            "content": null, 
            "count": false, 
            "ensure": "absent", 
            "input_type": "yaml", 
            "namespaces": {}, 
            "path": "/tmp/ansible-xml-beers.xml", 
            "pretty_print": false, 
            "print_match": false, 
            "set_children": null, 
            "state": "absent", 
            "value": null, 
            "xmlstring": "", 
            "xpath": "/business/rating/@subjective"
        }
    }, 
    "msg": "Couldn't delete xpath target: /business/rating/@subjective ('_ElementStringResult' object has no attribute 'attrname')"
}
@dagwieers
Copy link
Collaborator Author

So the Ansible xml module requires at least lxml v2.3.0 for supporting the attrname attribute.

@dagwieers
Copy link
Collaborator Author

This is now fixed in the upstreamed module. (A proper error message is returned)

@dagwieers dagwieers added the bug label Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant