|
|
@ -6,13 +6,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
__metaclass__ = type
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import inspect
|
|
|
|
import unittest2
|
|
|
|
import unittest2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ansible.template
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.errors import AnsibleError
|
|
|
|
from ansible.errors import AnsibleError
|
|
|
|
from ansible.plugins.action import ActionBase
|
|
|
|
from ansible.plugins.action import ActionBase
|
|
|
|
from ansible.module_utils.six import string_types
|
|
|
|
from ansible.module_utils.six import string_types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEMPLATE_KWARGS = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_argspec = inspect.getargspec(ansible.template.Templar.template)
|
|
|
|
|
|
|
|
if 'bare_deprecated' in _argspec.args:
|
|
|
|
|
|
|
|
TEMPLATE_KWARGS['bare_deprecated'] = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestCase(unittest2.TestCase):
|
|
|
|
class TestCase(unittest2.TestCase):
|
|
|
|
def runTest(self):
|
|
|
|
def runTest(self):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
@ -34,19 +44,18 @@ class ActionModule(ActionBase):
|
|
|
|
TRANSFERS_FILES = False
|
|
|
|
TRANSFERS_FILES = False
|
|
|
|
_VALID_ARGS = frozenset(('left', 'right'))
|
|
|
|
_VALID_ARGS = frozenset(('left', 'right'))
|
|
|
|
|
|
|
|
|
|
|
|
def run(self, tmp=None, task_vars=None):
|
|
|
|
def template(self, obj):
|
|
|
|
result = super(ActionModule, self).run(tmp, task_vars or {})
|
|
|
|
return self._templar.template(
|
|
|
|
|
|
|
|
obj,
|
|
|
|
left = self._templar.template(
|
|
|
|
|
|
|
|
self._task.args['left'],
|
|
|
|
|
|
|
|
convert_bare=True,
|
|
|
|
|
|
|
|
bare_deprecated=False,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
right = self._templar.template(self._task.args['right'],
|
|
|
|
|
|
|
|
convert_bare=True,
|
|
|
|
convert_bare=True,
|
|
|
|
bare_deprecated=False,
|
|
|
|
**TEMPLATE_KWARGS
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(self, tmp=None, task_vars=None):
|
|
|
|
|
|
|
|
result = super(ActionModule, self).run(tmp, task_vars or {})
|
|
|
|
|
|
|
|
left = self.template(self._task.args['left'])
|
|
|
|
|
|
|
|
right = self.template(self._task.args['right'])
|
|
|
|
|
|
|
|
|
|
|
|
diff = text_diff(left, right)
|
|
|
|
diff = text_diff(left, right)
|
|
|
|
if diff is None:
|
|
|
|
if diff is None:
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|