diff --git a/actions.yaml b/actions.yaml index c79642924..2b70ccf21 100644 --- a/actions.yaml +++ b/actions.yaml @@ -63,7 +63,7 @@ resume-refresh: description: | Refresh next unit(s) (after you have manually verified that refreshed units are healthy) -force-upgrade: +force-refresh: description: | Force refresh of this unit. Potential of data loss and downtime. diff --git a/src/upgrades/machine_upgrade.py b/src/upgrades/machine_upgrade.py index d2b6fa97f..640ee6591 100644 --- a/src/upgrades/machine_upgrade.py +++ b/src/upgrades/machine_upgrade.py @@ -58,7 +58,7 @@ def app_status(self) -> typing.Optional[ops.StatusBase]: """App upgrade status.""" if not self.is_compatible: logger.info( - "Refresh incompatible. Rollback with `juju refresh`. If you accept potential *data loss* and *downtime*, you can continue by running `force-upgrade` action on each remaining unit" + "Refresh incompatible. Rollback with `juju refresh`. If you accept potential *data loss* and *downtime*, you can continue by running `force-refresh` action on each remaining unit" ) return ops.BlockedStatus( "Refresh incompatible. Rollback to previous revision with `juju refresh`" diff --git a/src/upgrades/mongodb_upgrade.py b/src/upgrades/mongodb_upgrade.py index e0c66b7b9..b7a7ea511 100644 --- a/src/upgrades/mongodb_upgrade.py +++ b/src/upgrades/mongodb_upgrade.py @@ -4,6 +4,7 @@ """Manager for handling MongoDB in-place upgrades.""" import logging +from typing import TYPE_CHECKING from charms.mongodb.v0.upgrade_helpers import ( PEER_RELATION_ENDPOINT_NAME, @@ -16,7 +17,7 @@ UnitState, ) from charms.mongodb.v1.mongos import BalancerNotEnabledError, MongosConnection -from ops.charm import ActionEvent, CharmBase +from ops.charm import ActionEvent from ops.framework import EventBase, EventSource from ops.model import ActiveStatus, BlockedStatus from overrides import override @@ -25,6 +26,9 @@ from config import Config from upgrades import machine_upgrade +if TYPE_CHECKING: + from charm import MongodbOperatorCharm + logger = logging.getLogger(__name__) @@ -41,12 +45,12 @@ class MongoDBUpgrade(GenericMongoDBUpgrade): post_app_upgrade_event = EventSource(_PostUpgradeCheckMongoDB) post_cluster_upgrade_event = EventSource(_PostUpgradeCheckMongoDB) - def __init__(self, charm: CharmBase): + def __init__(self, charm: "MongodbOperatorCharm"): self.charm = charm super().__init__(charm, PEER_RELATION_ENDPOINT_NAME) @override - def _observe_events(self, charm: CharmBase) -> None: + def _observe_events(self, charm: "MongodbOperatorCharm") -> None: self.framework.observe( charm.on[PRECHECK_ACTION_NAME].action, self._on_pre_upgrade_check_action ) @@ -60,7 +64,7 @@ def _observe_events(self, charm: CharmBase) -> None: ) self.framework.observe(charm.on.upgrade_charm, self._on_upgrade_charm) self.framework.observe(charm.on[RESUME_ACTION_NAME].action, self._on_resume_upgrade_action) - self.framework.observe(charm.on["force-upgrade"].action, self._on_force_upgrade_action) + self.framework.observe(charm.on["force-refresh"].action, self._on_force_upgrade_action) self.framework.observe(self.post_app_upgrade_event, self.run_post_app_upgrade_task) self.framework.observe(self.post_cluster_upgrade_event, self.run_post_cluster_upgrade_task) @@ -191,7 +195,7 @@ def run_post_app_upgrade_task(self, event: EventBase): By deferring before setting unit state to HEALTHY, the user will either: 1. have to wait for the unit to resolve itself. - 2. have to run the force-upgrade action (to upgrade the next unit). + 2. have to run the force-refresh action (to upgrade the next unit). """ logger.debug("Running post refresh checks to verify cluster is not broken after refresh") self.run_post_upgrade_checks(event, finished_whole_cluster=False)