Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ Fixed

Removed
~~~~~~~~
* Removed submit-debug-info tool and the st2debug component #5103
* Removed --python3 pack install option #5100
Contributed by @amanda11

* Removed submit-debug-info tool and the st2debug component #5103

* Removed check-licence script (cleanup) #5092
Contributed by @kroustou
* Updated Makefile and CI to use Python 3 only, removing Python 2 (cleanup) #5090
Expand Down
4 changes: 0 additions & 4 deletions conf/st2.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ actions_pool_size = 60
logging = /etc/st2/logging.actionrunner.conf
# List of pip options to be passed to "pip install" command when installing pack dependencies into pack virtual environment.
pip_opts = # comma separated list allowed here.
# Python 3 binary which will be used by Python actions for packs which use Python 3 virtual environment.
python3_binary = /usr/bin/python3
# Prefix for Python 3 installation (e.g. /opt/python3.6). If not specified, it tries to find Python 3 libraries in /usr/lib and /usr/local/lib.
python3_prefix = None
# Python binary which will be used by Python actions.
python_binary = /usr/bin/python
# Default log level to use for Python runner actions. Can be overriden on invocation basis using "log_level" runner parameter.
Expand Down
5 changes: 0 additions & 5 deletions contrib/packs/actions/download.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
description: "Set to True to force install the pack and skip StackStorm version compatibility check"
required: false
default: false
python3:
type: "boolean"
description: "True to use Python 3 binary for this pack."
required: false
default: false
dependency_list:
type: "array"
description: "Dependency list that needs to be downloaded."
Expand Down
5 changes: 0 additions & 5 deletions contrib/packs/actions/install.meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
description: "Set to True to force install the pack and skip StackStorm version compatibility check and also delete and ignore lock file if one exists."
required: false
default: false
python3:
type: "boolean"
description: "Use Python 3 binary when creating a virtualenv for this pack."
required: false
default: false
skip_dependencies:
type: "boolean"
description: "Set to True to skip pack dependency installations."
Expand Down
5 changes: 2 additions & 3 deletions contrib/packs/actions/pack_mgmt/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, config=None, action_service=None):
if self.proxy_ca_bundle_path and not os.environ.get('proxy_ca_bundle_path', None):
os.environ['no_proxy'] = self.no_proxy

def run(self, packs, abs_repo_base, verifyssl=True, force=False, python3=False,
def run(self, packs, abs_repo_base, verifyssl=True, force=False,
dependency_list=None):
result = {}
pack_url = None
Expand All @@ -73,7 +73,7 @@ def run(self, packs, abs_repo_base, verifyssl=True, force=False, python3=False,
pack_result = download_pack(pack=pack_dependency, abs_repo_base=abs_repo_base,
verify_ssl=verifyssl, force=force,
proxy_config=self.proxy_config, force_permissions=True,
use_python3=python3, logger=self.logger)
logger=self.logger)
pack_url, pack_ref, pack_result = pack_result
result[pack_ref] = pack_result
else:
Expand All @@ -82,7 +82,6 @@ def run(self, packs, abs_repo_base, verifyssl=True, force=False, python3=False,
verify_ssl=verifyssl, force=force,
proxy_config=self.proxy_config,
force_permissions=True,
use_python3=python3,
logger=self.logger)
pack_url, pack_ref, pack_result = pack_result
result[pack_ref] = pack_result
Expand Down
4 changes: 2 additions & 2 deletions contrib/packs/actions/pack_mgmt/setup_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, config=None, action_service=None):
if self.proxy_ca_bundle_path and not os.environ.get('proxy_ca_bundle_path', None):
os.environ['no_proxy'] = self.no_proxy

