Commit 9b7991cd authored by David Wilson's avatar David Wilson

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.
parent 6106c277
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment