[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
This commit is contained in:
Jay Faulkner 2024-07-25 13:50:59 -07:00
parent acf1c7d43e
commit bfdfd6c161

View File

@ -3516,12 +3516,19 @@ function downgrade_dnsmasq {
# NOTE(TheJulia): The intent here is to use dnsmasq version # NOTE(TheJulia): The intent here is to use dnsmasq version
# which does not crash on segfaults or sigabort when configuration # which does not crash on segfaults or sigabort when configuration
# is updated. See https://bugs.launchpad.net/ironic/+bug/2026757 # is updated. See https://bugs.launchpad.net/ironic/+bug/2026757
sudo dpkg -r dnsmasq-base if dnsmasq --version | grep -q "Dnsmasq version 2.85"; then
git clone http://thekelleys.org.uk/git/dnsmasq.git -b v2.85 --depth 1 # NOTE(JayF) Keep Ironic devstack plugin idempotent by skipping
pushd dnsmasq # downgrade if we already have the desired version.
sed -i 's|^PREFIX.*|PREFIX = /usr|' Makefile echo "Dnsmasq already downgraded, continuing..."
sudo make install else
popd 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 # Restore xtrace + pipefail