mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
switched to use cross platform os.sep, added diff output to copy
This commit is contained in:
parent
20b4492704
commit
e719bf765d
3 changed files with 7 additions and 9 deletions
|
@ -31,7 +31,7 @@ from ansible.plugins.action import ActionBase
|
|||
from ansible.utils.boolean import boolean
|
||||
from ansible.utils.hashing import checksum
|
||||
from ansible.utils.unicode import to_bytes
|
||||
|
||||
from ansible.parsing.vault import VaultLib
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
|
@ -55,7 +55,7 @@ class ActionModule(ActionBase):
|
|||
# Check if the source ends with a "/"
|
||||
source_trailing_slash = False
|
||||
if source:
|
||||
source_trailing_slash = source.endswith("/")
|
||||
source_trailing_slash = source.endswith(os.sep)
|
||||
|
||||
# Define content_tempfile in case we set it after finding content populated.
|
||||
content_tempfile = None
|
||||
|
@ -145,6 +145,7 @@ class ActionModule(ActionBase):
|
|||
dest = self._remote_expand_user(dest, tmp)
|
||||
|
||||
for source_full, source_rel in source_files:
|
||||
|
||||
# Generate a hash of the local file.
|
||||
local_checksum = checksum(source_full)
|
||||
|
||||
|
@ -284,11 +285,8 @@ class ActionModule(ActionBase):
|
|||
else:
|
||||
result = dict(dest=dest, src=source, changed=changed)
|
||||
|
||||
# FIXME: move diffs into the result?
|
||||
#if len(diffs) == 1:
|
||||
# return ReturnData(conn=conn, result=result, diff=diffs[0])
|
||||
#else:
|
||||
# return ReturnData(conn=conn, result=result)
|
||||
if len(diffs) == 1:
|
||||
result['diff']=diffs[0]
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
dest = os.path.expanduser(dest)
|
||||
if flat:
|
||||
if dest.endswith("/"):
|
||||
if dest.endswith(os.sep):
|
||||
# if the path ends with "/", we'll use the source filename as the
|
||||
# destination filename
|
||||
base = os.path.basename(source_local)
|
||||
|
|
|
@ -91,7 +91,7 @@ class ActionModule(ActionBase):
|
|||
dest = self._remote_expand_user(dest, tmp)
|
||||
|
||||
directory_prepended = False
|
||||
if dest.endswith("/"): # CCTODO: Fix path for Windows hosts.
|
||||
if dest.endswith(os.sep):
|
||||
directory_prepended = True
|
||||
base = os.path.basename(source)
|
||||
dest = os.path.join(dest, base)
|
||||
|
|
Loading…
Reference in a new issue