Skip to content

Commit

Permalink
more error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
SK1Y101 committed Oct 2, 2024
1 parent 7c8c6dd commit ccf0a65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion maas-agent/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _on_collect_status(self, e: ops.CollectStatusEvent) -> None:
if not isinstance(self.unit.status, ops.BlockedStatus):
e.add_status(
ops.BlockedStatus(
f"Failed to install MAAS snap - {installed} !- {MAAS_SNAP_CHANNEL}"
f"Failed to install MAAS snap - {installed}!={MAAS_SNAP_CHANNEL}"
)
)
elif not self.maas_region.get_enroll_data():
Expand Down
8 changes: 6 additions & 2 deletions maas-region/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,14 @@ def _on_upgrade_charm(self, _event: ops.UpgradeCharmEvent) -> None:
logger.error(str(ex))

def _on_collect_status(self, e: ops.CollectStatusEvent) -> None:
if MaasHelper.get_installed_channel() != MAAS_SNAP_CHANNEL:
if (installed := MaasHelper.get_installed_channel()) and (installed != MAAS_SNAP_CHANNEL):
# skip if we've already set blocked due to attempting a downgrade
if not isinstance(self.unit.status, ops.BlockedStatus):
e.add_status(ops.BlockedStatus("Failed to install MAAS snap"))
e.add_status(
ops.BlockedStatus(
f"Failed to install MAAS snap - {installed}!={MAAS_SNAP_CHANNEL}"
)
)
elif not self.unit.opened_ports().issuperset(MAAS_REGION_PORTS):
e.add_status(ops.WaitingStatus("Waiting for service ports"))
elif not self.connection_string:
Expand Down

0 comments on commit ccf0a65

Please sign in to comment.