From 03ec3cd572c45f5a12160822d602f5170ff6c7e5 Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Wed, 11 Oct 2017 19:12:55 -0700 Subject: [PATCH] [aws_s3] different fail msg depending on whether version is specified (#31598) --- lib/ansible/modules/cloud/amazon/aws_s3.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/aws_s3.py b/lib/ansible/modules/cloud/amazon/aws_s3.py index 81c28ef5996..84587c65d7f 100644 --- a/lib/ansible/modules/cloud/amazon/aws_s3.py +++ b/lib/ansible/modules/cloud/amazon/aws_s3.py @@ -693,7 +693,10 @@ def main(): # Next, we check to see if the key in the bucket exists. If it exists, it also returns key_matches md5sum check. keyrtn = key_check(module, s3, bucket, obj, version=version, validate=validate) if keyrtn is False: - module.fail_json(msg="Key %s with version id %s does not exist." % (obj, version)) + if version: + module.fail_json(msg="Key %s with version id %s does not exist." % (obj, version)) + else: + module.fail_json(msg="Key %s does not exist." % obj) # If the destination path doesn't exist or overwrite is True, no need to do the md5um etag check, so just download. # Compare the remote MD5 sum of the object with the local dest md5sum, if it already exists.