def run(self, packs, update=False, python3=False, no_download=True):
def run(self, packs, update=False, no_download=True):
"""
:param packs: A list of packs to create the environment for.
:type: packs: ``list``
Expand All @@ -85,7 +85,7 @@ def run(self, packs, update=False, python3=False, no_download=True):

for pack_name in packs:
setup_pack_virtualenv(pack_name=pack_name, update=update, logger=self.logger,
proxy_config=self.proxy_config, use_python3=python3,
proxy_config=self.proxy_config,
no_download=no_download)

message = ('Successfully set up virtualenv for the following packs: %s' %
Expand Down
5 changes: 0 additions & 5 deletions contrib/packs/actions/setup_virtualenv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
type: "boolean"
default: false
description: "Check this option if the virtual environment already exists and if you only want to perform an update and installation of new dependencies. If you don't check this option, the virtual environment will be destroyed then re-created. If you check this and the virtual environment doesn't exist, it will create it."
python3:
type: "boolean"
description: "Use Python 3 binary when creating a virtualenv for this pack."
required: false
default: false
no_download:
type: "boolean"
description: "Use version of pip which is already on the system instead of downloading the latest version from PyPi when creating a virtual environment."
Expand Down
3 changes: 0 additions & 3 deletions contrib/packs/actions/workflows/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
- register
- env
- force
- python3
- skip_dependencies
- timeout

Expand All @@ -30,7 +29,6 @@ tasks:
input:
packs: <% ctx().packs %>
force: <% ctx().force %>
python3: <% ctx().python3 %>
dependency_list: <% ctx().dependency_list %>
next:
- when: <% succeeded() %>
Expand Down Expand Up @@ -98,7 +96,6 @@ tasks:
input:
packs: <% ctx().packs_list %>
env: <% ctx().env %>
python3: <% ctx().python3 %>
timeout: <% ctx().timeout %>
next:
- when: <% succeeded() %>
Expand Down
51 changes: 0 additions & 51 deletions contrib/packs/tests/test_action_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,57 +433,6 @@ def test_download_pack_python_version_check(self):
result = action.run(packs=['test3'], abs_repo_base=self.repo_base, force=False)
self.assertEqual(result['test3'], 'Success.')

# StackStorm is running under Python 2, Pack requires Python 3 and --python3 flag is used
with mock.patch('st2common.util.pack_management.get_pack_metadata') as \
mock_get_pack_metadata:
mock_get_pack_metadata.return_value = {
'name': 'test3',
'stackstorm_version': '',
'python_versions': ['3']
}

st2common.util.pack_management.six.PY2 = True
st2common.util.pack_management.six.PY3 = False
st2common.util.pack_management.CURRENT_PYTHON_VERSION = '2.7.5'

result = action.run(packs=['test3'], abs_repo_base=self.repo_base, force=False,
python3=True)
self.assertEqual(result['test3'], 'Success.')

with mock.patch('st2common.util.pack_management.get_pack_metadata') as \
mock_get_pack_metadata:
mock_get_pack_metadata.return_value = {
'name': 'test3',
'stackstorm_version': '',
'python_versions': ['2', '3']
}

st2common.util.pack_management.six.PY2 = True
st2common.util.pack_management.six.PY3 = False
st2common.util.pack_management.CURRENT_PYTHON_VERSION = '2.7.5'

result = action.run(packs=['test3'], abs_repo_base=self.repo_base, force=False,
python3=True)
self.assertEqual(result['test3'], 'Success.')

# StackStorm is running under Python 2, pack requires Python 3 and --python3 flag is used
with mock.patch('st2common.util.pack_management.get_pack_metadata') as \
mock_get_pack_metadata:
mock_get_pack_metadata.return_value = {
'name': 'test3',
'stackstorm_version': '',
'python_versions': ['2']
}

st2common.util.pack_management.six.PY2 = True
st2common.util.pack_management.six.PY3 = False
st2common.util.pack_management.CURRENT_PYTHON_VERSION = '2.7.5'

expected_msg = (r'Pack "test3" requires Python 2.x, but --python3 flag is used')
self.assertRaisesRegexp(ValueError, expected_msg, action.run,
packs=['test3'], abs_repo_base=self.repo_base, force=False,
python3=True)

def test_resolve_urls(self):
url = eval_repo_url(
"https://github.com/StackStorm-Exchange/stackstorm-test")
Expand Down
1 change: 0 additions & 1 deletion st2api/st2api/controllers/v1/packs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class PackInstallController(ActionExecutionsControllerMixin):
def post(self, pack_install_request, requester_user=None):
parameters = {
'packs': pack_install_request.packs,
'python3': pack_install_request.python3
}

if pack_install_request.force:
Expand Down
7 changes: 6 additions & 1 deletion st2client/st2client/commands/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import six
import editor
import warnings
import yaml

from st2client.models import Config
Expand Down Expand Up @@ -210,7 +211,11 @@ def run(self, args, **kwargs):
if not is_structured_output:
self._get_content_counts_for_pack(args, **kwargs)

return self.manager.install(args.packs, python3=args.python3, force=args.force,
if args.python3:
warnings.warn('DEPRECATION WARNING: --python3 flag is ignored and will be removed '
'in v3.5.0 as StackStorm now runs with python3 only')

return self.manager.install(args.packs, force=args.force,
skip_dependencies=args.skip_dependencies, **kwargs)

def _get_content_counts_for_pack(self, args, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions st2client/st2client/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,11 @@ class AsyncRequest(Resource):

class PackResourceManager(ResourceManager):
@add_auth_token_to_kwargs_from_env
def install(self, packs, force=False, python3=False, skip_dependencies=False, **kwargs):
def install(self, packs, force=False, skip_dependencies=False, **kwargs):
url = '/%s/install' % (self.resource.get_url_path_name())
payload = {
'packs': packs,
'force': force,
'python3': python3,
'skip_dependencies': skip_dependencies
}
response = self.client.post(url, payload, **kwargs)
Expand Down
6 changes: 1 addition & 5 deletions st2common/st2common/cmd/download_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def _register_cli_opts():
cfg.BoolOpt('force', default=False,
help='True to force pack download and ignore download '
'lock file if it exists.'),
cfg.BoolOpt('use-python3', default=False,
help='True to use Python3 binary.')
]
do_register_cli_opts(cli_opts)

Expand All @@ -57,15 +55,13 @@ def main(argv):
packs = cfg.CONF.pack
verify_ssl = cfg.CONF.verify_ssl
force = cfg.CONF.force
use_python3 = cfg.CONF.use_python3

proxy_config = get_and_set_proxy_config()

for pack in packs:
LOG.info('Installing pack "%s"' % (pack))
result = download_pack(pack=pack, verify_ssl=verify_ssl, force=force,
proxy_config=proxy_config, force_permissions=True,
use_python3=use_python3)
proxy_config=proxy_config, force_permissions=True)

# Raw pack name excluding the version
pack_name = result[1]
Expand Down
9 changes: 2 additions & 7 deletions st2common/st2common/cmd/install_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ def _register_cli_opts():
cfg.BoolOpt('force', default=False,
help='True to force pack installation and ignore install '
'lock file if it exists.'),
cfg.BoolOpt('use-python3', default=False,
help='True to use Python3 binary when creating virtualenv '
'for this pack.'),
]
do_register_cli_opts(cli_opts)

Expand All @@ -59,16 +56,14 @@ def main(argv):
packs = cfg.CONF.pack
verify_ssl = cfg.CONF.verify_ssl
force = cfg.CONF.force
use_python3 = cfg.CONF.use_python3

proxy_config = get_and_set_proxy_config()

for pack in packs:
# 1. Download the pack
LOG.info('Installing pack "%s"' % (pack))
result = download_pack(pack=pack, verify_ssl=verify_ssl, force=force,
proxy_config=proxy_config, force_permissions=True,
use_python3=use_python3)
proxy_config=proxy_config, force_permissions=True)

# Raw pack name excluding the version
pack_name = result[1]
Expand All @@ -84,7 +79,7 @@ def main(argv):
# 2. Setup pack virtual environment
LOG.info('Setting up virtualenv for pack "%s"' % (pack_name))
setup_pack_virtualenv(pack_name=pack_name, update=False, logger=LOG,
proxy_config=proxy_config, use_python3=use_python3,
proxy_config=proxy_config,
no_download=True)
LOG.info('Successfully set up virtualenv for pack "%s"' % (pack_name))

Expand Down
5 changes: 1 addition & 4 deletions st2common/st2common/cmd/setup_pack_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ def _register_cli_opts():
'you don\'t check this option, the virtual environment will be destroyed '
'then re-created. If you check this and the virtual environment doesn\'t '
'exist, it will create it..')),
cfg.BoolOpt('python3', default=False,
help='Use Python 3 binary when creating a virtualenv for this pack.'),
]
do_register_cli_opts(cli_opts)

Expand All @@ -54,15 +52,14 @@ def main(argv):

packs = cfg.CONF.pack
update = cfg.CONF.update
use_python3 = cfg.CONF.python3

proxy_config = get_and_set_proxy_config()

for pack in packs:
# Setup pack virtual environment
LOG.info('Setting up virtualenv for pack "%s"' % (pack))
setup_pack_virtualenv(pack_name=pack, update=update, logger=LOG,
proxy_config=proxy_config, use_python3=use_python3,
proxy_config=proxy_config,
no_download=True)
LOG.info('Successfully set up virtualenv for pack "%s"' % (pack))

Expand Down
10 changes: 0 additions & 10 deletions st2common/st2common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import sys

from oslo_config import cfg
from distutils.spawn import find_executable

from st2common.constants.system import VERSION_STRING
from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH
Expand Down Expand Up @@ -345,7 +344,6 @@ def register_opts(ignore_errors=False):

# Runner options
default_python_bin_path = sys.executable
default_python3_bin_path = find_executable('python3')
base_dir = os.path.dirname(os.path.realpath(default_python_bin_path))
default_virtualenv_bin_path = os.path.join(base_dir, 'virtualenv')

Expand All @@ -359,14 +357,6 @@ def register_opts(ignore_errors=False):
cfg.StrOpt(
'python_binary', default=default_python_bin_path,
help='Python binary which will be used by Python actions.'),
cfg.StrOpt(
'python3_binary', default=default_python3_bin_path,
help='Python 3 binary which will be used by Python actions for packs which '
'use Python 3 virtual environment.'),
cfg.StrOpt(
'python3_prefix', default=None,
help='Prefix for Python 3 installation (e.g. /opt/python3.6). If not specified, it '
'tries to find Python 3 libraries in /usr/lib and /usr/local/lib.'),
cfg.StrOpt(
'virtualenv_binary', default=default_virtualenv_bin_path,
help='Virtualenv binary which should be used to create pack virtualenvs.'),
Expand Down
9 changes: 0 additions & 9 deletions st2common/st2common/constants/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

__all__ = [
'PACK_VIRTUALENV_DOESNT_EXIST',
'PACK_VIRTUALENV_USES_PYTHON3',
'PYTHON2_DEPRECATION'
]

Expand All @@ -26,14 +25,6 @@
"st2 run packs.setup_virtualenv packs=%(pack)s"
'''

PACK_VIRTUALENV_USES_PYTHON3 = '''
Virtual environment (%(virtualenv_path)s) for pack "%(pack)s" is using Python 3.
Using Python 3 virtual environments in mixed deployments is only supported for Python runner
actions and not sensors. If you want to run this sensor, please re-recreate the
virtual environment with python2 binary:
"st2 run packs.setup_virtualenv packs=%(pack)s python3=false"
'''

PYTHON2_DEPRECATION = 'DEPRECATION 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 ' \
Expand Down
6 changes: 0 additions & 6 deletions st2common/st2common/constants/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@
'six>=1.9.0,<2.0'
]

# Python requirements which are common to all the packs and need to be installed
# for Python 3 pack virtual environments to work
BASE_PACK_PYTHON3_REQUIREMENTS = [
'pyyaml>=5.1,<5.2'
]

# Name of the pack manifest file
MANIFEST_FILE_NAME = 'pack.yaml'

Expand Down
4 changes: 0 additions & 4 deletions st2common/st2common/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5068,10 +5068,6 @@ definitions:
type: array
items:
type: string
python3:
description: Use Python 3 binary for pack virtual environment.
type: boolean
default: false
force:
description: Force pack installation.
type: boolean
Expand Down
Loading