mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
This commit is contained in:
@@ -45,39 +45,39 @@ def write_temp_file(data):
|
||||
# main
|
||||
|
||||
def main():
|
||||
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
src = dict(required=True),
|
||||
dest = dict(required=True),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
changed=False
|
||||
pathmd5 = None
|
||||
destmd5 = None
|
||||
src = os.path.expanduser(module.params['src'])
|
||||
dest = os.path.expanduser(module.params['dest'])
|
||||
|
||||
|
||||
if not os.path.exists(src):
|
||||
module.fail_json(msg="Source (%s) does not exist" % src)
|
||||
|
||||
|
||||
if not os.path.isdir(src):
|
||||
module.fail_json(msg="Source (%s) is not a directory" % src)
|
||||
|
||||
|
||||
path = write_temp_file(assemble_from_fragments(src))
|
||||
pathmd5 = module.md5(path)
|
||||
|
||||
|
||||
if os.path.exists(dest):
|
||||
destmd5 = module.md5(dest)
|
||||
|
||||
|
||||
if pathmd5 != destmd5:
|
||||
shutil.copy(path, dest)
|
||||
changed = True
|
||||
|
||||
|
||||
|
||||
# Mission complete
|
||||
module.exit_json(src=src, dest=dest, md5sum=destmd5,
|
||||
module.exit_json(src=src, dest=dest, md5sum=destmd5,
|
||||
changed=changed, msg="OK",
|
||||
daisychain="file", daisychain_args=module.params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user