Skip to content

Commit

Permalink
python3.8 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Mar 4, 2024
1 parent f84d472 commit 51137bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ class _RefreshVerb(str, enum.Enum):


def _refresh(*, unit: ops.Unit, verb: _RefreshVerb) -> None:
logger.debug(f'{verb.capitalize().removesuffix("e")}ing {_SNAP_NAME=}, {REVISION=}')
unit.status = ops.MaintenanceStatus(f'{verb.capitalize().removesuffix("e")}ing snap')
# TODO python3.10 min version: use `removesuffix` instead of `rstrip`
logger.debug(f'{verb.capitalize().rstrip("e")}ing {_SNAP_NAME=}, {REVISION=}')
unit.status = ops.MaintenanceStatus(f'{verb.capitalize().rstrip("e")}ing snap')

def _set_retry_status(_) -> None:
message = f"Snap {verb} failed. Retrying..."
Expand All @@ -48,7 +49,7 @@ def _set_retry_status(_) -> None:
with attempt:
_snap.ensure(state=snap_lib.SnapState.Present, revision=REVISION)
_snap.hold()
logger.debug(f'{verb.capitalize().removesuffix("e")}ed {_SNAP_NAME=}, {REVISION=}')
logger.debug(f'{verb.capitalize().rstrip("e")}ed {_SNAP_NAME=}, {REVISION=}')


def install(*, unit: ops.Unit, model_uuid: str):
Expand Down

0 comments on commit 51137bc

Please sign in to comment.