schutzbot: unregister test hosts

This commit is contained in:
Sanne Raymaekers 2023-08-17 16:11:14 +02:00 committed by Ondřej Budai
parent 61da6124ed
commit 433515cff8
2 changed files with 23 additions and 0 deletions

View file

@ -10,6 +10,7 @@ stages:
- cat schutzbot/team_ssh_keys.txt | tee -a ~/.ssh/authorized_keys > /dev/null
after_script:
- schutzbot/ci_details.sh > ci-details-after-run
- schutzbot/unregister.sh
- schutzbot/update_github_status.sh update
tags:
- terraform

22
schutzbot/unregister.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# Colorful output.
function greenprint {
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
}
function redprint {
echo -e "\033[1;31m[$(date -Isecond)] ${1}\033[0m"
}
if ! hash subscription-manager; then
exit 0
fi
if ! sudo subscription-manager status; then
exit 0
fi
if sudo subscription-manager unregister; then
greenprint "Host unregistered."
exit 0
fi
redprint "Failed to unregister"
exit 1