Skip to content

Commit

Permalink
[Backport release/1.4] CASMPET-7266: Fix hostname regex in start-goss…
Browse files Browse the repository at this point in the history
…-servers.sh (#620)

CASMPET-7266: Fix hostname regex in start-goss-servers.sh

(cherry picked from commit a7d7d42)

Co-authored-by: Mitch Harding (the weird one) <mitchell.harding@hpe.com>
  • Loading branch information
github-actions[bot] and mharding-hpe authored Nov 1, 2024
1 parent 552153f commit f9833ac
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions start-goss-servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9833ac

Please sign in to comment.