Good day,

I'm utilizing slurp to pull an XML file from a remote Windows host to 
lookup some values. In the file there are a couple of Windows paths that 
when grabbed via regex_search are returned with various escape sequences. 
For example, \a becomes \u0007.

Any ideas how I can resolve the below? I cannot install anything on the 
remote host, and I cannot pull files locally. This rules out using any of 
the XML modules.

Example for clarity:

file.xml:

<?xml version="1.0" encoding="utf-8"?>
<ClusterParameters xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   ...
  <SharedPath>\\somewhere.com\adata\aclusters\bytes</SharedPath>
  ...
</ClusterParameters>

Task:
    - name: Create dictionary of values from test.xml
      ansible.builtin.set_fact:
        file_xml_data: '{{ file_xml_data | default({}) | combine({item.key: 
item.value}) }}'
       loop:
        ...
        - "{ 'key': 'cifs_share', 'value':
          '{{ file_xml | regex_search('<SharedPath>(.+)</', '\\1') | first 
}}' }"
         ...

Appreciate any ideas you may have.

Thank you.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5586d85c-9588-4bce-8132-4c88ba99904bn%40googlegroups.com.

Reply via email to