From 5eb41751f5a9ca11421c8d1454ff014d39649da9 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 10 Sep 2018 01:40:49 +0100 Subject: [PATCH] tests: import missing connection_passthrough --- .../lib/action/connection_passthrough.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/ansible/lib/action/connection_passthrough.py diff --git a/tests/ansible/lib/action/connection_passthrough.py b/tests/ansible/lib/action/connection_passthrough.py new file mode 100644 index 00000000..1e9211e4 --- /dev/null +++ b/tests/ansible/lib/action/connection_passthrough.py @@ -0,0 +1,28 @@ + +import traceback +import sys + +from ansible.plugins.strategy import StrategyBase +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, + }