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
17 changes: 11 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,20 @@ Changed
way to find out about this failure would be to inspect the ``st2rulesengine`` service logs.
(improvement) #4231

Fixed
~~~~~

* Fix an issue with ``AttributeError: module 'enum' has no attribute 'IntFlag'`` error which would
appear when using Python 3 for a particular pack virtual environment and running on RHEL /
CentOS. (bug fix) #4297

Deprecated
~~~~~~~~~~

* The CloudSlang runner is now deprecated. In StackStorm 3.1 it will be removed from the core StackStorm codebase.
The runner code will be moved to a separate repository, and no longer maintained by the core StackStorm team.
Users will still be able to install and use this runner, but it will require additional steps to install.

Fixed
~~~~~
* The CloudSlang runner is now deprecated. In StackStorm 3.1 it will be removed from the core
StackStorm codebase. The runner code will be moved to a separate repository, and no longer
maintained by the core StackStorm team. Users will still be able to install and use this runner,
but it will require additional steps to install.

2.8.1 - July 18, 2018
---------------------
Expand Down
15 changes: 10 additions & 5 deletions st2common/st2common/util/sandboxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,19 @@ def get_sandbox_python_path_for_python_action(pack, inherit_from_parent=True,
uses_python3 = False

if uses_python3:
# Add Python 3 lib/site-packages directory infront of the system site packages
# This is important because we want Python 3 compatible libraries to be used from
# the pack virtual environment and not system ones
# Add Python 3 lib directory (lib/python3.x) in front of the PYTHONPATH. This way we avoid
# issues with scripts trying to use packages / modules from Python 2.7 site-packages
# directory instead of the versions from Python 3 stdlib.
python3_lib_directory = os.path.join(pack_virtualenv_lib_path, virtualenv_directories[0])

# Add Python 3 site-packages directory (lib/python3.x/site-packages) in front of the Python
# 2.7 system site-packages This is important because we want Python 3 compatible libraries
# to be used from the pack virtual environment and not system ones.
python3_site_packages_directory = os.path.join(pack_virtualenv_lib_path,
virtualenv_directories[0],
'site-packages')
sandbox_python_path = (python3_site_packages_directory + ':' + pack_actions_lib_paths +
':' + sandbox_python_path)
sandbox_python_path = (python3_lib_directory + ':' + python3_site_packages_directory + ':' +
pack_actions_lib_paths + ':' + sandbox_python_path)

return sandbox_python_path

Expand Down
19 changes: 12 additions & 7 deletions st2common/tests/unit/test_util_sandboxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,16 @@ def test_get_sandbox_python_path_for_python_action_python3_used_for_venv(self,
inherit_parent_virtualenv=False)

split = python_path.strip(':').split(':')
self.assertEqual(len(split), 2)
self.assertEqual(len(split), 3)

# First entry should be python3 site-packages dir from venv
self.assertTrue('virtualenvs/dummy_pack/lib/python3.6/site-packages' in split[0])
# First entry should be lib/python3 dir from venv
self.assertTrue('virtualenvs/dummy_pack/lib/python3.6' in split[0])

# Second entry should be actions/lib dir from pack root directory
self.assertTrue('packs/dummy_pack/actions/lib/' in split[1])
# Second entry should be python3 site-packages dir from venv
self.assertTrue('virtualenvs/dummy_pack/lib/python3.6/site-packages' in split[1])

# Third entry should be actions/lib dir from pack root directory
self.assertTrue('packs/dummy_pack/actions/lib/' in split[2])

# Inherit python path from current process
# Mock the current process python path
Expand All @@ -156,7 +159,8 @@ def test_get_sandbox_python_path_for_python_action_python3_used_for_venv(self,
python_path = get_sandbox_python_path_for_python_action(pack='dummy_pack',
inherit_from_parent=True,
inherit_parent_virtualenv=False)
expected = ('/tmp/virtualenvs/dummy_pack/lib/python3.6/site-packages:'
expected = ('/tmp/virtualenvs/dummy_pack/lib/python3.6:'
'/tmp/virtualenvs/dummy_pack/lib/python3.6/site-packages:'
'/tmp/packs/dummy_pack/actions/lib/::/data/test1:/data/test2')
self.assertEqual(python_path, expected)

Expand All @@ -174,7 +178,8 @@ def test_get_sandbox_python_path_for_python_action_python3_used_for_venv(self,
inherit_from_parent=True,
inherit_parent_virtualenv=True)

expected = ('/tmp/virtualenvs/dummy_pack/lib/python3.6/site-packages:'
expected = ('/tmp/virtualenvs/dummy_pack/lib/python3.6:'
'/tmp/virtualenvs/dummy_pack/lib/python3.6/site-packages:'
'/tmp/packs/dummy_pack/actions/lib/::/data/test1:/data/test2:'
'%s/virtualenvtest' % (sys.prefix))
self.assertEqual(python_path, expected)