New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[aws_s3] Fix uploading src option on the target machine to a bucket #39023
Conversation
if not self._remote_file_exists(source): | ||
try: | ||
source = self._loader.get_real_file(self._find_needle('files', source)) | ||
new_module_args['src'] = source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need to copy the file from controller to target? I've only ever tried this with controller == target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @willthames sorry for taking a while to get back to this one. I wasn't sure exactly how it works and what the expected behavior is so I took some time to test it out and compare with older versions. It appears the controller file has never been copied so that would be a feature. Since I'd like this to be backported that could be a separate discussion maybe (though looks like it would add potential for more problems). I have tested with a target that is not the controller, and this fixes uploading a file that exists on the target.
I think I'm going to clarify the error if the file doesn't exist on the remote or the controller because it is a little confusing:
"msg": "Could not find or access '/tmp/onlyonremote.txt' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"
If the file exists on the controller but not the remote I get this message, which seems better:
"msg": "Local object for PUT does not exist"
d1f6ec0
to
dcfd6db
Compare
bot_status |
Componentslib/ansible/plugins/action/aws_s3.py Metadatawaiting_on: ansible |
…nsible#39023) * Fix backward compatibility for uploading src option on the target machine to a bucket * Allow the module to handle errors for nonexistent files (cherry picked from commit b8a93c1)
…nsible#39023) * Fix backward compatibility for uploading src option on the target machine to a bucket * Allow the module to handle errors for nonexistent files
…nsible#39023) * Fix backward compatibility for uploading src option on the target machine to a bucket * Allow the module to handle errors for nonexistent files
SUMMARY
This re-enables uploading remote files (which worked prior to 4d58d16). Fixes #38656.
2.5 backport candidate.
ISSUE TYPE
COMPONENT NAME
lib/ansible/plugins/action/aws_s3.py
ANSIBLE VERSION