mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 00:19:48 +01:00
fetch - return file in result when changed is true (#85729)
Set the (source) file attribute in the return value if the file changed (e.g. on initial fetch). The attribute is already set in all other cases.
This commit is contained in:
parent
686c3658ae
commit
0c7dcb65cf
2
changelogs/fragments/fix-fetch-return-file.yml
Normal file
2
changelogs/fragments/fix-fetch-return-file.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- fetch - also return ``file`` in the result when changed is ``True`` (https://github.com/ansible/ansible/pull/85729).
|
||||
|
|
@ -192,7 +192,7 @@ class ActionModule(ActionBase):
|
|||
msg="checksum mismatch", file=source, dest=dest, remote_md5sum=None,
|
||||
checksum=new_checksum, remote_checksum=remote_checksum))
|
||||
else:
|
||||
result.update({'changed': True, 'md5sum': new_md5, 'dest': dest,
|
||||
result.update({'changed': True, 'md5sum': new_md5, 'file': source, 'dest': dest,
|
||||
'remote_md5sum': None, 'checksum': new_checksum,
|
||||
'remote_checksum': remote_checksum})
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -30,8 +30,10 @@
|
|||
that:
|
||||
- fetched is changed
|
||||
- fetched.checksum == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
||||
- fetched.file == remote_tmp_dir ~ "/orig"
|
||||
- fetched_again is not changed
|
||||
- fetched_again.checksum == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
||||
- fetched_again.file == remote_tmp_dir ~ "/orig"
|
||||
- fetched.remote_checksum == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
||||
- lookup("file", output_dir + "/fetched/" + inventory_hostname + remote_tmp_dir + "/orig") == "test"
|
||||
- fetch_check_mode is skipped
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user