mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix copy when force=no and update _remote_md5 docs.
Previously setting force=no caused copy to subversively fail when target did not exist on remote host. Caused by Runner._remote_md5 returning 1 when files don't exist, rather than 0.
This commit is contained in:
parent
3e774fedea
commit
7de718cd51
2 changed files with 3 additions and 3 deletions
|
@ -621,7 +621,7 @@ class Runner(object):
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
||||||
def _remote_md5(self, conn, tmp, path):
|
def _remote_md5(self, conn, tmp, path):
|
||||||
''' takes a remote md5sum without requiring python, and returns 0 if no file '''
|
''' takes a remote md5sum without requiring python, and returns 1 if no file '''
|
||||||
|
|
||||||
path = pipes.quote(path)
|
path = pipes.quote(path)
|
||||||
# The following test needs to be SH-compliant. BASH-isms will
|
# The following test needs to be SH-compliant. BASH-isms will
|
||||||
|
|
|
@ -106,8 +106,8 @@ class ActionModule(object):
|
||||||
dest = os.path.join(dest, os.path.basename(source))
|
dest = os.path.join(dest, os.path.basename(source))
|
||||||
remote_md5 = self.runner._remote_md5(conn, tmp, dest)
|
remote_md5 = self.runner._remote_md5(conn, tmp, dest)
|
||||||
|
|
||||||
# remote_md5 == '0' would mean that the file does not exist.
|
# remote_md5 == '1' would mean that the file does not exist.
|
||||||
if remote_md5 != '0' and not force:
|
if remote_md5 != '1' and not force:
|
||||||
return ReturnData(conn=conn, result=dict(changed=False))
|
return ReturnData(conn=conn, result=dict(changed=False))
|
||||||
|
|
||||||
exec_rc = None
|
exec_rc = None
|
||||||
|
|
Loading…
Reference in a new issue