From 3f64eafb3ed4312af00bb17aed623aabec2375b4 Mon Sep 17 00:00:00 2001 From: Waldemar Hummer Date: Mon, 21 Oct 2019 03:32:40 +0200 Subject: [PATCH] minor fix in CF deployment (#1665) --- localstack/services/cloudformation/cloudformation_starter.py | 4 +++- localstack/utils/cloudformation/template_deployer.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/localstack/services/cloudformation/cloudformation_starter.py b/localstack/services/cloudformation/cloudformation_starter.py index 2b34e46474c51..b5cbd5e06420f 100644 --- a/localstack/services/cloudformation/cloudformation_starter.py +++ b/localstack/services/cloudformation/cloudformation_starter.py @@ -211,7 +211,9 @@ def _parse_and_create_resource(logical_id, resource_json, resources_map, region_ # This resource is either not deployable or already exists. Check if it can be updated if not template_deployer.is_updateable(logical_id, resource_wrapped, stack_name): LOG.debug('Resource %s need not be deployed: %s' % (logical_id, resource_json)) - return resource + # Note: leave this check here, otherwise breaks things (e.g., serverless lambda deploy fails) + if resource: + return resource # fix resource ARNs, make sure to convert account IDs 000000000000 to 123456789012 resource_json_arns_fixed = clone(json_safe(convert_objs_to_ids(resource_json))) diff --git a/localstack/utils/cloudformation/template_deployer.py b/localstack/utils/cloudformation/template_deployer.py index 689d7b001fbec..68bef728fb48f 100644 --- a/localstack/utils/cloudformation/template_deployer.py +++ b/localstack/utils/cloudformation/template_deployer.py @@ -343,7 +343,9 @@ def retrieve_resource_details(resource_id, resource_status, resources, stack_nam resource_id = resource_props['FunctionName'] if resource else resource_id return aws_stack.connect_to_service('lambda').get_function(FunctionName=resource_id) elif resource_type == 'Lambda::Version': - name = resource_props['FunctionName'] + name = resource_props.get('FunctionName') + if not name: + return None func_name = aws_stack.lambda_function_name(name) func_version = name.split(':')[7] if len(name.split(':')) > 7 else '$LATEST' versions = aws_stack.connect_to_service('lambda').list_versions_by_function(FunctionName=func_name)