Skip to content

Commit 00f71ef

Browse files
authored
Merge pull request #5044 from StackStorm/py2_warning_st2ctl
Add deprecation warning on st2ctl start if st2/python is python 2.x
2 parents ce1a7f3 + 1165ba9 commit 00f71ef

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Added
2727
Python 2. (new feature) #5043
2828

2929
Contributed by @amanda11
30+
* Added deprecation warning to st2ctl, if st2 python version is Python 2. (new feature) #5044
31+
32+
Contributed by @amanda11
3033

3134

3235
Changed

st2common/bin/st2ctl

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

86+
function check_python_version() {
87+
PYTHON_VERSION=$(/opt/stackstorm/st2/bin/python --version 2>&1 | awk -F"[. ]" '{print $2}')
88+
if [ "${PYTHON_VERSION}" = "2" ]; then
89+
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"
90+
fi
91+
}
92+
8693
function st2start() {
8794
for COM in ${COMPONENTS}; do
8895
service_manager ${COM} start
8996
done
97+
check_python_version
9098
}
9199

92100
function st2stop() {
@@ -213,6 +221,7 @@ case ${1} in
213221
must_be_root
214222
validate_in_components ${2}
215223
service_manager ${2} restart
224+
check_python_version
216225
;;
217226
reopen-log-files)
218227
must_be_root
@@ -225,6 +234,7 @@ case ${1} in
225234
reload)
226235
register_content ${@:2}
227236
exit_code=$?
237+
check_python_version
228238
getpids
229239
# Note: We want to preserve st2-register-content "fail on failure" behavior
230240
# and propagate the correct exit code and exit with non zero on failure

0 commit comments

Comments
 (0)