From b363aa623bfac16d1aa81bdac06c61846d56ea69 Mon Sep 17 00:00:00 2001 From: Konstantinos Tsakalozos Date: Mon, 10 Feb 2020 08:18:46 +0000 Subject: [PATCH] Set the enable-v2 etcd flag if missing --- snap/hooks/configure | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/snap/hooks/configure b/snap/hooks/configure index 67a6420529..6953ba7a35 100755 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -310,12 +310,8 @@ fi if grep -e "etcd.socket:2379" ${SNAP_DATA}/args/etcd then - # TODO: Do something smart in selecting a port - installed=`${SNAP}/bin/grep '\-\-enable\-v2=true' ${SNAP}/args/etcd | wc -l` - if [ ${installed} -eq 0 ]; then - refresh_opt_in_config enable-v2 true etcd - fi echo "Using a port for etcd" + # TODO: Do something smart in selecting a port refresh_opt_in_config advertise-client-urls https://\${DEFAULT_INTERFACE_IP_ADDR}:12379 etcd refresh_opt_in_config listen-client-urls https://0.0.0.0:12379 etcd refresh_opt_in_config client-cert-auth true etcd @@ -331,6 +327,12 @@ then need_api_restart=true fi +if ! grep '\-\-enable\-v2' ${SNAP_DATA}/args/etcd +then + refresh_opt_in_config enable-v2 true etcd + snapctl restart ${SNAP_NAME}.daemon-etcd +fi + if ${need_api_restart} then snapctl restart ${SNAP_NAME}.daemon-apiserver