From 836fb4143c9f025770cc59dffadf423038a2292b Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Tue, 7 Jan 2014 09:48:35 +0100 Subject: [PATCH] path_dwim: fix when basedir not set --- lib/ansible/runner/action_plugins/debug.py | 3 ++- lib/ansible/utils/__init__.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/debug.py b/lib/ansible/runner/action_plugins/debug.py index 93879c1a8cd..d2c0a980abe 100644 --- a/lib/ansible/runner/action_plugins/debug.py +++ b/lib/ansible/runner/action_plugins/debug.py @@ -28,6 +28,7 @@ class ActionModule(object): def __init__(self, runner): self.runner = runner + self.basedir = runner.basedir def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs): args = {} @@ -50,7 +51,7 @@ class ActionModule(object): else: result = dict(msg=args['msg']) elif 'var' in args: - results = template.template(None, "{{ %s }}" % args['var'], inject) + results = template.template(self.basedir, "{{ %s }}" % args['var'], inject) result[args['var']] = results # force flag to make debug output module always verbose diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index a263ed15ff0..b512c1f8046 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -250,6 +250,8 @@ def path_dwim(basedir, given): elif given.startswith("~"): return os.path.abspath(os.path.expanduser(given)) else: + if basedir is None: + basedir = "." return os.path.abspath(os.path.join(basedir, given)) def path_dwim_relative(original, dirname, source, playbook_base, check=True):