Skip to content

Commit a930540

Browse files
Disable charmed-mysql snap automatic updates (#64)
1 parent 802ff04 commit a930540

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/snap.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ def _set_retry_status(_) -> None:
3535
unit.status = ops.MaintenanceStatus(message)
3636
logger.debug(message)
3737

38-
try:
39-
for attempt in tenacity.Retrying(
40-
stop=tenacity.stop_after_delay(60 * 5),
41-
wait=tenacity.wait_exponential(multiplier=10),
42-
retry=tenacity.retry_if_exception_type(snap_lib.SnapError),
43-
after=_set_retry_status,
44-
reraise=True,
45-
):
46-
with attempt:
47-
_snap.ensure(state=snap_lib.SnapState.Present, revision=_REVISION)
48-
except snap_lib.SnapError:
49-
raise
38+
for attempt in tenacity.Retrying(
39+
stop=tenacity.stop_after_delay(60 * 5),
40+
wait=tenacity.wait_exponential(multiplier=10),
41+
retry=tenacity.retry_if_exception_type(snap_lib.SnapError),
42+
after=_set_retry_status,
43+
reraise=True,
44+
):
45+
with attempt:
46+
_snap.ensure(state=snap_lib.SnapState.Present, revision=_REVISION)
47+
_snap.hold()
5048
logger.debug(f"Installed {_SNAP_NAME=}, {_REVISION=}")
5149

5250

0 commit comments

Comments
 (0)