Skip to content

Commit

Permalink
Resolve conflicts with getting the snap_version
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Nov 13, 2024
1 parent fb00015 commit b28dc12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions charms/worker/build-snap-installation.sh
6 changes: 6 additions & 0 deletions charms/worker/k8s/build-snap-installation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

# Create an empty tarball to be used as a placeholder for the snap installation override
touch "snap-installation.tar.gz"
6 changes: 4 additions & 2 deletions charms/worker/k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ def _update_kubernetes_version(self):
relation = self.model.get_relation("cluster")
if not relation:
raise ReconcilerError("Missing cluster integration")
if version := snap_version("k8s"):
version, _ = snap_version("k8s")
if version:
relation.data[self.unit]["version"] = version

@on_error(ops.WaitingStatus("Announcing Kubernetes version"))
Expand All @@ -657,7 +658,8 @@ def _announce_kubernetes_version(self):
ReconcilerError: If the k8s snap is not installed, the version is missing,
or the version does not match the local version.
"""
if not (local_version := snap_version("k8s")):
local_version, _ = snap_version("k8s")
if not local_version:
raise ReconcilerError("k8s-snap is not installed")

peer = self.model.get_relation("cluster")
Expand Down

0 comments on commit b28dc12

Please sign in to comment.