Skip to content

Commit

Permalink
remove redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Sep 18, 2023
1 parent ab4bda8 commit 7401c8a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,13 +810,11 @@ def _install_snap_packages(self, packages: List[str]) -> None:
try:
snap_cache = snap.SnapCache()
snap_package = snap_cache[snap_name]

if not snap_package.present:
snap_package.ensure(
snap.SnapState.Latest, channel=snap_channel, revision=snap_revision
)
# snaps will auto refresh so it is necessary to hold the current revision
snap_package.hold()
snap_package.ensure(
snap.SnapState.Latest, channel=snap_channel, revision=snap_revision
)
# snaps will auto refresh so it is necessary to hold the current revision
snap_package.hold()

except snap.SnapError as e:
logger.error(
Expand Down

0 comments on commit 7401c8a

Please sign in to comment.