summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2014-05-20 13:39:23 -0500
committerJames Cammarata <jimi@sngx.net>2014-06-09 14:10:24 -0500
commit5128bced6b05a27aa4b1faac877db0a7eefd5597 (patch)
treef95d93990ffd245e9e1625e5d8b5a1f047dc7c7b
parent549f67c0d8e8ed05caaf671a6e94ee97e802177b (diff)
downloadansible-5128bced6b05a27aa4b1faac877db0a7eefd5597.tar.gz
Don't use listify_ function, when all we want to do is template variables
This was causing a bug in the env module, due to the fact that we now pass variables for the module through the templating engine combined with the fact that we split-up the hostvars and setup variables. As a result, if a variable in the env lookup had the same name as the variable in Ansible, it would try and template itself over and over again until the recursion limit would be hit, at which time an empty string was returned. Fixes #7396
-rw-r--r--lib/ansible/runner/lookup_plugins/env.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/runner/lookup_plugins/env.py b/lib/ansible/runner/lookup_plugins/env.py
index 6acc5f59dd..d4f85356ed 100644
--- a/lib/ansible/runner/lookup_plugins/env.py
+++ b/lib/ansible/runner/lookup_plugins/env.py
@@ -16,6 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible import utils, errors
+from ansible.utils import template
import os
class LookupModule(object):
@@ -25,7 +26,10 @@ class LookupModule(object):
def run(self, terms, inject=None, **kwargs):
- terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
+ try:
+ terms = template.template(self.basedir, terms, inject)
+ except Exception, e:
+ pass
if isinstance(terms, basestring):
terms = [ terms ]