mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Expand tilde remotely in action plugins
This commit is contained in:
parent
fa953e162e
commit
bc4272d2a2
7 changed files with 33 additions and 4 deletions
|
@ -109,6 +109,7 @@ class ActionModule(object):
|
|||
path = self._assemble_from_fragments(src, delimiter, _re)
|
||||
|
||||
path_checksum = utils.checksum_s(path)
|
||||
dest = self.runner._remote_expand_user(conn, dest, tmp)
|
||||
remote_checksum = self.runner._remote_checksum(conn, tmp, dest, inject)
|
||||
|
||||
if path_checksum != remote_checksum:
|
||||
|
|
|
@ -157,6 +157,9 @@ class ActionModule(object):
|
|||
if "-tmp-" not in tmp_path:
|
||||
tmp_path = self.runner._make_tmp_path(conn)
|
||||
|
||||
# expand any user home dir specifier
|
||||
dest = self.runner._remote_expand_user(conn, dest, tmp_path)
|
||||
|
||||
for source_full, source_rel in source_files:
|
||||
# Generate a hash of the local file.
|
||||
local_checksum = utils.checksum(source_full)
|
||||
|
|
|
@ -71,6 +71,7 @@ class ActionModule(object):
|
|||
return ReturnData(conn=conn, result=results)
|
||||
|
||||
source = conn.shell.join_path(source)
|
||||
source = self.runner._remote_expand_user(conn, source, tmp)
|
||||
|
||||
# calculate checksum for the remote file
|
||||
remote_checksum = self.runner._remote_checksum(conn, tmp, source, inject)
|
||||
|
|
|
@ -75,6 +75,8 @@ class ActionModule(object):
|
|||
else:
|
||||
source = utils.path_dwim(self.runner.basedir, source)
|
||||
|
||||
# Expand any user home dir specification
|
||||
dest = self.runner._remote_expand_user(conn, dest, tmp)
|
||||
|
||||
if dest.endswith("/"): # CCTODO: Fix path for Windows hosts.
|
||||
base = os.path.basename(source)
|
||||
|
|
|
@ -54,7 +54,7 @@ class ActionModule(object):
|
|||
result = dict(failed=True, msg="src (or content) and dest are required")
|
||||
return ReturnData(conn=conn, result=result)
|
||||
|
||||
dest = os.path.expanduser(dest) # CCTODO: Fix path for Windows hosts.
|
||||
dest = self.runner._remote_expand_user(conn, dest, tmp) # CCTODO: Fix path for Windows hosts.
|
||||
source = template.template(self.runner.basedir, os.path.expanduser(source), inject)
|
||||
if copy:
|
||||
if '_original_file' in inject:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue