diff --git a/snap/hooks/post-refresh b/snap/hooks/post-refresh deleted file mode 120000 index f7ffc47a..00000000 --- a/snap/hooks/post-refresh +++ /dev/null @@ -1 +0,0 @@ -install \ No newline at end of file diff --git a/snap/hooks/post-refresh b/snap/hooks/post-refresh new file mode 100755 index 00000000..6d405190 --- /dev/null +++ b/snap/hooks/post-refresh @@ -0,0 +1,25 @@ +#!/bin/sh +set -uex +conf="${SNAP_DATA}/conf" +mkdir -p -m 0755 "${conf}" +cp "${SNAP}/share/metadata.yaml" "${conf}" + +# Check if we need to set the osd-release option. +set +e +trap 'exit 0' ERR + +versions=`microceph.ceph versions` +ov_len=echo $versions | jq '.["overall"] | length' +if [ $ov_len > 1 ]; then + echo "Not all nodes are running the same version" + exit 0 +fi + +osd_len=echo $versions | jq '.["osd"] | length' +if [ $osd_len < 1 ]; then + echo "No osd versions found" + exit 0 +fi + +new_version=`microceph.ceph -v` | awk '{print $5}' +microceph.ceph osd require-osd-release $new_version --yes-i-really-mean-it