Skip to content

Commit

Permalink
Improve message with unsupported channel (#583)
Browse files Browse the repository at this point in the history
* Improve message with unsupported channel

This is the message that's printed when COU finds a charm that
is a newer channel than supported by the current OpenStack deployment.

Fixes: #461

* update message
  • Loading branch information
samuelallan72 authored Oct 11, 2024
1 parent bd216c1 commit e9633e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
11 changes: 7 additions & 4 deletions cou/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def _get_upgrade_charm_steps(self, target: OpenStackRelease) -> list[UpgradeStep
:param target: OpenStack release as target to upgrade.
:type target: OpenStackRelease
:raises ApplicationError: When the current channel is ahead from expected and the target.
:raises ApplicationError: When the current channel is ahead of the upgrade target.
:return: List of steps for upgrading the charm.
:rtype: list[UpgradeStep]
"""
Expand Down Expand Up @@ -694,9 +694,12 @@ def _get_upgrade_charm_steps(self, target: OpenStackRelease) -> list[UpgradeStep
]

raise ApplicationError(
f"The '{self.name}' application is using channel '{self.channel}'. Channels supported "
f"during this transition: '{self.expected_current_channel(target)}', "
f"'{self.target_channel(target)}'. Manual intervention is required."
f"The '{self.name}' application is using an unexpected channel: '{self.channel}'. "
"Channels supported during this upgrade are, "
f"before upgrade: '{self.expected_current_channel(target)}', "
f"or after upgrade: '{self.target_channel(target)}'. "
"Manual intervention required, most likely to manually upgrade "
"other cloud components until all are consistent releases."
)

def _set_action_managed_upgrade(self, enable: bool) -> UpgradeStep:
Expand Down
8 changes: 1 addition & 7 deletions tests/unit/apps/test_auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,13 +1653,7 @@ def test_auxiliary_wrong_channel(model):
# plan will raise exception because the channel is on quincy and was expected to be on octopus
# or pacific. The user will need manual intervention

exp_msg = (
r"^The 'ceph-mon' application is using channel 'quincy/stable'\. Channels supported during"
r" this transition: '(octopus/stable)', '(octopus/stable)'\. "
r"Manual intervention is required\.$"
)

with pytest.raises(ApplicationError, match=exp_msg):
with pytest.raises(ApplicationError, match=".*unexpected channel.*"):
app.generate_upgrade_plan(target, force=False)


Expand Down
9 changes: 1 addition & 8 deletions tests/unit/apps/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,14 +1128,7 @@ def test_core_wrong_channel(model):

# plan will raise exception because the channel is on wallaby and was expected to be on ussuri
# or victoria. The user will need manual intervention

exp_msg = (
r"^The 'keystone' application is using channel 'wallaby/stable'\. Channels supported "
r"during this transition: '(ussuri/stable)', '(victoria/stable)'\. "
r"Manual intervention is required\.$"
)

with pytest.raises(ApplicationError, match=exp_msg):
with pytest.raises(ApplicationError, match=".*unexpected channel.*"):
app.generate_upgrade_plan(target, force=False)


Expand Down

0 comments on commit e9633e1

Please sign in to comment.