From bfdfd6c161e84e31e99052fa1ae639cd01f11eb2 Mon Sep 17 00:00:00 2001 From: Jay Faulkner Date: Thu, 25 Jul 2024 13:50:59 -0700 Subject: [PATCH] [devstack] Ensure downgrade_dnsmasq is idempotent Right now, when restacking to get new code checked out, we fail due to the dnsmasq directory already existing. Now, skip the downgrade if we detect the correct version -- as we would on a second run. Change-Id: I5c3d28f75b66d14540cbafa03bff8b7def688da5 --- devstack/lib/ironic | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 72d6c36dbe..0585a4049c 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -3516,12 +3516,19 @@ function downgrade_dnsmasq { # NOTE(TheJulia): The intent here is to use dnsmasq version # which does not crash on segfaults or sigabort when configuration # is updated. See https://bugs.launchpad.net/ironic/+bug/2026757 - sudo dpkg -r dnsmasq-base - git clone http://thekelleys.org.uk/git/dnsmasq.git -b v2.85 --depth 1 - pushd dnsmasq - sed -i 's|^PREFIX.*|PREFIX = /usr|' Makefile - sudo make install - popd + if dnsmasq --version | grep -q "Dnsmasq version 2.85"; then + # NOTE(JayF) Keep Ironic devstack plugin idempotent by skipping + # downgrade if we already have the desired version. + echo "Dnsmasq already downgraded, continuing..." + else + echo "Downgrading dnsmasq..." + sudo dpkg -r dnsmasq-base + git clone http://thekelleys.org.uk/git/dnsmasq.git -b v2.85 --depth 1 + pushd dnsmasq + sed -i 's|^PREFIX.*|PREFIX = /usr|' Makefile + sudo make install + popd + fi } # Restore xtrace + pipefail