diff --git a/tdp/core/cluster_status.py b/tdp/core/cluster_status.py index e4e81cdb..745364fa 100644 --- a/tdp/core/cluster_status.py +++ b/tdp/core/cluster_status.py @@ -129,7 +129,7 @@ def generate_stale_sch_logs( nodes=list(source_reconfigure_operations), restart=True ): # Only create a log when config or restart operation is available - if operation.action_name not in ["config", "restart"]: + if operation.name.action not in ["config", "restart"]: continue # Create a log for each host where the entity is deployed @@ -148,9 +148,9 @@ def generate_stale_sch_logs( source=SCHStatusLogSourceEnum.STALE, ), ) - if operation.action_name == "config": + if operation.name.action == "config": log.to_config = True - elif operation.action_name == "restart": + elif operation.name.action == "restart": log.to_restart = True return set(logs.values()) diff --git a/tdp/core/dag.py b/tdp/core/dag.py index 3a8df6c9..da35c019 100644 --- a/tdp/core/dag.py +++ b/tdp/core/dag.py @@ -303,18 +303,18 @@ def warning(collection_name: str, message: str) -> None: # Part 1 service_actions = services_actions.setdefault(operation.name.service, set()) if operation.is_service_operation(): - service_actions.add(operation.action_name) + service_actions.add(operation.name.action) # Each service action (config, start, init) except the first (install) must have an explicit # dependency with the previous service action within the same service actions_order = ["install", "config", "start", "init"] # Check only if the action is in actions_order and is not the first if ( - operation.action_name in actions_order - and operation.action_name != actions_order[0] + operation.name.action in actions_order + and operation.name.action != actions_order[0] ): previous_action = actions_order[ - actions_order.index(operation.action_name) - 1 + actions_order.index(operation.name.action) - 1 ] previous_service_action = f"{operation.name.service}_{previous_action}" previous_service_action_found = False diff --git a/tdp/core/deployment/deployment_iterator.py b/tdp/core/deployment/deployment_iterator.py index 9f90c64f..53b0391f 100644 --- a/tdp/core/deployment/deployment_iterator.py +++ b/tdp/core/deployment/deployment_iterator.py @@ -205,7 +205,7 @@ def _process_operation_fn( for host in hosts: sch_status_log = self._cluster_status.update_hosted_entity( create_hosted_entity(entity_name, host), - action_name=operation.action_name, + action_name=operation.name.action, version=self._cluster_variables[operation.name.service].version, can_update_stale=can_update_stale, ) diff --git a/tdp/core/models/deployment_model.py b/tdp/core/models/deployment_model.py index 86f88ee5..bbf75916 100644 --- a/tdp/core/models/deployment_model.py +++ b/tdp/core/models/deployment_model.py @@ -175,7 +175,7 @@ def from_dag( for operation in operations: can_perform_rolling_restart = ( rolling_interval is not None - and operation.action_name == "restart" + and operation.name.action == "restart" and operation.host_names ) deployment.operations.append( @@ -245,7 +245,7 @@ def from_operations( for operation in operations: can_perform_rolling_restart = ( rolling_interval is not None - and operation.action_name == "restart" + and operation.name.action == "restart" and operation.host_names ) for host_name in host_names or ( @@ -378,7 +378,7 @@ def from_stale_hosted_entities( ) ) # Add sleep operation after each "restart" - if rolling_interval is not None and operation.action_name == "restart": + if rolling_interval is not None and operation.name.action == "restart": operation_order += 1 deployment.operations.append( OperationModel( diff --git a/tdp/core/operation.py b/tdp/core/operation.py index fa67a4ce..876ce038 100644 --- a/tdp/core/operation.py +++ b/tdp/core/operation.py @@ -104,8 +104,6 @@ def __init__( self.noop = noop self.host_names = host_names or set() - self.action_name = self.name.action - for host_name in self.host_names: if len(host_name) > HOST_NAME_MAX_LENGTH: raise ValueError(