ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
204 stars 158 forks source link

v2.9.3 errors trying to add an xml fragment on windows #46

Open jborean93 opened 4 years ago

jborean93 commented 4 years ago

From @frogstarr78 on Jan 18, 2020 23:58

SUMMARY

The win_xml task fails when trying to insert an element into an existing element on v2.9.3 but not v2.9.2

ISSUE TYPE
COMPONENT NAME

ansible/modules/windows/win_xml.ps1

ANSIBLE VERSION
ansible 2.9.3
  config file = /home/scott/git/vivio-ansible/ansible.cfg
  configured module search path = [u'/home/scott/git/vivio-ansible/lib']
  ansible python module location = /usr/lib64/python2.7/site-packages/ansible
  executable location = /usr/lib/python-exec/python2.7/ansible
  python version = 2.7.17 (default, Dec 16 2019, 11:59:26) [GCC 8.3.0]
CONFIGURATION
ANSIBLE_COW_SELECTION(env: ANSIBLE_COW_SELECTION) = random
ANSIBLE_COW_WHITELIST(~/git/vivio-ansible/ansible.cfg) = [u'bud-frogs', u'bunny', u'cheese', u'daemon', u'default', u'dragon', u'elephant-in-snake', u'elephant', u'eyes', u'\\\nhellokitty', u'kitty', u'luke-koala', u'meow', u'milk'>
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
CACHE_PLUGIN(~/git/vivio-ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(~/git/vivio-ansible/ansible.cfg) = ~/cache/
COLOR_VERBOSE(~/git/vivio-ansible/ansible.cfg) = bright blue
DEFAULT_ACTION_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/action_plugins']
DEFAULT_CALLBACK_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/callback_plugins']
DEFAULT_CALLBACK_WHITELIST(~/git/vivio-ansible/ansible.cfg) = [u'timer', u'checklist_builder']
DEFAULT_CONNECTION_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/connection_plugins']
DEFAULT_FILTER_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/filter_plugins']
DEFAULT_FORKS(~/git/vivio-ansible/ansible.cfg) = 5
DEFAULT_GATHERING(~/git/vivio-ansible/ansible.cfg) = implicit
DEFAULT_HASH_BEHAVIOUR(~/git/vivio-ansible/ansible.cfg) = merge
DEFAULT_HOST_LIST(env: ANSIBLE_INVENTORY) = [u'~/git/vivio-ansible/vivio/hosts.yml']
DEFAULT_INVENTORY_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/vivio']
DEFAULT_LOCAL_TMP(~/git/vivio-ansible/ansible.cfg) = /tmp/t/ansible-local-144747J3fZUy
DEFAULT_LOG_PATH(~/git/vivio-ansible/ansible.cfg) = ~/git/vivio-ansible/log/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/lookup_plugins']
DEFAULT_MANAGED_STR(~/git/vivio-ansible/ansible.cfg) = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/lib']
DEFAULT_POLL_INTERVAL(~/git/vivio-ansible/ansible.cfg) = 15
DEFAULT_SCP_IF_SSH(~/git/vivio-ansible/ansible.cfg) = True
DEFAULT_TIMEOUT(~/git/vivio-ansible/ansible.cfg) = 10
DEFAULT_TRANSPORT(~/git/vivio-ansible/ansible.cfg) = smart
DEFAULT_VARS_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/vars_plugins']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = ~/.ansible/.vk
INVENTORY_ENABLED(~/git/vivio-ansible/ansible.cfg) = [u'script', u'host_list', u'yaml', u'constructed', u'portal_inventory']
INVENTORY_IGNORE_EXTS(~/git/vivio-ansible/ansible.cfg) = [u'.pyc', u'.pyo', u'.swp', u'.bak', u'~', u'.rpm', u'.md', u'.txt', u'~', u'.orig', u'.ini', u'.cfg', u'.retry']
INVENTORY_UNPARSED_IS_FAILED(~/git/vivio-ansible/ansible.cfg) = True
PARAMIKO_HOST_KEY_AUTO_ADD(~/git/vivio-ansible/ansible.cfg) = True
OS / ENVIRONMENT

uname -a Linux scott-vivio2.viviotech.net 4.19.86-gentoo #10 SMP Fri Dec 13 12:44:03 PST 2019 x86_64 Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz GenuineIntel GNU/Linux

lsb_release -a LSB Version: n/a Distributor ID: Gentoo Description: Gentoo Base System release 2.6 Release: 2.6 Codename: n/a

STEPS TO REPRODUCE
  - name: Update lucee to connect to the local mail system
     win_xml:
       path: 'C:\Lucee\tomcat\lucee-server\context\lucee-server.xml'
       xpath: '//mail'
       fragment: '<server idle="10000" life="60000" password="" port="25" reuse-connection="true" smtp="127.0.0.1" ssl="false" tls="false" username=""/>'
       state: present
       type: element

with this error

EXPECTED RESULTS

This content in the file

<mail spool-enable="yes" spool-interval="5" timeout="30">
<server idle="10000" life="60000" password="" port="25" reuse-connection="true" smtp="127.0.0.1" ssl="false" tls="false" username=""/>
</mail>
ACTUAL RESULTS
The full traceback is:
Method invocation failed because [System.Xml.XmlChildNodes] does not contain a method named 'get_OuterXml'.
At line:185 char:13
+            $nstatus = "node: " + $node.get_Value() + "element: " +  ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],
ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MethodNotFound

ScriptStackTrace: at <ScriptBlock>, <No file>: line 185

fatal: [hallowed-sepia-degu.viviotech.us]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Method invocation failed because [System.Xml.XmlChildNodes] does not contain a method named 'get_OuterXml'."
}

Copied from original issue: ansible/ansible#66602

jborean93 commented 4 years ago

From @ShachafGoldstein on Jan 23, 2020 17:33

What is the content of the file before running? I might be missing something but I don't see any diff between 9.2 and 9.3...

stigboyeandersen commented 4 years ago

Hi jborean93,

I have a similar problem. Did you find a solution or workaroud?

Regards

Stig