mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed first_available_file and roles support
for copy and template action
This commit is contained in:
parent
48e13f5c6d
commit
e8ff3c43ad
2 changed files with 7 additions and 7 deletions
|
@ -57,12 +57,12 @@ class ActionModule(object):
|
||||||
found = False
|
found = False
|
||||||
for fn in inject.get('first_available_file'):
|
for fn in inject.get('first_available_file'):
|
||||||
fn_orig = fn
|
fn_orig = fn
|
||||||
fn = template.template(self.runner.basedir, fn, inject)
|
fnt = template.template(self.runner.basedir, fn, inject)
|
||||||
fn = utils.path_dwim(self.runner.basedir, fn)
|
fnd = utils.path_dwim(self.runner.basedir, fnt)
|
||||||
if not os.path.exists(fn) and '_original_file' in inject:
|
if not os.path.exists(fnd) and '_original_file' in inject:
|
||||||
fn = utils.path_dwim_relative(inject['_original_file'], 'files', fn_orig, self.runner.basedir, check=False)
|
fnd = utils.path_dwim_relative(inject['_original_file'], 'files', fnt, self.runner.basedir, check=False)
|
||||||
if os.path.exists(fn):
|
if os.path.exists(fnd):
|
||||||
source = fn
|
source = fnd
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
if not found:
|
if not found:
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ActionModule(object):
|
||||||
fnt = template.template(self.runner.basedir, fn, inject)
|
fnt = template.template(self.runner.basedir, fn, inject)
|
||||||
fnd = utils.path_dwim(self.runner.basedir, fnt)
|
fnd = utils.path_dwim(self.runner.basedir, fnt)
|
||||||
if not os.path.exists(fnd) and '_original_file' in inject:
|
if not os.path.exists(fnd) and '_original_file' in inject:
|
||||||
fnd = utils.path_dwim_relative(inject['_original_file'], 'templates', fn_orig, self.runner.basedir, check=False)
|
fnd = utils.path_dwim_relative(inject['_original_file'], 'templates', fnt, self.runner.basedir, check=False)
|
||||||
if os.path.exists(fnd):
|
if os.path.exists(fnd):
|
||||||
source = fnd
|
source = fnd
|
||||||
found = True
|
found = True
|
||||||
|
|
Loading…
Reference in a new issue