From e015c7a48e9d5030625e30ee4f8c523c2a7ff499 Mon Sep 17 00:00:00 2001 From: Max Asnaashari Date: Thu, 29 Feb 2024 18:33:34 +0000 Subject: [PATCH] snapcraft/hooks: Update MicroOVN content interface Signed-off-by: Max Asnaashari --- snapcraft.yaml | 6 +++--- ...nect-plug-ovn-api => connect-plug-ovn-certificates} | 10 +++++++--- snapcraft/hooks/connect-plug-ovn-chassis | 2 +- ...t-plug-ovn-api => disconnect-plug-ovn-certificates} | 0 4 files changed, 11 insertions(+), 7 deletions(-) rename snapcraft/hooks/{connect-plug-ovn-api => connect-plug-ovn-certificates} (75%) rename snapcraft/hooks/{disconnect-plug-ovn-api => disconnect-plug-ovn-certificates} (100%) diff --git a/snapcraft.yaml b/snapcraft.yaml index 231aa8429..4b7233dee 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -67,7 +67,7 @@ plugs: target: "$SNAP_DATA/microceph" ovn-api: interface: content - target: "$SNAP_DATA/microovn/api" + target: "$SNAP_DATA/microovn/certificates" ovn-chassis: interface: content target: "$SNAP_DATA/microovn/chassis" @@ -147,11 +147,11 @@ hooks: plugs: - lxd-support - system-observe - connect-plug-ovn-api: + connect-plug-ovn-certificates: plugs: - lxd-support - system-observe - disconnect-plug-ovn-api: + disconnect-plug-ovn-certificates: plugs: - lxd-support - system-observe diff --git a/snapcraft/hooks/connect-plug-ovn-api b/snapcraft/hooks/connect-plug-ovn-certificates similarity index 75% rename from snapcraft/hooks/connect-plug-ovn-api rename to snapcraft/hooks/connect-plug-ovn-certificates index f846b0d04..a2da70143 100755 --- a/snapcraft/hooks/connect-plug-ovn-api +++ b/snapcraft/hooks/connect-plug-ovn-certificates @@ -37,10 +37,14 @@ get_bool() { if [ -e "/etc/.lxd_generated" ]; then ovn_builtin=$(get_bool "$(snapctl get ovn.builtin)") + if test -d /etc/ovn ; then + rm -rf /etc/ovn + fi + if ! [ "${ovn_builtin:-"false"}" = "true" ]; then mkdir /etc/ovn - ln -snf "${SNAP_DATA}/microovn/api/client-cert.pem" /etc/ovn/cert_host - ln -snf "${SNAP_DATA}/microovn/api/client-privkey.pem" /etc/ovn/key_host - ln -snf "${SNAP_DATA}/microovn/api/cacert.pem" /etc/ovn/ovn-central.crt + ln -snf "${SNAP_DATA}/microovn/certificates/pki/client-cert.pem" /etc/ovn/cert_host + ln -snf "${SNAP_DATA}/microovn/certificates/pki/client-privkey.pem" /etc/ovn/key_host + ln -snf "${SNAP_DATA}/microovn/certificates/pki/cacert.pem" /etc/ovn/ovn-central.crt fi fi diff --git a/snapcraft/hooks/connect-plug-ovn-chassis b/snapcraft/hooks/connect-plug-ovn-chassis index 85cd67021..16496ad09 100755 --- a/snapcraft/hooks/connect-plug-ovn-chassis +++ b/snapcraft/hooks/connect-plug-ovn-chassis @@ -37,6 +37,6 @@ get_bool() { if [ -e "/etc/.lxd_generated" ]; then openvswitch_builtin=$(get_bool "$(snapctl get openvswitch.builtin)") if ! [ "${openvswitch_builtin:-"false"}" = "true" ]; then - ln -snf "${SNAP_DATA}/microovn/chassis" /run/openvswitch + ln -snf "${SNAP_DATA}/microovn/chassis/switch" /run/openvswitch fi fi diff --git a/snapcraft/hooks/disconnect-plug-ovn-api b/snapcraft/hooks/disconnect-plug-ovn-certificates similarity index 100% rename from snapcraft/hooks/disconnect-plug-ovn-api rename to snapcraft/hooks/disconnect-plug-ovn-certificates