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

XML Module don't delete node in multi namespace file #9509

Closed
1 task done
embrocha opened this issue Jan 1, 2025 · 4 comments
Closed
1 task done

XML Module don't delete node in multi namespace file #9509

embrocha opened this issue Jan 1, 2025 · 4 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@embrocha
Copy link

embrocha commented Jan 1, 2025

Summary

On a XML file with multi namespace, I can't remove a node with criteria

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd       http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">...
    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="localhost" dataDirectory="${activemq.data}">
        <transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
            <transportConnector name="openwire"
                                uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp"
                                uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp"
                                uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt"
                                uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws"
                                uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>
    </broker>
</beans>

- name: Désactiver les autres protocoles de publication de message
  xml:
    path: /mypath/activemq-modif.xml
    xpath: "/beans/broker:broker/broker:transportConnectors/broker:transportConnector[@name!='openwire']"
    state: absent
    namespaces:
      ns: http://www.springframework.org/schema/beans
      broker: http://activemq.apache.org/schema/core

When I run this task, file not changed

Issue Type

Bug Report

Component Name

xml

Ansible Version

ansible [core 2.15.13]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.18 (main, Oct  4 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.5
  libyaml = True

Community.general Version

# /usr/local/lib/python3.9/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.5.2  

Configuration

CONFIG_FILE() = None

OS / Environment

AlmaLinux release 9.4 (Seafoam Ocelot)

Steps to Reproduce

Just execute task in a playbook on localhost

ansible-playbook -i inventories/test playbook-test.yml 

Expected Results

Actual Results

no change (no error)

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@embrocha embrocha changed the title XML Module don't delete node in multi namespace fil XML Module don't delete node in multi namespace file Jan 1, 2025
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Jan 1, 2025
@embrocha
Copy link
Author

embrocha commented Jan 1, 2025

Finally, _ElementStringResult has been remove in lxml 5.1.1. Module xml cannot run with version >=5.1.1. Ok with 5.1.0
Code must be adapt with this modification

@felixfontein
Copy link
Collaborator

You are using an outdated and End of Life version of community.general. This problem has been long fixed (in March 2024: #8169). Please upgrade community.general, or stick to an older version of lxml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants