Skip to content

Commit 7bfa010

Browse files
committed
make linter happy
1 parent edb7c39 commit 7bfa010

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

samtranslator/model/sam_resources.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -943,19 +943,20 @@ def _construct_version(
943943
# However, we need the Lambda function to automatically create a new version
944944
# and use the new layer. By setting the `PublishLambdaVersion` property to true,
945945
# a new Lambda function version will be created when the layer version is updated.
946-
for layer in function.Layers:
947-
layer_logical_id = get_logical_id_from_intrinsic(layer)
948-
if not layer_logical_id:
949-
continue
950-
951-
layer_resource = resource_resolver.get_resource_by_logical_id(layer_logical_id)
952-
if not layer_resource:
953-
continue
954-
955-
layer_properties = layer_resource.get("Properties", {})
956-
publish_lambda_version = layer_properties.get("PublishLambdaVersion", False)
957-
if publish_lambda_version:
958-
properties.update({layer_logical_id: layer_properties})
946+
if function.Layers:
947+
for layer in function.Layers:
948+
layer_logical_id = get_logical_id_from_intrinsic(layer)
949+
if not layer_logical_id:
950+
continue
951+
952+
layer_resource = resource_resolver.get_resource_by_logical_id(layer_logical_id)
953+
if not layer_resource:
954+
continue
955+
956+
layer_properties = layer_resource.get("Properties", {})
957+
publish_lambda_version = layer_properties.get("PublishLambdaVersion", False)
958+
if publish_lambda_version:
959+
properties.update({layer_logical_id: layer_properties})
959960

960961
logical_dict = properties
961962
else:

0 commit comments

Comments
 (0)