issue #118: log exceptions for emulated commands, fix AttributeError in helpers.py

Turns out Ansible can't be trusted to actually check the result
dictionary everywhere it expects one, so put the real exception text
into -vvv output too.
pull/120/head
David Wilson 8 years ago
parent f304bf7cb4
commit d8a68c52a1

@ -289,7 +289,7 @@ def set_file_mode(path, spec):
"""
mode = os.stat(path).st_mode
if spec.is_digit():
if spec.isdigit():
new_mode = int(spec, 8)
else:
new_mode = apply_mode_spec(spec, mode)

@ -28,6 +28,7 @@
from __future__ import absolute_import
import commands
import logging
import os
import pwd
import shutil
@ -52,6 +53,9 @@ import ansible_mitogen.helpers
from ansible.module_utils._text import to_text
LOG = logging.getLogger(__name__)
def get_command_module_name(module_name):
"""
Given the name of an Ansible command module, return its canonical module
@ -157,6 +161,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
if stdout:
dct['stdout'] = repr(rc)
except mitogen.core.CallError:
LOG.exception('While emulating a shell command')
dct['rc'] = 1
dct['stderr'] = traceback.format_exc()

Loading…
Cancel
Save