mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Ensure that when transferring a file to a directory the name of the file is the correct basename and not 'source'.
This commit is contained in:
parent
7044e53e07
commit
3c5890f42b
3 changed files with 13 additions and 9 deletions
|
@ -111,7 +111,7 @@ class ActionModule(object):
|
|||
return ReturnData(conn=conn, result=dict(changed=True), diff=diff)
|
||||
|
||||
# transfer the file to a remote tmp location
|
||||
tmp_src = tmp + os.path.basename(source)
|
||||
tmp_src = tmp + 'source'
|
||||
conn.put_file(source, tmp_src)
|
||||
if content is not None:
|
||||
os.remove(tmp_content)
|
||||
|
@ -120,7 +120,7 @@ class ActionModule(object):
|
|||
self.runner._low_level_exec_command(conn, "chmod a+r %s" % tmp_src, tmp)
|
||||
|
||||
# run the copy module
|
||||
module_args = "%s src=%s" % (module_args, pipes.quote(tmp_src))
|
||||
module_args = "%s src=%s original_basename=%s" % (module_args, pipes.quote(tmp_src), pipes.quote(os.path.basename(source)))
|
||||
return self.runner._execute_module(conn, tmp, 'copy', module_args, inject=inject, complex_args=complex_args)
|
||||
|
||||
else:
|
||||
|
|
|
@ -105,7 +105,7 @@ class ActionModule(object):
|
|||
self.runner._low_level_exec_command(conn, "chmod a+r %s" % xfered, tmp)
|
||||
|
||||
# run the copy module
|
||||
module_args = "%s src=%s dest=%s" % (module_args, pipes.quote(xfered), pipes.quote(dest))
|
||||
module_args = "%s src=%s dest=%s original_basename=%s" % (module_args, pipes.quote(xfered), pipes.quote(dest), pipes.quote(os.path.basename(source)))
|
||||
|
||||
if self.runner.check:
|
||||
return ReturnData(conn=conn, comm_ok=True, result=dict(changed=True), diff=dict(before_header=dest, after_header=source, before=dest_contents, after=resultant))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue