Skip to content

Commit

Permalink
fix: rename to
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu1nness committed Oct 1, 2024
1 parent 37f0791 commit 9b54dd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/upgrades/machine_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`"
Expand Down
14 changes: 9 additions & 5 deletions src/upgrades/mongodb_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -25,6 +26,9 @@
from config import Config
from upgrades import machine_upgrade

if TYPE_CHECKING:
from charm import MongodbOperatorCharm

logger = logging.getLogger(__name__)


Expand All @@ -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
)
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9b54dd1

Please sign in to comment.