Skip to content

Commit

Permalink
add early exit if oc user not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
William McEnery committed Feb 7, 2024
1 parent bca255f commit 7230f87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions generate_postmortem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ warn_if_script_is_not_latest() {
which oc &> /dev/null
if [[ $? -eq 0 ]]; then
KUBECTL="oc"
$KUBECTL whoami
if [[ $? -ne 0 ]]; then
echo "Error: oc whoami failed. This script requires you to be logged in to the server. EXITING..."
exit 1
fi
else
which kubectl &> /dev/null
if [[ $? -ne 0 ]]; then
Expand Down

0 comments on commit 7230f87

Please sign in to comment.