Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warning on st2ctl start if st2/python is python 2.x #5044

Merged
merged 7 commits into from
Sep 28, 2020

Conversation

amanda11
Copy link
Contributor

@amanda11 amanda11 commented Sep 21, 2020

Add warning messages in yellow to screen if perform st2ctl start (or restart) and /opt/stackstorm/st2/bin/python is python 2.x

Addresses part of #5041 and #4938

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Sep 21, 2020
@amanda11
Copy link
Contributor Author

image

@amanda11 amanda11 requested a review from arm4b September 22, 2020 19:07
@@ -87,6 +87,11 @@ function st2start() {
for COM in ${COMPONENTS}; do
service_manager ${COM} start
done
PYTHON_VERSION=$(/opt/stackstorm/st2/bin/python --version 2>&1 | awk '{print $2'} | awk -F"." '{print $1}')
if [ "${PYTHON_VERSION}" = "2" ]; then
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"
Copy link
Member

@arm4b arm4b Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks nice!

Can we include the Deprecation warning for the st2ctl reload/register actions as well to make it even more visible so users can't ignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be easy enough to add - will do.

Copy link
Contributor

@nzlosh nzlosh Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing major, but the second awk is redundant. A single call to awk can give the python major version, as follows

$ python --version 2>&1
Python 3.6.11

$ python --version 2>&1 | awk -F"[. ]" '{print $2}'
3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - will fix that up as well. And also try and remember the bit of ST2 I stole it from!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armab Added warning into st2ctl reload and st2ctl restart-component. (start and restart covered by logic already there).
@nzlosh Thanks for the awk comment, much neater now, that's much neater (I'd stolen it from st2-self-check - but I won't patch that up under this PR).

@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. and removed size/XS PR that changes 0-9 lines. Quick fix/merge. labels Sep 24, 2020
CHANGELOG.rst Outdated Show resolved Hide resolved
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

Thanks @nzlosh for additional awk tips!

@amanda11 amanda11 merged commit 00f71ef into master Sep 28, 2020
@amanda11 amanda11 deleted the py2_warning_st2ctl branch September 28, 2020 14:14
@amanda11 amanda11 added this to the 3.3.0 milestone Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature size/S PR that changes 10-29 lines. Very easy to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants