Skip to content

Commit f154b4b

Browse files
committed
Address PR Comments
1 parent 3c7a060 commit f154b4b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

samcli/lib/sync/flows/alias_version_sync_flow.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class AliasVersionSyncFlow(SyncFlow):
2727
_lambda_client: Any
2828

2929
def __init__(
30-
self,
31-
function_identifier: str,
32-
alias_name: str,
33-
delete_old_alias: bool,
34-
build_context: "BuildContext",
35-
deploy_context: "DeployContext",
36-
sync_context: "SyncContext",
37-
physical_id_mapping: Dict[str, str],
38-
stacks: Optional[List[Stack]] = None,
30+
self,
31+
function_identifier: str,
32+
alias_name: str,
33+
delete_old_alias: bool,
34+
build_context: "BuildContext",
35+
deploy_context: "DeployContext",
36+
sync_context: "SyncContext",
37+
physical_id_mapping: Dict[str, str],
38+
stacks: Optional[List[Stack]] = None,
3939
):
4040
"""
4141
Parameters
@@ -102,9 +102,9 @@ def sync(self) -> None:
102102
FunctionName=function_physical_id, Name=self._alias_name, FunctionVersion=version
103103
)
104104
if self._delete_old_alias and current_alias_version:
105-
function_name_w_version = "{}:{}".format(function_physical_id, current_alias_version)
106-
self._lambda_client.delete_function(FunctionName=function_name_w_version)
107-
105+
formatted_function_name_version = "{}:{}".format(function_physical_id, current_alias_version)
106+
LOG.debug("%Deleting Old Version Alias: %s", self.log_prefix, current_alias_version)
107+
self._lambda_client.delete_function(FunctionName=formatted_function_name_version)
108108

109109
def gather_dependencies(self) -> List[SyncFlow]:
110110
return []
@@ -119,7 +119,7 @@ def _equality_keys(self) -> Any:
119119
def _get_version_alias_if_exists(self) -> Optional[str]:
120120
try:
121121
return str(self._lambda_client.get_alias(FunctionName=self.get_physical_id(self._function_identifier),
122-
Name=self._alias_name)
123-
.get("FunctionVersion"))
122+
Name=self._alias_name)
123+
.get("FunctionVersion"))
124124
except self._lambda_client.exceptions.ResourceNotFoundException:
125-
return None
125+
return None

0 commit comments

Comments
 (0)