Bug 1383267

Summary: missing requires of xmltodict for winrm usage
Product: [Fedora] Fedora Reporter: James Hogarth <james.hogarth>
Component: ansibleAssignee: Kevin Fenzi <kevin>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: a.badger, athmanem, kevin, kupo, mark, maxim, toromoti
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-18 12:35:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description James Hogarth 2016-10-10 10:22:12 UTC
Description of problem:
Attempt to use winrm to manage a windows instance and get a stack trace declaring that cannot import xmltodict 

Version-Release number of selected component (if applicable):
ansible-2.1.2.0-1.fc25.noarch

How reproducible:
always

Steps to Reproduce:
1. Point ansible to a windows machine to manage
2. Direct ansible to use winrm as per http://docs.ansible.com/ansible/intro_windows.html
3. ansible -m setup -i hosts windows

Actual results:
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 124, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 411, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 652, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 333, in get
    self._module_cache[path] = self._load_module_source('.'.join([self.package, name]), path)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 319, in _load_module_source
    module = imp.load_source(name, path, module_file)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py", line 28, in <module>
    import xmltodict
ImportError: No module named xmltodict

w7-ansible-test | FAILED! => {
    "failed": true, 
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}


Expected results:
Facts from the windows instance

Additional info:
On a sidenote it appears Fedora does not package pywinrm at present... but this particular import happens before the test that then says "you don't have winrm" which is a separate issue

Comment 1 James Hogarth 2016-10-10 16:00:10 UTC
For anyone wanting to do remote management of windows with ansible python-winrm now has a review request here:

https://bugzilla.redhat.com/show_bug.cgi?id=1383447

This will go up in a COPR in due course until such time as the review is complete.

Comment 2 Kevin Fenzi 2016-10-13 02:58:09 UTC
Would you be willing to file this particular one upstream? 

https://github.com/ansible/ansible/issues 

Or would you prefer I do so?

Comment 3 James Hogarth 2016-10-13 07:34:48 UTC
I'll verify the behaviour upstream and create an appropriate issue there linking it back here later on

Comment 4 James Hogarth 2016-10-18 12:35:04 UTC
Ah the stacktrace issue appears to be fixed upstream already:

https://github.com/ansible/ansible/commit/8bbbe16d31d68e097a9748c7563bbea18cfdd87b

Note that winrm depends on xmltodict so once the package is approved and imported into Fedora any user who wishes to use it will get that pulled in anyway.