Skip to content

Commit

Permalink
Merge pull request canonical#437 from simondeziel/ovn-clean
Browse files Browse the repository at this point in the history
daemon.start: only cleanup /etc/ovn if interfacing with microovn
  • Loading branch information
tomponline authored Apr 23, 2024
2 parents 16f6d21 + 7eda212 commit c266d95
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -321,27 +321,36 @@ sed \
"${SNAP}/etc/lvm/lvm.conf" > /etc/lvm/lvm.conf

# Setup for OVN
echo "==> Cleaning up OVN configuration"
if [ -L /etc/ovn ]; then
echo "=> Removing /etc/ovn symlink"
rm -f /etc/ovn
elif [ -d /etc/ovn ]; then
echo "=> Removing /etc/ovn directory"
rm -rf /etc/ovn
fi

echo "==> Setting up OVN configuration"
if [ "${ovn_builtin:-"false"}" = "true" ]; then
echo "=> Using builtin OVN"
mkdir -p "${SNAP_COMMON}/ovn"
ln -s "${SNAP_COMMON}/ovn" /etc/ovn
elif [ -d "${SNAP_DATA}/microovn/certificates/pki" ]; then
echo "==> Cleaning up OVN configuration"
if [ -L /etc/ovn ]; then
echo "=> Removing /etc/ovn symlink"
rm -f /etc/ovn
elif [ -d /etc/ovn ]; then
echo "=> Removing /etc/ovn directory"
rm -rf /etc/ovn
fi

echo "=> Detected MicroOVN Content Interface"
mkdir -p /etc/ovn
ln -s "${SNAP_DATA}/microovn/certificates/pki/client-cert.pem" /etc/ovn/cert_host
ln -s "${SNAP_DATA}/microovn/certificates/pki/client-privkey.pem" /etc/ovn/key_host
ln -s "${SNAP_DATA}/microovn/certificates/pki/cacert.pem" /etc/ovn/ovn-central.crt
elif [ -d /var/snap/microovn/ ]; then
echo "==> Cleaning up OVN configuration"
if [ -L /etc/ovn ]; then
echo "=> Removing /etc/ovn symlink"
rm -f /etc/ovn
elif [ -d /etc/ovn ]; then
echo "=> Removing /etc/ovn directory"
rm -rf /etc/ovn
fi

echo "=> Detected MicroOVN"
mkdir -p /etc/ovn
ln -s /var/snap/microovn/common/data/pki/client-cert.pem /etc/ovn/cert_host
Expand Down

0 comments on commit c266d95

Please sign in to comment.