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

EL7 migration from python 2 to python 3 #1037

Merged
merged 7 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
- restore_cache:
key: v2-dependency-cache-{{ checksum "st2/requirements.txt" }}
- run: sudo apt install python-dev
- run: sudo apt install libldap2-dev
- run: sudo apt install libsasl2-dev
- run: make docs
- run:
name: Store HTML docs in workspace dir
Expand Down
28 changes: 28 additions & 0 deletions docs/source/install/rhel7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ System Requirements

Please check the :doc:`supported versions and system requirements <system_requirements>`.

.. note::

|st2| on RHEL 7/CentOS 7 runs all services, actions and sensors using Python 3 **only**. It
does not support Python 2 actions.

Minimal Installation
--------------------

Expand All @@ -34,6 +39,9 @@ you may want to tweak them according to your security practices.
# SELINUX management tools, not available for some minimal installations
sudo yum install -y policycoreutils-python

# SELINUX python3 rules
sudo yum install -y libselinux-python3

# Allow network access for nginx
sudo setsebool -P httpd_can_network_connect 1
arm4b marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -73,6 +81,26 @@ Install MongoDB, and RabbitMQ:
sudo systemctl start mongod rabbitmq-server
sudo systemctl enable mongod rabbitmq-server

The default python on CentOS/RHEL 7.x is python 2, |st2| uses python3 and requires the python3-devel package. The installation of the st2 package will automatically install python3-devel if it is available in an enabled repository. On CentOS distributions the relevant repository is typically enabled however on RHEL distributions it is provided by the rhel-7-server-optional-rpms repository (repository name dependant on RHEL distribution).

Use the following command to verify that the python3-devel package is available in an enabled repository:

.. code-block:: bash

sudo yum info python3-devel

If it is not available, then locate the optional-rpms repository:

.. code-block:: bash

sudo yum repolist disabled | grep optional | grep server

Then either enable the optional repository using subscription-manager or yum-config-manager, or install python3-devel with a temporary repository enablement, e.g.:

.. code-block:: bash

sudo yum install python3-devel --enablerepo <optional-server-rpm repo>

Setup Repositories
~~~~~~~~~~~~~~~~~~

Expand Down
32 changes: 32 additions & 0 deletions docs/source/install/upgrades.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,38 @@ The following sections call out the migration scripts that need to be run when u
respective version. If you are upgrading across multiple versions, make sure you run the scripts for
any skipped versions:

v3.4
''''

* |st2| now uses python 3 on RHEL/CentOS 7. Therefore any packs that only support python 2 will need to be upgraded to python 3.


* If SELINUX is enabled, install the python 3 SELinux rules with:

.. sourcecode:: bash

sudo yum install -y libselinux-python3
arm4b marked this conversation as resolved.
Show resolved Hide resolved

* Ensure python3-devel can be installed from an enabled repository:
arm4b marked this conversation as resolved.
Show resolved Hide resolved

* Check if python3-devel is already available in an enabled repository:

.. sourcecode:: bash

sudo yum info python3-devel

* If it is not available, then locate the name of the optional server RPMs repository:

.. sourcecode:: bash

sudo yum repolist disabled | grep optional | grep server

* Either enable the optional repository using subscription-manager or yum-config-manager, or install python3-devel with a temporary repository enablement, e.g.:

.. sourcecode:: bash

sudo yum install python3-devel --enablerepo <optional-server-rpm repo>


v3.3
''''
Expand Down
4 changes: 2 additions & 2 deletions docs/source/packs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ Python versions in Pack Python Virtual Environment

When installing a pack, a Python virtual environment is created using the Python binary defined by
the ``actionrunner.python_binary`` config option. By default, the same binary which is
used by all the |st2| components and services is used for pack virtual environments. On CentOS/RHEL 7 and Ubuntu 16.04 the Python binary currently used is Python 2.7, on all other distributions Python 3 is used.
used by all the |st2| components and services is used for pack virtual environments. On Ubuntu 16.04 the Python binary currently used is Python 2.7, on all other distributions Python 3 is used.

.. warning ::

Python 2 support will be dropped from |st2| in future releases. Please consider updating any Python 2 only packs to work with Python 3.

On CentOS/RHEL 7 and Ubuntu 16.04 if you want to use Python 3 for running your pack Python actions, you can do that by passing the
On Ubuntu 16.04 if you want to use Python 3 for running your pack Python actions, you can do that by passing the
``--python3`` flag to the ``st2 pack install`` command (e.g. ``st2 pack install libcloud
--python3``).

Expand Down
7 changes: 7 additions & 0 deletions docs/source/upgrade_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Upgrade Notes
=============

.. _ref-upgrade-notes-v3-4:

|st2| v3.4
-------------

* RHEL/CentOS 7.x ST2 distributions now uses python version 3 for ST2 and all packs, therefore any packs that only support python 2 will need to be migrated to python 3.

.. _ref-upgrade-notes-v3-3:

|st2| v3.3
Expand Down