Merge pull request #13264 from Yannig/devel_debug_var_list_or_dict
Allow debug var parameter to accept a list or dict.
This commit is contained in:
commit
96fcfe45d0
1 changed files with 8 additions and 4 deletions
|
@ -19,7 +19,7 @@ __metaclass__ = type
|
|||
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.boolean import boolean
|
||||
|
||||
from ansible.utils.unicode import to_unicode
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
''' Print statements during execution '''
|
||||
|
@ -41,9 +41,13 @@ class ActionModule(ActionBase):
|
|||
# FIXME: move the LOOKUP_REGEX somewhere else
|
||||
elif 'var' in self._task.args: # and not utils.LOOKUP_REGEX.search(self._task.args['var']):
|
||||
results = self._templar.template(self._task.args['var'], convert_bare=True)
|
||||
if results == self._task.args['var']:
|
||||
results = "VARIABLE IS NOT DEFINED!"
|
||||
result[self._task.args['var']] = results
|
||||
if type(self._task.args['var']) in (list, dict):
|
||||
# If var is a list or dict, use the type as key to display
|
||||
result[to_unicode(type(self._task.args['var']))] = results
|
||||
else:
|
||||
if results == self._task.args['var']:
|
||||
results = "VARIABLE IS NOT DEFINED!"
|
||||
result[self._task.args['var']] = results
|
||||
else:
|
||||
result['msg'] = 'here we are'
|
||||
|
||||
|
|
Loading…
Reference in a new issue