Skip to content

Commit 050077e

Browse files
committed
Tidy up awk, add to reload and restart-component
1 parent 68fab5b commit 050077e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

st2common/bin/st2ctl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,18 @@ function validate_in_components() {
8383
fi
8484
}
8585

86-
function st2start() {
87-
for COM in ${COMPONENTS}; do
88-
service_manager ${COM} start
89-
done
90-
PYTHON_VERSION=$(/opt/stackstorm/st2/bin/python --version 2>&1 | awk '{print $2'} | awk -F"." '{print $1}')
86+
function check_python_version() {
87+
PYTHON_VERSION=$(/opt/stackstorm/st2/bin/python --version 2>&1 | awk -F"[. ]" '{print $2}')
9188
if [ "${PYTHON_VERSION}" = "2" ]; then
9289
echo -e "\e[33mDeprecation warning: Support for python 2 will be removed in future StackStorm releases. Please ensure that all packs used are python 3 compatible. Your StackStorm installation may be upgraded from python 2 to python 3 in future platform releases. It is recommended to plan the manual migration to a python 3 native platform, e.g. Ubuntu 18.04 LTS or CentOS/RHEL 8. \e[0m\n"
9390
fi
91+
}
9492

93+
function st2start() {
94+
for COM in ${COMPONENTS}; do
95+
service_manager ${COM} start
96+
done
97+
check_python_version
9598
}
9699

97100
function st2stop() {
@@ -218,6 +221,7 @@ case ${1} in
218221
must_be_root
219222
validate_in_components ${2}
220223
service_manager ${2} restart
224+
check_python_version
221225
;;
222226
reopen-log-files)
223227
must_be_root
@@ -229,6 +233,7 @@ case ${1} in
229233
;;
230234
reload)
231235
register_content ${@:2}
236+
check_python_version
232237
exit_code=$?
233238
getpids
234239
# Note: We want to preserve st2-register-content "fail on failure" behavior

0 commit comments

Comments
 (0)