8000 rename class and merge behaviour · localstack/localstack@943cd20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 943cd20

Browse files
committed
rename class and merge behaviour
1 parent 814599f commit 943cd20

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

localstack-core/localstack/services/cloudformation/engine/template_deployer.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import re
55
import traceback
66
import uuid
7-
from abc import ABC, abstractmethod
87
from typing import Optional
98

109
from botocore.exceptions import ClientError
@@ -831,7 +830,7 @@ def evaluate_resource_condition(conditions: dict[str, bool], resource: dict) ->
831830
# -----------------------
832831

833832

834-
class TemplateDeployerBase(ABC):
833+
class TemplateDeployer:
835834
def __init__(self, account_id: str, region_name: str, stack):
836835
self.stack = stack
837836
self.account_id = account_id
@@ -1338,20 +1337,6 @@ def create_resource_provider_payload(
13381337
}
13391338
return resource_provider_payload
13401339

1341-
@abstractmethod
1342-
def delete_stack(self):
1343-
pass
1344-
1345-
@abstractmethod
1346-
def do_apply_changes_in_loop(self, changes: list[ChangeConfig], stack: Stack) -> list:
1347-
pass
1348-
1349-
@classmethod
1350-
def factory(cls, *args, **kwargs):
1351-
return TemplateDeployerV2(*args, **kwargs)
1352-
1353-
1354-
class TemplateDeployerV2(TemplateDeployerBase):
13551340
def delete_stack(self):
13561341
if not self.stack:
13571342
return

localstack-core/localstack/services/cloudformation/provider.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ def create_stack(self, context: RequestContext, request: CreateStackInput) -> Cr
287287
stack.stack_name,
288288
len(stack.template_resources),
289289
)
290-
deployer = template_deployer.TemplateDeployerBase.factory(
291-
context.account_id, context.region, stack
292-
)
290+
deployer = template_deployer.TemplateDeployer(context.account_id, context.region, stack)
293291
try:
294292
deployer.deploy_stack()
295293
except Exception as e:
@@ -315,9 +313,7 @@ def delete_stack(
315313
if not stack:
316314
# aws will silently ignore invalid stack names - we should do the same
317315
return
318-
deployer = template_deployer.TemplateDeployerBase.factory(
319-
context.account_id, context.region, stack
320-
)
316+
deployer = template_deployer.TemplateDeployer(context.account_id, context.region, stack)
321317
deployer.delete_stack()
322318

323319
@handler("UpdateStack", expand=False)
@@ -395,9 +391,7 @@ def update_stack(
395391
# update the template
396392
stack.template_original = template
397393

398-
deployer = template_deployer.TemplateDeployerBase.factory(
399-
context.account_id, context.region, stack
400-
)
394+
deployer = template_deployer.TemplateDeployer(context.account_id, context.region, stack)
401395
# TODO: there shouldn't be a "new" stack on update
402396
new_stack = Stack(
403397
context.account_id, context.region, request, template, request["TemplateBody"]
@@ -745,7 +739,7 @@ def create_change_set(
745739
except NoResourceInStack as e:
746740
raise ValidationError(str(e)) from e
747741

748-
deployer = template_deployer.TemplateDeployerBase.factory(
742+
deployer = template_deployer.TemplateDeployer(
749743
context.account_id, context.region, change_set
750744
)
751745
changes = deployer.construct_changes(
@@ -872,7 +866,7 @@ def execute_change_set(
872866
stack_name,
873867
len(change_set.template_resources),
874868
)
875-
deployer = template_deployer.TemplateDeployerBase.factory(
869+
deployer = template_deployer.TemplateDeployer(
876870
context.account_id, context.region, change_set.stack
877871
)
878872
try:
@@ -1137,7 +1131,7 @@ def delete_stack_set(
11371131
# TODO: add a check for remaining stack instances
11381132

11391133
for instance in stack_set[0].stack_instances:
1140-
deployer = template_deployer.TemplateDeployerBase.factory(
1134+
deployer = template_deployer.TemplateDeployer(
11411135
context.account_id, context.region, instance.stack
11421136
)
11431137
deployer.delete_stack()

0 commit comments

Comments
 (0)
0