schutzbot: unregister test hosts

This commit is contained in:
Sanne Raymaekers 2023-08-17 15:44:58 +02:00 committed by Ondřej Budai
parent a0af3a7776
commit d282cb0cff
2 changed files with 23 additions and 0 deletions

View file

@ -12,6 +12,7 @@ stages:
- cat schutzbot/team_ssh_keys.txt | tee -a ~/.ssh/authorized_keys > /dev/null - cat schutzbot/team_ssh_keys.txt | tee -a ~/.ssh/authorized_keys > /dev/null
after_script: after_script:
- schutzbot/ci_details.sh > /tmp/artifacts/ci-details-after-run.txt || true - schutzbot/ci_details.sh > /tmp/artifacts/ci-details-after-run.txt || true
- schutzbot/unregister.sh || true
- schutzbot/update_github_status.sh update || true - schutzbot/update_github_status.sh update || true
- schutzbot/save_journal.sh || true - schutzbot/save_journal.sh || true
- schutzbot/upload_artifacts.sh - schutzbot/upload_artifacts.sh

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