mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-04 15:40:20 -07:00
Merge pull request #98 from jhoekx/no-touch-file
Make copy module idempotent.
This commit is contained in:
commit
b4a07fea3b
1 changed files with 2 additions and 3 deletions
|
@ -54,11 +54,10 @@ changed = False
|
||||||
if os.path.exists(dest):
|
if os.path.exists(dest):
|
||||||
md5sum = os.popen("md5sum %s" % dest).read().split()[0]
|
md5sum = os.popen("md5sum %s" % dest).read().split()[0]
|
||||||
|
|
||||||
os.system("cp %s %s" % (src, dest))
|
md5sum2 = os.popen("md5sum %s" % src).read().split()[0]
|
||||||
|
|
||||||
md5sum2 = os.popen("md5sum %s" % dest).read().split()[0]
|
|
||||||
|
|
||||||
if md5sum != md5sum2:
|
if md5sum != md5sum2:
|
||||||
|
os.system("cp %s %s" % (src, dest))
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
# mission accomplished
|
# mission accomplished
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue