Fix where path is expanded

This commit is contained in:
Joshua Boniface 2022-07-07 15:39:06 +00:00
parent 0565a6b635
commit 9a9caae923
1 changed files with 2 additions and 2 deletions

View File

@ -203,8 +203,6 @@ def run_hook_copy(config, targets, args):
node_address = node.host_ipaddr node_address = node.host_ipaddr
source = args.get("source", []) source = args.get("source", [])
if not match(r"^/", source):
source = f"{config['ansible_source']}/{source}"
destination = args.get("destination", []) destination = args.get("destination", [])
mode = args.get("mode", []) mode = args.get("mode", [])
@ -212,6 +210,8 @@ def run_hook_copy(config, targets, args):
with run_paramiko(config, node_address) as c: with run_paramiko(config, node_address) as c:
for sfile, dfile, dmode in zip(source, destination, mode): for sfile, dfile, dmode in zip(source, destination, mode):
if not match(r"^/", sfile):
sfile = f"{config['ansible_source']}/{sfile}"
tc = c.open_sftp() tc = c.open_sftp()
tc.put(sfile, dfile) tc.put(sfile, dfile)
tc.chmod(dfile, dmode) tc.chmod(dfile, dmode)