Skip to content

Commit

Permalink
Merge pull request #325 from StackStorm/feature/python3
Browse files Browse the repository at this point in the history
Feature/python3
  • Loading branch information
nmaludy authored Feb 15, 2021
2 parents 952a74c + 652fd1f commit c7d4bb6
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ jobs:
name: 'centos7-puppet5'
- ruby: '2.5'
name: 'centos7-puppet6'
- ruby: '2.5'
name: 'centos7-puppet6-python36'
- ruby: '2.5'
name: 'ubuntu16-puppet5'
- ruby: '2.5'
name: 'ubuntu16-puppet6'
- ruby: '2.5'
name: 'ubuntu16-puppet6-python36'
- ruby: '2.5'
name: 'ubuntu18-puppet5'
- ruby: '2.5'
Expand Down
24 changes: 24 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ platforms:
provisioner:
puppetfile_path: build/centos7-puppet6/Puppetfile

# CentOS7 with Systemd - Puppet 6 - Python 3.6
- name: centos7-puppet6-python36
driver:
platform: centos
dockerfile: build/centos7-puppet6/Dockerfile.kitchen
run_command: /sbin/init
volume:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
puppetfile_path: build/centos7-puppet6/Puppetfile
manifest: test/fullinstall_python36.pp

# Ubuntu Xenial with Systemd - Puppet 5
- name: ubuntu16-puppet5
driver:
Expand All @@ -83,6 +95,18 @@ platforms:
provisioner:
puppetfile_path: build/ubuntu16-puppet6/Puppetfile

# Ubuntu Xenial with Systemd - Puppet 6
- name: ubuntu16-puppet6-python36
driver:
platform: ubuntu
dockerfile: build/ubuntu16-puppet6/Dockerfile.kitchen
run_command: /sbin/init
volume:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
puppetfile_path: build/ubuntu16-puppet6/Puppetfile
manifest: test/fullinstall_python36.pp

# Ubuntu Bionic with Systemd - Puppet 5
- name: ubuntu18-puppet5
driver:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Development

- Added new parameter `st2::python_version` that controls the version of python to install.
This was added so that OSes that don't come with Python 3 by default, can install Python 3.
The default is `'system'` and the system `python` package will be installed,
whatever version that is for your OS.
To explicitly install Python 3.6 on CentOS 7, pass in `'3.6'`.
To install Python 3.6 on Ubuntu 16.04 pass in `'python3.6'`. On Ubuntu 16.04 you'll
also need to pass in `st2::python_enable_unsafe_repo: true` in order to enable the deadsnakes
PPA (Feature)
Contributed by @nmaludy

- Removed tags for auth system development dependencies (PAM and LDAP) that caused issues
when declaring packages such as `gcc`. (Bug Fix)
Contributed by @nmaludy
Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ puppet module install stackstorm-st2
puppet apply -e "include st2::profile::fullinstall"
```



## Usage

### Reference Documentation
Expand Down Expand Up @@ -113,6 +111,39 @@ Hiera data bindings. A few notable parameters to take note of:
**Note** Setting this to `latest` is NOT recommended. It will cause the
StackStorm packages to be automatically updated without the proper upgrade steps
being taken (proper steps detailed here: https://docs.stackstorm.com/install/upgrades.html)
* `st2::python_version` - Version to Python to use. The default is `'system'` and the
system `python` package will be installed, whatever version that is for your OS.
To explicitly install Python 3.6 specify `'3.6'` if on RHEL/CentOS 7.
If on Ubuntu 16.04 specify `'python3.6'`.
**Notes**
* RHEL 7 - The Red Hat subscription repo `'rhel-7-server-optional-rpms'`
will need to be enabled prior to running this module.
* :warning: Ubuntu 16.04 -
The python3.6 package is a required dependency for the StackStorm `st2` package
but that is not installable from any of the default Ubuntu 16.04 repositories.
We recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for
Ubuntu 16.04 will be removed with future StackStorm versions.
Alternatively the Puppet will try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.
Only set to true, if you are aware of the support and security risks associated
with using unofficial 3rd party PPA repository, and you understand that StackStorm
does NOT provide ANY support for python3.6 packages on Ubuntu 16.04.
The unsafe PPA `'ppa:deadsnakes/ppa'` https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
can be enabled if you specify the `st2::python_enable_unsafe_repo: true` (default: `false`)

```puppet
# CentOS/RHEL 7
class { 'st2':
python_version => '3.6',
}
# Ubuntu 16.04 (unsafe deadsnakes PPA will be enabled because of boolean flag)
class { 'st2':
python_version => 'python3.6',
python_enable_unsafe_repo => true,
}
contain st2::profile::fullinstall
```

All other classes are documented with Puppetdoc. Please refer to specific
classes for use and configuration.
Expand Down
92 changes: 89 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ class { 'st2':
}
```

##### Install with python 3.6 (if not default on your system)

```puppet
$st2_python_version = $facts['os']['family'] ? {
'RedHat' => '3.6',
'Debian' => 'python3.6',
}
class { 'st2':
python_version => $st2_python_version,
python_enable_unsafe_repo => true,
}
```

#### Parameters

The following parameters are available in the `st2` class.
Expand All @@ -143,6 +156,34 @@ https://puppet.com/docs/puppet/5.5/types/package.html#package-attribute-ensure

Default value: 'present'

##### `python_version`

Data type: `String`

Version of Python to install. Default is 'system' meaning the system version
of Python will be used.
To install Python 3.6 on RHEL/CentOS 7 specify '3.6'.
To install Python 3.6 on Ubuntu 16.05 specify 'python3.6'.

Default value: 'system'

##### `python_enable_unsafe_repo`

Data type: `Boolean`

The python3.6 package is a required dependency for the StackStorm `st2` package
but that is not installable from any of the default Ubuntu 16.04 repositories.
We recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for
Ubuntu 16.04 will be removed with future StackStorm versions.
Alternatively the Puppet will try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.
Only set to true, if you are aware of the support and security risks associated
with using unofficial 3rd party PPA repository, and you understand that StackStorm
does NOT provide ANY support for python3.6 packages on Ubuntu 16.04.
The unsafe PPA `'ppa:deadsnakes/ppa'` https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
can be enabled if you specify `true` for this parameter. (default: `false`)

Default value: `false`

##### `repository`

Data type: `St2::Repository`
Expand Down Expand Up @@ -1984,7 +2025,7 @@ Default value: $::st2::nodejs_version

### st2::profile::python

StackStorm compatable installation of Python and dependencies.
include st2::profile::python

#### Examples

