From 3654a97ee0e5e91b4491fe14d9852a1707eb6eb0 Mon Sep 17 00:00:00 2001 From: Dario Faccin Date: Thu, 6 Jul 2023 09:50:56 +0200 Subject: [PATCH] OSMENG-1098: Perform unit resolve without retry Add class stub Change-Id: I17bbc03106954cd78355a2508d43db5370e3d27c Signed-off-by: Dario Faccin --- osm_common/temporal/activities/paas.py | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/osm_common/temporal/activities/paas.py b/osm_common/temporal/activities/paas.py index fc08af2..945e4d2 100644 --- a/osm_common/temporal/activities/paas.py +++ b/osm_common/temporal/activities/paas.py @@ -447,3 +447,57 @@ class CheckModelIsRemoved(BaseActivity): async def __call__(self, activity_input: Input) -> None: raise NotImplementedError() + + +class ResolveCharmErrors(BaseActivity): + """Mark the errors as resolved in all units for the given charm in the given model. + + Collaborators: + Juju Controller: Connect to controller and mark charm errors as resolved. + + Raises (Retryable): + ApplicationError If any of password, cacert, cloud_credentials is invalid + or Juju controller is not reachable + + Activity Lifecycle: + This activity will continue indefinitely until the error of specific application + is resolved. Heartbeats are performed to ensure this activity does not time out. + + A start-to-close of something reasonable (such as 2 minutes) should be implemented + at the workflow level and such a timeout shall trigger workflow failure logic. + + """ + + @dataclass + class Input: + """ + Input dataclass for marking errors as resolved on all units of a specific charm + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM as stored in the OSM vim_accounts + collection in Mongo. + + model_name : str + Name of the model in Juju where the charm is deployed. + + application_name : str + Name of the application for which unit errors have to be resolved. + + poll_interval : int (optional) + Time, in seconds, to wait between application status checks to see if error resolved or not. + + """ + + vim_uuid: str + model_name: str + application_name: str + poll_interval: int = 1 + + def __init__(self, juju_controller): + super().__init__() + self.juju_controller = juju_controller + + async def __call__(self, activity_input: Input) -> None: + raise NotImplementedError() -- 2.25.1