Skip to content

Commit

Permalink
Merge pull request #171 from masnax/content-interface-ceph
Browse files Browse the repository at this point in the history
snapcraft/commands: Setup /etc in common file
  • Loading branch information
tomponline authored Sep 29, 2023
2 parents d35e624 + 4863877 commit 010916e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions snapcraft/hooks/connect-plug-ceph-conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 9 additions & 6 deletions snapcraft/hooks/disconnect-plug-ceph-conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 010916e

Please sign in to comment.