Skip to content

Commit 352d149

Browse files
authored
Merge pull request #5068 from StackStorm/better-st2-self-check-error-messages
Better st2-self-check error messages
2 parents ef854af + f54c68f commit 352d149

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changelog
44
in development
55
--------------
66

7+
Changed
8+
~~~~~~~~~
9+
* Improve the st2-self-check script to echo to stderr and exit if it isn't run with a
10+
ST2_AUTH_TOKEN or ST2_API_KEY environment variable. (improvement) #5068
711

812
3.3.0 - October 06, 2020
913
------------------------

st2common/bin/st2-self-check

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ shift $(($OPTIND-1))
5757

5858
## Script to install samples, tests, and run all workflows in tests pack.
5959
if [[ `id -u` != 0 ]]; then
60-
echo "st2-self-check must be run as root"
60+
echo >&2 "st2-self-check must be run as root"
61+
exit 1
62+
fi
63+
64+
if [[ -z "$ST2_AUTH_TOKEN" && -z "$ST2_API_KEY" ]]; then
65+
echo >&2 "st2-self-check must be run with an auth token or API key in an environment variable"
66+
echo >&2 "Please export a valid auth token in ST2_AUTH_TOKEN or a valid API key in ST2_API_KEY"
67+
echo >&2 "and re-run st2-self-check"
6168
exit 1
6269
fi
6370

@@ -89,7 +96,7 @@ git clone --depth 1 --branch ${ST2_TESTS_BRANCH} https://github.com/StackStorm/s
8996
EXIT_CODE=$?
9097

9198
if [ ${EXIT_CODE} -ne 0 ]; then
92-
echo "Failed to clone st2tests repo"
99+
echo >&2 "Failed to clone st2tests repo"
93100
exit 1
94101
fi
95102

0 commit comments

Comments
 (0)