from ansible.utils Cannot import makedirs_safe

80 views
Skip to first unread message

Michael Legleux

unread,
Jun 2, 2015, 9:25:05 PM6/2/15
to ansible...@googlegroups.com
Since my host_var and group_var s are not getting used since I updated ansible to the latest git checkout last night, I decided to put the variables directly in my inventory file.
Now it seems like they might be getting read, but now I get this error:
ImportError: cannot import name makedirs_safe

This was just trying ansible win7 -m win_ping

win7 | FAILED! => {'failed': True, 'exception': 'Traceback (most recent call last):\n  File "/home/ansible/ansible/lib/ansible/executor/proc
ess/worker.py", line 118, in run\n    executor_result = TaskExecutor(host, task, job_vars, new_connection_info, self._new_stdin, self._loade
r, shared_loader_obj).run()\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 107, in run\n    res = self._execute
()\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 211, in _execute\n    self._connection = self._get_connection
(variables)\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 395, in _get_connection\n    connection = connection
_loader.get(conn_type, self._connection_info, self._new_stdin)\n  File "/home/ansible/ansible/lib/ansible/plugins/__init__.py", line 271, in
 get\n    self._module_cache[path] = imp.load_source(\'.\'.join([self.package, name]), path)\n  File "/home/ansible/ansible/lib/ansible/plug
ins/connections/winrm.py", line 47, in <module>\n    from ansible.utils import makedirs_safe\nImportError: cannot import name makedirs_safe\
n', 'stdout': ''}

Brian Coca

unread,
Jun 2, 2015, 11:38:37 PM6/2/15
to ansible...@googlegroups.com
should be fixed now, pull and try again (i was missing path in import
path for make path utility)
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/61331699-e9e7-4729-9515-2f5c01ac9340%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Michael Legleux

unread,
Jun 3, 2015, 2:13:39 PM6/3/15
to ansible...@googlegroups.com
Well I don't see the import error anymore but most of the error is the same:
Now I get this:

win7 | FAILED! => {'failed': True, 'exception': 'Traceback (most recent call last):\n  File "/home/ansible/ansible/lib/ansible/executor/proc
ess/worker.py", line 118, in run\n    executor_result = TaskExecutor(host, task, job_vars, new_connection_info, self._new_stdin, self._loade
r, shared_loader_obj).run()\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 107, in run\n    res = self._execute
()\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 215, in _execute\n    self._handler = self._get_action_handle
r(connection=self._connection, templar=templar)\n  File "/home/ansible/ansible/lib/ansible/executor/task_executor.py", line 422, in _get_act
ion_handler\n    shared_loader_obj=self._shared_loader_obj,\n  File "/home/ansible/ansible/lib/ansible/plugins/__init__.py", line 276, in ge
t\n    obj = getattr(self._module_cache[path], self.class_name)(*args, **kwargs)\n  File "/home/ansible/ansible/lib/ansible/plugins/action/_
_init__.py", line 64, in __init__\n    self._shell = shell_loader.get(shell_type)\n  File "/home/ansible/ansible/lib/ansible/plugins/__init_
_.py", line 266, in get\n    path = self.find_plugin(name)\n  File "/home/ansible/ansible/lib/ansible/plugins/__init__.py", line 246, in fin
d_plugin\n    if not name.startswith(\'_\'):\nAttributeError: \'ShellModule\' object has no attribute \'startswith\'\n', 'stdout': ''}

win8 | FAILED! => {'msg': u'ERROR! 500 WinRMTransport. [Errno -3] Temporary failure in name resolution', 'failed': True}

Brian Coca

unread,
Jun 3, 2015, 2:46:16 PM6/3/15
to ansible...@googlegroups.com
that is probably different but unrelated issue, are you relying on
ansible_ssh_host to set the correct address? if so that is a currently
open issue.
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8fc51f8d-e8a4-4f92-a667-bafdb46463b6%40googlegroups.com.

Michael Legleux

unread,
Jun 3, 2015, 5:49:49 PM6/3/15
to ansible...@googlegroups.com
I currently am relying on ansible_ssh_host.
I am assuming once our client machines have DNS entries, the ansible server will not need ansible_ssh_host defined correct?

Brian Coca

unread,
Jun 3, 2015, 6:05:45 PM6/3/15
to ansible...@googlegroups.com
as long as the inventory_hostname is resolvable, there is not need for
ansible_ssh_host
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/68129fbb-714c-4675-b08a-a282cc3532c8%40googlegroups.com.

Daniel Pool

unread,
Jun 10, 2015, 5:20:04 PM6/10/15
to ansible...@googlegroups.com
Hi,

I'm having a similar problem since pulling the latest (d681113) revision in git. I'm not relying on ansible_ssh_host though, my trace output is identical to Michael's win7 host.

Attaching the epdb debugger I outputted the value of name, which just prior to the error had the value:

<ansible.plugins.shell.powershell.ShellModule object at 0x1ab2dd0>

which looks to me to be an object's memory reference rather than a string (I'm no python developer though, so I'm taking a punt based on other language experience).

looking at the source of ansible/lib/ansible/plugins/action/__init__.py, it looks like the powershell ShellModule is being pulled off the connection._shell property. I added (a probably incorrect test) to see if shell_type was a string, in which case I called the shell_loader, otherwise I directly assigned the shell_type to self._shell.

if isinstance(shell_type, basestring):            
        self._shell = shell_loader.get(shell_type)
else:                                             
        self._shell = shell_type

Suspect that this'll break a bunch of other stuff, but it appears to be working for the moment. I figured that I'd push this out here as Brian looks to be far better qualified to say either way.
~Dan

Daniel Pool

unread,
Jun 10, 2015, 9:40:56 PM6/10/15
to ansible...@googlegroups.com
OK, perhaps not the solution - getting errors with module parameters.
Reply all
Reply to author
Forward
0 new messages