Expand All @@ -1994,6 +2035,51 @@ StackStorm compatable installation of Python and dependencies.
include st2::profile::python
```

##### Install with python 3.6 (if not default on your system)

```puppet
$st2_python_version = $facts['os']['family'] ? {
'RedHat' => '3.6',
'Debian' => 'python3.6',
}
class { 'st2':
python_version => $st2_python_version,
python_enable_unsafe_repo => true,
}
```

#### Parameters

The following parameters are available in the `st2::profile::python` class.

##### `version`

Data type: `String`

Version of Python to install. Default is 'system' meaning the system version
of Python will be used.
To install Python 3.6 on RHEL/CentOS 7 specify '3.6'.
To install Python 3.6 on Ubuntu 16.05 specify 'python3.6'.

Default value: $st2::python_version

##### `enable_unsafe_repo`

Data type: `Boolean`

The python3.6 package is a required dependency for the StackStorm `st2` package
but that is not installable from any of the default Ubuntu 16.04 repositories.
We recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for
Ubuntu 16.04 will be removed with future StackStorm versions.
Alternatively the Puppet will try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.
Only set to true, if you are aware of the support and security risks associated
with using unofficial 3rd party PPA repository, and you understand that StackStorm
does NOT provide ANY support for python3.6 packages on Ubuntu 16.04.
The unsafe PPA `'ppa:deadsnakes/ppa'` https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
can be enabled if you specify `true` for this parameter. (default: `false`)

Default value: $st2::python_enable_unsafe_repo

### st2::profile::rabbitmq

StackStorm compatable installation of RabbitMQ and dependencies.
Expand Down Expand Up @@ -3672,11 +3758,11 @@ High level steps:
- stop stackstorm
## https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/
- set MongoDB feature compatibility to 3.4
- change Yum repo to 3.6
- change package repo to 3.6
- upgrade packages
- set MongoDB feature compatibility to 3.6
## https://docs.mongodb.com/manual/release-notes/4.0-upgrade-standalone/
- change Yum repo to 4.0
- change package repo to 4.0
- upgrade packages
- set MongoDB feature compatibility to 4.0
- start stackstorm
Expand Down
15 changes: 13 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@
# - Fix sudoers directory
# sudo su -
# chmod 440 -R /etc/sudoers.d
# chmod 755 -R /etc/sudoers.d # on ubuntu to get rsync to work
# chmod 755 -R /etc/sudoers.d # run this after puppet to get vargrant-rsync working again
#
# - Run puppet to install StackStorm
# puppet apply -e "include st2::profile::fullinstall"
#
# # Python 3 testing
# # CentOS/RHEL
# echo -e "class { 'st2': python_version => '3.6' }\n include st2::profile::fullinstall" > apply.pp
# # Ubuntu 16.04
# echo -e "class { 'st2': python_version => 'python3.6', python_enable_unsafe_repo => true }\n include st2::profile::fullinstall" > apply.pp
#
# chmod 440 -R /etc/sudoers.d; puppet apply apply.pp; chmod 755 -R /etc/sudoers.d
#
# - Keep editing files locally and re-running puppet with the command above
#
# Nick's notes
Expand All @@ -53,8 +61,11 @@ provider = provider.to_sym
# - centos/7
# - generic/ubuntu1604
# - generic/ubuntu1804
box = ENV['BOX'] ? ENV['BOX'] : 'centos/7'
#box = ENV['BOX'] ? ENV['BOX'] : 'centos/8stream'
#box = ENV['BOX'] ? ENV['BOX'] : 'generic/centos8'
box = ENV['BOX'] ? ENV['BOX'] : 'generic/ubuntu1804'
#box = ENV['BOX'] ? ENV['BOX'] : 'generic/ubuntu1604'
#box = ENV['BOX'] ? ENV['BOX'] : 'generic/ubuntu1804'

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Expand Down
30 changes: 30 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
# Version of StackStorm package to install (default = 'present')
# See the package 'ensure' property:
# https://puppet.com/docs/puppet/5.5/types/package.html#package-attribute-ensure
#
# @param [String] python_version
# Version of Python to install. Default is 'system' meaning the system version
# of Python will be used.
# To install Python 3.6 on RHEL/CentOS 7 specify '3.6'.
# To install Python 3.6 on Ubuntu 16.05 specify 'python3.6'.
#
# @param [Boolean] python_enable_unsafe_repo
# The python3.6 package is a required dependency for the StackStorm `st2` package
# but that is not installable from any of the default Ubuntu 16.04 repositories.
# We recommend switching to Ubuntu 18.04 LTS (Bionic) as a base OS. Support for
# Ubuntu 16.04 will be removed with future StackStorm versions.
# Alternatively the Puppet will try to add python3.6 from the 3rd party 'deadsnakes' repository: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.
# Only set to true, if you are aware of the support and security risks associated
# with using unofficial 3rd party PPA repository, and you understand that StackStorm
# does NOT provide ANY support for python3.6 packages on Ubuntu 16.04.
# The unsafe PPA `'ppa:deadsnakes/ppa'` https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
# can be enabled if you specify `true` for this parameter. (default: `false`)
#
# @param [St2::Repository] repository
# Release repository to enable. 'stable', 'unstable'
# (default = 'stable')
Expand Down Expand Up @@ -225,8 +244,19 @@
# rabbitmq_password => '@!fsdf0#45',
# }
#
# @example Install with python 3.6 (if not default on your system)
# $st2_python_version = $facts['os']['family'] ? {
# 'RedHat' => '3.6',
# 'Debian' => 'python3.6',
# }
# class { 'st2':
# python_version => $st2_python_version,
# python_enable_unsafe_repo => true,
# }
class st2(
$version = 'present',
String $python_version = 'system',
Boolean $python_enable_unsafe_repo = false,
St2::Repository $repository = $::st2::params::repository,
$conf_dir = $::st2::params::conf_dir,
$conf_file = "${::st2::params::conf_dir}/st2.conf",
Expand Down
1 change: 1 addition & 0 deletions manifests/profile/fullinstall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
-> class { 'st2::repo': }
-> class { 'st2::profile::selinux': }
-> Anchor['st2::pre_reqs']
-> class { 'st2::profile::python': }
-> class { 'st2::profile::nodejs': }
-> class { 'st2::profile::rabbitmq': }
-> class { 'st2::profile::mongodb': }
Expand Down
Loading

0 comments on commit c7d4bb6

Please sign in to comment.