Skip to content

Commit

Permalink
minor fix in CF deployment (#1665)
Browse files Browse the repository at this point in the history
  • Loading branch information
whummer committed Oct 21, 2019
1 parent be777b0 commit 3f64eaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion localstack/services/cloudformation/cloudformation_starter.py
Expand Up @@ -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)))
Expand Down
4 changes: 3 additions & 1 deletion localstack/utils/cloudformation/template_deployer.py
Expand Up @@ -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)
Expand Down

0 comments on commit 3f64eaf

Please sign in to comment.