From c38d9712786b30a2750057fbe93dd400bfdd358d Mon Sep 17 00:00:00 2001 From: alpegon Date: Fri, 5 Jul 2019 12:48:59 +0200 Subject: [PATCH] Fix error parsing input bucket name --- scar/providers/aws/controller.py | 3 ++- scar/providers/aws/lambdafunction.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scar/providers/aws/controller.py b/scar/providers/aws/controller.py index 1c96f5dc..38a2f6e5 100644 --- a/scar/providers/aws/controller.py +++ b/scar/providers/aws/controller.py @@ -355,7 +355,8 @@ def _delete_bucket_notifications(self, function_arn, function_env_vars): s3_provider_id = _get_storage_provider_id('S3', function_env_vars) input_bucket_id = f'STORAGE_PATH_INPUT_{s3_provider_id}' if s3_provider_id else '' if input_bucket_id in function_env_vars: - input_bucket_name = function_env_vars[input_bucket_id] + input_path = function_env_vars[input_bucket_id] + input_bucket_name = input_path.split("/", 1)[0] self.aws_s3.delete_bucket_notification(input_bucket_name, function_arn) def _delete_lambda_function(self, function_name): diff --git a/scar/providers/aws/lambdafunction.py b/scar/providers/aws/lambdafunction.py index 7cc35595..cd84c054 100644 --- a/scar/providers/aws/lambdafunction.py +++ b/scar/providers/aws/lambdafunction.py @@ -239,7 +239,7 @@ def launch_lambda_instance(self): def _get_invocation_payload(self): # Default payload - payload = self.aws.lambdaf.payload if self.aws.lambdaf.payload else {} + payload = self.aws.lambdaf.payload if hasattr(self.aws.lambdaf, 'payload') else {} if not payload: # Check for defined run script if hasattr(self.aws.lambdaf, "run_script"):