mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Further simplify the debug: var=foo action plugin code.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
import ansible
|
||||
|
||||
from ansible import utils
|
||||
from ansible.utils import template
|
||||
from ansible.runner.return_data import ReturnData
|
||||
|
||||
class ActionModule(object):
|
||||
@@ -49,14 +50,8 @@ class ActionModule(object):
|
||||
else:
|
||||
result = dict(msg=args['msg'])
|
||||
elif 'var' in args:
|
||||
|
||||
results = utils.safe_eval(args['var'], inject, include_exceptions=True)
|
||||
intermediate = results[0]
|
||||
exception = results[1]
|
||||
print exception
|
||||
if exception is not None:
|
||||
intermediate = "failed to evaluate: %s" % str(exception)
|
||||
result[args['var']] = intermediate
|
||||
results = template.template(None, "{{ %s }}" % args['var'], inject)
|
||||
result[args['var']] = results
|
||||
|
||||
# force flag to make debug output module always verbose
|
||||
result['verbose_always'] = True
|
||||
|
||||
Reference in New Issue
Block a user