Update references to appframework lifecycle constants.

The application framework lifecycle constants were split into two
files, sysinv/helm/lifecycle_constants.py and sysinv/common/constants.py.
Aiming to facilitate the split of the application framework into a
separate application in the future, the review: https://review.opendev.org/c/starlingx/config/+/936252
moved the lifecycle variables to helm/lifecycle_contants file.

This commit updates all references that pointed to the lifecycles
constants at sysinv/common/constants.py file, changing them to point to
the new variables in sysinv/helm/lifecycle_contants.py

Test plan:
PASS: build-pkgs && build-image
PASS: AIO-SX fresh install
PASS: Upload, apply, remove, delete, update and upgrade
      kubernetes-power-manager.

Story: 2011242
Task: 51582
Depends-on: https://review.opendev.org/c/starlingx/config/+/936252

Change-Id: I58b2ecea085ced32823c6610debd221f4a51e03f
Signed-off-by: Edson Dias <edson.dias@windriver.com>
This commit is contained in:
Edson Dias 2025-01-02 15:37:06 -03:00
parent 519897370b
commit c1dbe8c456

View File

@ -15,6 +15,7 @@ from sysinv.common import exception
from sysinv.common import kubernetes
from sysinv.common import utils as cutils
from sysinv.helm import lifecycle_base as base
from sysinv.helm.lifecycle_constants import LifecycleConstants
LOG = logging.getLogger(__name__)
@ -34,27 +35,35 @@ class KubernetesPowerManagerAppLifecycleOperator(base.AppLifecycleOperator):
"""
# Semantic Check
if (hook_info.lifecycle_type == cst.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK
if (hook_info.lifecycle_type ==
LifecycleConstants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK
and hook_info.operation == cst.APP_APPLY_OP
and hook_info.relative_timing == cst.APP_LIFECYCLE_TIMING_PRE):
and hook_info.relative_timing ==
LifecycleConstants.APP_LIFECYCLE_TIMING_PRE):
return self._pre_semantic_check(app, app_op)
# FluxCD Request
if (hook_info.lifecycle_type == cst.APP_LIFECYCLE_TYPE_FLUXCD_REQUEST
if (hook_info.lifecycle_type ==
LifecycleConstants.APP_LIFECYCLE_TYPE_FLUXCD_REQUEST
and hook_info.operation == cst.APP_APPLY_OP
and hook_info.relative_timing == cst.APP_LIFECYCLE_TIMING_PRE):
and hook_info.relative_timing ==
LifecycleConstants.APP_LIFECYCLE_TIMING_PRE):
return self._pre_fluxcd_request(app, app_op)
# Operation
if (hook_info.lifecycle_type == cst.APP_LIFECYCLE_TYPE_OPERATION
if (hook_info.lifecycle_type ==
LifecycleConstants.APP_LIFECYCLE_TYPE_OPERATION
and hook_info.operation == cst.APP_REMOVE_OP
and hook_info.relative_timing == cst.APP_LIFECYCLE_TIMING_POST):
and hook_info.relative_timing ==
LifecycleConstants.APP_LIFECYCLE_TIMING_POST):
return self._post_remove(app, app_op)
# Update Request
if (hook_info.lifecycle_type == cst.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK
if (hook_info.lifecycle_type ==
LifecycleConstants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK
and hook_info.operation == cst.APP_UPDATE_OP
and hook_info.relative_timing == cst.APP_LIFECYCLE_TIMING_PRE):
and hook_info.relative_timing ==
LifecycleConstants.APP_LIFECYCLE_TIMING_PRE):
return self._pre_update(hook_info, app, app_op)
super(KubernetesPowerManagerAppLifecycleOperator,