Skip to content

Commit ca86a73

Browse files
author
Shreya
authored
fix: add condition for ordered dictionary for redeploy api (#1371)
1 parent 60d49c7 commit ca86a73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

samtranslator/translator/translator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import copy
22
from samtranslator.model import ResourceTypeResolver, sam_resources
3+
from collections import OrderedDict
34
from samtranslator.translator.verify_logical_id import verify_unique_logical_id
45
from samtranslator.model.preferences.deployment_preference_collection import DeploymentPreferenceCollection
56
from samtranslator.model.exceptions import (
@@ -51,7 +52,7 @@ def _get_function_names(self, resource_dict, intrinsics_resolver):
5152
# adds to the function_names dict with key as the api_name and value as the function_name
5253
if item.get("Type") == "Api" and item.get("Properties") and item.get("Properties").get("RestApiId"):
5354
rest_api = item.get("Properties").get("RestApiId")
54-
if type(rest_api) == dict:
55+
if type(rest_api) == dict or isinstance(rest_api, OrderedDict):
5556
api_name = item.get("Properties").get("RestApiId").get("Ref")
5657
else:
5758
api_name = item.get("Properties").get("RestApiId")
@@ -61,7 +62,7 @@ def _get_function_names(self, resource_dict, intrinsics_resolver):
6162
resource_dict_copy.get("Properties").get("FunctionName")
6263
)
6364
if function_name:
64-
self.function_names[api_name] = self.function_names.get(api_name, "") + str(
65+
self.function_names[api_name] = str(self.function_names.get(api_name, "")) + str(
6566
function_name
6667
)
6768
return self.function_names

0 commit comments

Comments
 (0)