adding also response to upload acme token, just for future use-cases

This commit is contained in:
Hossein Shafagh 2020-11-10 17:46:00 -08:00
parent ea77ef08aa
commit 252f84cf21
2 changed files with 14 additions and 13 deletions

View File

@ -419,7 +419,7 @@ class S3DestinationPlugin(ExportDestinationPlugin):
:param kwargs: :param kwargs:
:return: :return:
""" """
current_app.logger.debug("S3 destination plugin is started for HTTP-01 challenge") current_app.logger.debug("S3 destination plugin is started to upload HTTP-01 challenge")
function = f"{__name__}.{sys._getframe().f_code.co_name}" function = f"{__name__}.{sys._getframe().f_code.co_name}"
@ -431,16 +431,16 @@ class S3DestinationPlugin(ExportDestinationPlugin):
if not prefix.endswith("/"): if not prefix.endswith("/"):
prefix + "/" prefix + "/"
res = s3.put(bucket_name=bucket_name, response = s3.put(bucket_name=bucket_name,
region_name=region, region_name=region,
prefix=prefix + filename, prefix=prefix + filename,
data=token, data=token,
encrypt=False, encrypt=False,
account_number=account_number) account_number=account_number)
res = "Success" if res else "Failure" res = "Success" if response else "Failure"
log_data = { log_data = {
"function": function, "function": function,
"message": "check if any valid certificate is revoked", "message": "upload acme token challenge",
"result": res, "result": res,
"bucket_name": bucket_name, "bucket_name": bucket_name,
"filename": filename "filename": filename

View File

@ -68,10 +68,11 @@ def test_upload_acme_token(app):
s3_client.create_bucket(Bucket=bucket) s3_client.create_bucket(Bucket=bucket)
p = plugins.get("aws-s3") p = plugins.get("aws-s3")
p.upload_acme_token(token_path=token_path, response = p.upload_acme_token(token_path=token_path,
token_content=token_content, token_content=token_content,
token=token_content, token=token_content,
options=additional_options) options=additional_options)
assert response
response = get(bucket_name=bucket, response = get(bucket_name=bucket,
prefixed_object_name=prefix + token_name, prefixed_object_name=prefix + token_name,