mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #5527 from sergevanginderachter/basedirdwim
path_dwim: fix when basedir not set
This commit is contained in:
commit
6c25ea1b91
2 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue