Skip to content

Commit 4f64909

Browse files
author
Patrick Hoolboom
committed
Adding st2-self-check script
1 parent 4f84c0d commit 4f64909

File tree

2 files changed

+11
-36
lines changed

2 files changed

+11
-36
lines changed

tools/st2-self-check renamed to st2common/bin/st2-self-check

+10-36
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,14 @@ done
3232
shift $(($OPTIND-1))
3333

3434
## Script to install samples, tests, and run all workflows in tests pack.
35+
if [[ `id -u` != 0 ]]; then
36+
echo "st2-self-check must be run as root"
37+
exit 1
38+
fi
39+
3540
ERRORS=0
3641
PACKS="tests examples"
3742

38-
#Determine Distro
39-
DEBTEST=`lsb_release -a 2> /dev/null | grep Distributor | awk '{print $3}'`
40-
41-
if [[ "$DEBTEST" == "Ubuntu" ]]; then
42-
TYPE="debs"
43-
PYTHONPACK="/usr/lib/python2.7/dist-packages"
44-
elif [[ -f "/etc/redhat-release" ]]; then
45-
TYPE="rpms"
46-
PYTHONPACK="/usr/lib/python2.7/site-packages"
47-
else
48-
echo "Unknown Operating System"
49-
exit 2
50-
fi
51-
5243
#Determine API HTTP Protocol
5344
PROTOCOL="http"
5445
ST2_CLI_CONFIG_FILE=`readlink -f ~/.st2/config`
@@ -68,29 +59,12 @@ elif [ -e "${ST2_CLI_CONFIG_FILE}" ]; then
6859
fi
6960
fi
7061

71-
# Install test prerequisites
72-
${PYTHONPACK}/st2common/bin/st2-setup-tests asserts
73-
${PYTHONPACK}/st2common/bin/st2-setup-tests fixtures
62+
echo -n "Installing asserts,fixtures,tests"
63+
st2 run packs.install subtree=true repo_url=StackStorm/st2tests packs=asserts,fixtures,tests
7464

75-
# Install required packs if necessary
76-
for PACK in $PACKS; do
77-
CHECK=`st2 action list --pack=${PACK} | grep ${PACK}`
78-
if [ $? -ne 0 ]; then
79-
if [ "$PACK" == "tests" ]; then
80-
ARG="tests"
81-
else
82-
ARG=""
83-
fi
84-
INSTALL=`${PYTHONPACK}/st2common/bin/st2-setup-${PACK} ${ARG}`
85-
86-
EXITCODE=$?
87-
echo $INSTALL
88-
if [ ${EXITCODE} -ne 0 ]; then
89-
echo "st2-self-check failed. See above."
90-
exit 2
91-
fi
92-
fi
93-
done
65+
echo -n "Installing examples"
66+
cp -Rf /usr/share/doc/st2/examples /opt/stackstorm/packs/
67+
st2ctl reload
9468

9569
# Retrieve test action list
9670
TEST_ACTION_LIST=`st2 action list --pack=tests -w 90 | awk '{ print $2 }' | grep -v "|" | grep -v "ref"`

st2common/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
'bin/st2ctl',
5252
'bin/st2-generate-symmetric-crypto-key',
5353
'bin/migrations/v1.5/st2-migrate-datastore-to-include-scope-secret.py',
54+
'bin/st2-self-check'
5455
]
5556
)

0 commit comments

Comments
 (0)