diff --git a/snapcraft/commands/daemon.start b/snapcraft/commands/daemon.start index 188a6f8c3..8622927bd 100755 --- a/snapcraft/commands/daemon.start +++ b/snapcraft/commands/daemon.start @@ -295,6 +295,8 @@ echo "==> Setting up ceph configuration" if [ "${ceph_builtin:-"false"}" = "true" ]; then mkdir -p "${SNAP_COMMON}/ceph" ln -s "${SNAP_COMMON}/ceph" /etc/ceph +elif [ -e "/var/snap/microceph" ]; then + ln -s /var/snap/microceph/current/conf/ /etc/ceph else ln -s /var/lib/snapd/hostfs/etc/ceph /etc/ceph fi diff --git a/snapcraft/hooks/connect-plug-ceph-conf b/snapcraft/hooks/connect-plug-ceph-conf index edd8ab8cf..7546ddcdd 100755 --- a/snapcraft/hooks/connect-plug-ceph-conf +++ b/snapcraft/hooks/connect-plug-ceph-conf @@ -30,8 +30,11 @@ get_bool() { return } -ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") +# Only create symlinks if /etc has been generated by daemon.start. +if [ -e "/etc/.lxd_generated" ]; then + ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") -if ! [ "${ceph_builtin:-"false"}" = "true" ]; then - ln -snf ${SNAP_DATA}/microceph/conf/ /etc/ceph + if ! [ "${ceph_builtin:-"false"}" = "true" ]; then + ln -snf ${SNAP_DATA}/microceph/conf/ /etc/ceph + fi fi diff --git a/snapcraft/hooks/disconnect-plug-ceph-conf b/snapcraft/hooks/disconnect-plug-ceph-conf index 6df9ed9bf..519658fd8 100755 --- a/snapcraft/hooks/disconnect-plug-ceph-conf +++ b/snapcraft/hooks/disconnect-plug-ceph-conf @@ -30,11 +30,14 @@ get_bool() { return } -ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") +# Only create symlinks if /etc has been generated by daemon.start. +if [ -e "/etc/.lxd_generated" ]; then + ceph_builtin=$(get_bool "$(snapctl get ceph.builtin)") -if [ "${ceph_builtin:-"false"}" = "true" ]; then - mkdir -p "${SNAP_COMMON}/ceph" - ln -snf "${SNAP_COMMON}/ceph" /etc/ceph -else - ln -snf /var/lib/snapd/hostfs/etc/ceph /etc/ceph + if [ "${ceph_builtin:-"false"}" = "true" ]; then + mkdir -p "${SNAP_COMMON}/ceph" + ln -snf "${SNAP_COMMON}/ceph" /etc/ceph + else + ln -snf /var/lib/snapd/hostfs/etc/ceph /etc/ceph + fi fi