You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/lib/action/connection_passthrough.py

26 lines
722 B
Python

import traceback
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
try:
method = getattr(self._connection, self._task.args['method'])
args = tuple(self._task.args.get('args', ()))
kwargs = self._task.args.get('kwargs', {})
return {
'changed': False,
'failed': False,
'result': method(*args, **kwargs)
}
except Exception as e:
traceback.print_exc()
return {
'changed': False,
'failed': True,
'msg': str(e),
'result': e,
}