Skip to content

Commit c6f0747

Browse files
committed
style: improve from_stale_hosted_entities
1 parent 72d44c7 commit c6f0747

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tdp/core/models/deployment_model.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,14 @@ def from_stale_hosted_entities(
360360
)
361361
if len(operation_hosts) == 0:
362362
raise NothingToReconfigureError("No component needs to be reconfigured.")
363-
364363
# Sort by hosts to improve readability
365364
operation_hosts_sorted = sorted(
366365
operation_hosts, key=lambda x: f"{x.operation.name}_{x.host_name}"
367366
)
368-
369-
# Sort operations using DAG topological sort.
370-
reconfigure_operations_sorted = Dag(collections).topological_sort_key(
367+
# Sort operations using DAG topological sort
368+
operation_hosts_sorted = Dag(collections).topological_sort_key(
371369
operation_hosts_sorted, key=lambda x: x.operation.name
372370
)
373-
374371
# Generate deployment
375372
deployment = DeploymentModel(
376373
deployment_type=DeploymentTypeEnum.RECONFIGURE,
@@ -384,7 +381,7 @@ def from_stale_hosted_entities(
384381
state=DeploymentStateEnum.PLANNED,
385382
)
386383
operation_order = 1
387-
for operation, host in reconfigure_operations_sorted:
384+
for operation, host in operation_hosts_sorted:
388385
deployment.operations.append(
389386
OperationModel(
390387
operation=operation.name,
@@ -406,7 +403,6 @@ def from_stale_hosted_entities(
406403
state=OperationStateEnum.PLANNED,
407404
)
408405
)
409-
410406
operation_order += 1
411407
return deployment
412408

0 commit comments

Comments
 (0)