Skip to content

Commit c52cab8

Browse files
committed
Add warning messages to logs if StackStorm running with python 2
1 parent f17e0b0 commit c52cab8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

st2common/st2common/constants/error_messages.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
__all__ = [
1717
'PACK_VIRTUALENV_DOESNT_EXIST',
18-
'PACK_VIRTUALENV_USES_PYTHON3'
18+
'PACK_VIRTUALENV_USES_PYTHON3',
19+
'PYTHON2_DEPREATION'
1920
]
2021

2122
PACK_VIRTUALENV_DOESNT_EXIST = '''
@@ -32,3 +33,7 @@
3233
virtual environment with python2 binary:
3334
"st2 run packs.setup_virtualenv packs=%(pack)s python3=false"
3435
'''
36+
37+
PYTHON2_DEPRECATION = 'DEPRECATION WARNING. Support for python 2 will be removed in future StackStorm ' \
38+
'release(s). Please ensure that all packs used are python 3 compatible. Python 3 will already be used ' \
39+
'if you upgrade to a newer OS release.'

st2common/st2common/service_setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from st2common.util import system_info
4343
from st2common.services import coordination
4444
from st2common.logging.misc import add_global_filters_for_all_loggers
45+
from st2common.constants.error_messages import PYTHON2_DEPRECATION
4546

4647
# Note: This is here for backward compatibility.
4748
# Function has been moved in a standalone module to avoid expensive in-direct
@@ -186,6 +187,10 @@ def setup(service, config, setup_db=True, register_mq_exchanges=True,
186187
register_service_in_service_registry(service=service, capabilities=capabilities,
187188
start_heart=True)
188189

190+
if sys.version_info[0] == 2:
191+
LOG.warning(PYTHON2_DEPRECATION)
192+
193+
189194

190195
def teardown():
191196
"""

0 commit comments

Comments
 (0)