Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Nov 7, 2023
1 parent 510c0b2 commit 1df8c76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/charms/mongodb/v0/mongodb_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re
import subprocess
import time
from typing import Dict, List
from typing import Dict, List, Optional

from charms.data_platform_libs.v0.s3 import CredentialsChangedEvent, S3Requirer
from charms.mongodb.v0.helpers import (
Expand Down Expand Up @@ -420,11 +420,15 @@ def _wait_pbm_status(self) -> None:
except ExecError as e:
self.charm.unit.status = BlockedStatus(process_pbm_error(e.stdout))

def _get_pbm_status(self) -> StatusBase:
def _get_pbm_status(self) -> Optional[StatusBase]:
"""Retrieve pbm status."""
if not self.charm.has_backup_service():
return WaitingStatus("waiting for pbm to start")

if not self.model.get_relation(S3_RELATION):
logger.info("No configurations for backups, not relation to s3-charm.")
return None

try:
previous_pbm_status = self.charm.unit.status
pbm_status = self.charm.run_pbm_command(PBM_STATUS_CMD)
Expand Down

0 comments on commit 1df8c76

Please sign in to comment.