diff --git a/stacks/control_broker_stack.py b/stacks/control_broker_stack.py index 9e8a1abd..3c8bc840 100644 --- a/stacks/control_broker_stack.py +++ b/stacks/control_broker_stack.py @@ -57,7 +57,7 @@ def __init__( self.deploy_outer_sfn_lambdas() self.deploy_outer_sfn() - self.Input_reader_roles: List[aws_iam.Role] = [ + self.input_reader_roles: List[aws_iam.Role] = [ self.lambda_evaluate_cloudformation_by_opa.role, self.lambda_pac_evaluation_router.role, ] @@ -79,7 +79,7 @@ def __init__( CfnOutput( self, "InputReaderArns", - value=json.dumps([r.role_arn for r in self.Input_reader_roles]), + value=json.dumps([r.role_arn for r in self.input_reader_roles]), ) def deploy_utils(self): diff --git a/supplementary_files/lambdas/pac_evaluation_router/lambda_function.py b/supplementary_files/lambdas/pac_evaluation_router/lambda_function.py index 059f6058..c210e271 100644 --- a/supplementary_files/lambdas/pac_evaluation_router/lambda_function.py +++ b/supplementary_files/lambdas/pac_evaluation_router/lambda_function.py @@ -10,20 +10,25 @@ cloudcontrol = boto3.client('cloudcontrol') def get_object(*,bucket,key): + try: r = s3.get_object( Bucket = bucket, Key = key ) except ClientError as e: - print(f'ClientError:\n{e}') + print(f'ClientError:\nbucket:\n{bucket}\nkey:\n{key}\n{e}') raise else: + print(f'no ClientError get_object:\nbucket:\n{bucket}\nkey:\n{key}\n{e}') body = r['Body'] content = json.loads(body.read().decode('utf-8')) return content def put_object(*,bucket,key,object_:dict): + + print(f'begin put_object\nbucket:\n{bucket}\nkey:\n{key}') + try: r = s3.put_object( Bucket = bucket, @@ -31,9 +36,10 @@ def put_object(*,bucket,key,object_:dict): Body = json.dumps(object_) ) except ClientError as e: - print(f'ClientError:\n{e}') + print(f'ClientError:\nbucket:\n{bucket}\nkey:\n{key}\n{e}') raise else: + print(f'no ClientError put_object:\nbucket:\n{bucket}\nkey:\n{key}\n{e}') return True class CloudControl(): @@ -309,7 +315,7 @@ def get_routing_decision(self): input_conversion_object = self.convert_config_event_to_cfn ), "InvokingSfnNextState": self.get_invoking_sfn_next_state( - input_type = "CloudFormationTemplate", + input_type = "CloudFormationTemplate", # ConvertedTo pac_framework = pac_framework, ) }