From 76f73dc81faabda11e30850e4952e596c6a2ca96 Mon Sep 17 00:00:00 2001 From: jctanner Date: Thu, 21 Apr 2016 22:58:07 -0400 Subject: [PATCH] Change the raw module's detection of environment settings. (#15535) The task_vars datastructure always contains an environment key, so use the _task.environment property to look for a non-empty list instead. --- lib/ansible/plugins/action/raw.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/action/raw.py b/lib/ansible/plugins/action/raw.py index 4774b3ade59..ae3d53a3660 100644 --- a/lib/ansible/plugins/action/raw.py +++ b/lib/ansible/plugins/action/raw.py @@ -26,11 +26,9 @@ class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): if task_vars is None: task_vars = dict() - else: - if 'vars' in task_vars: - if 'environment' in task_vars['vars']: - # The environment key only exists if explicitly declared in the task or in the play - self._display.warning('raw module does not support the environment keyword') + + if self._task.environment: + self._display.warning('raw module does not support the environment keyword') result = super(ActionModule, self).run(tmp, task_vars)