mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 16:04:09 -07:00
Further simplify the debug: var=foo action plugin code.
This commit is contained in:
parent
bbf212a268
commit
51fbc6d20a
1 changed files with 3 additions and 8 deletions
|
@ -18,6 +18,7 @@
|
||||||
import ansible
|
import ansible
|
||||||
|
|
||||||
from ansible import utils
|
from ansible import utils
|
||||||
|
from ansible.utils import template
|
||||||
from ansible.runner.return_data import ReturnData
|
from ansible.runner.return_data import ReturnData
|
||||||
|
|
||||||
class ActionModule(object):
|
class ActionModule(object):
|
||||||
|
@ -49,14 +50,8 @@ class ActionModule(object):
|
||||||
else:
|
else:
|
||||||
result = dict(msg=args['msg'])
|
result = dict(msg=args['msg'])
|
||||||
elif 'var' in args:
|
elif 'var' in args:
|
||||||
|
results = template.template(None, "{{ %s }}" % args['var'], inject)
|
||||||
results = utils.safe_eval(args['var'], inject, include_exceptions=True)
|
result[args['var']] = results
|
||||||
intermediate = results[0]
|
|
||||||
exception = results[1]
|
|
||||||
print exception
|
|
||||||
if exception is not None:
|
|
||||||
intermediate = "failed to evaluate: %s" % str(exception)
|
|
||||||
result[args['var']] = intermediate
|
|
||||||
|
|
||||||
# force flag to make debug output module always verbose
|
# force flag to make debug output module always verbose
|
||||||
result['verbose_always'] = True
|
result['verbose_always'] = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue