Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMPET-7263: Force goss-servers to wait until hostname is set #610

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions systemd/start-goss-servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ fi
export KUBECONFIG=/etc/kubernetes/admin.conf

# necessary for test that 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)$"
HOSTNAME=$(hostname -s)
while [[ ! ${HOSTNAME} =~ ${pattern} ]]; do
sleep 5
HOSTNAME=$(hostname -s)
done

export HOSTNAME

# During the NCN image build, this service is started, even though the csm-testing RPM is not installed. In that
Expand All @@ -44,6 +52,12 @@ export HOSTNAME
# there is likewise a chance that this service is started just before the csm-testing RPM has been installed. In both
# cases, the solution if the run-ncn-tests.sh file does not exist (or exists but is empty, for some weird reason)
# is to sleep for a bit and check again.
while ! rpm -q csm-testing > /dev/null 2>&1; do
sleep 5
done
# Include the versions of these to help with debugging
rpm -q csm-testing goss-servers

while [[ ! -s "${GOSS_BASE}/automated/run-ncn-tests.sh" ]]; do
sleep 5
done
Expand Down