From ad0d0cbefd16d7cb83da01aefb4bfb99ce76ec2d Mon Sep 17 00:00:00 2001 From: Mitch Harding Date: Fri, 1 Nov 2024 12:14:34 -0400 Subject: [PATCH] CASMPET-7266: Fix hostname regex in start-goss-servers.sh (#618) --- systemd/start-goss-servers.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/systemd/start-goss-servers.sh b/systemd/start-goss-servers.sh index 031eaf2a..b5449f7a 100644 --- a/systemd/start-goss-servers.sh +++ b/systemd/start-goss-servers.sh @@ -34,10 +34,18 @@ fi # necessary for kubectl commands to run export KUBECONFIG=/etc/kubernetes/admin.conf -# necessary for test that need to know the current hostname +# Some tests need to know the current hostname. +# # It is possible for this service to start before cloud-init has assigned a hostname to the NCN. # If the hostname is not in one of the expected formats, sleep and check later. -pattern="(ncn-[msw][0-9]{3}|-pit)$" +# +# This will also have the effect that if goss-servers is installed on a node which is not an +# NCN or PIT, it will never proceed beyond this point -- which is fine because those are the only +# node types defined in dat/goss-servers.cfg, and therefore are the only node types where this service +# will start up any test endpoints. +# +# This regex should match the ones used in lib/endpoints.py for determining node type +pattern="^(ncn-[msw][0-9]{3}|pit)$" HOSTNAME=$(hostname -s) while [[ ! ${HOSTNAME} =~ ${pattern} ]]; do sleep 5