From f8632dd6929dd77851a27f210f973a35f7f1c576 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 6 Mar 2020 09:31:23 +0100 Subject: [PATCH] Add CentOS 8 support The main differences for CentOS 8 are: * There is now a new collectd-utils package containing collectdctl * python is python3 Note that setting `collectd::ci_package_repo` true will currently result in yum being configured with a non existant repo since https://pkg.ci.collectd.org/rpm/ does not exist for 8. https://github.com/collectd/collectd-ci/issues/35 --- .sync.yml | 1 + .travis.yml | 8 ++++++++ manifests/params.pp | 5 ++++- metadata.json | 9 ++++++--- spec/acceptance/class_plugin_python_spec.rb | 2 +- spec/spec_helper_acceptance.rb | 7 ++++++- spec/spec_helper_methods.rb | 6 +++--- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.sync.yml b/.sync.yml index 12215f5ca..ff751c806 100644 --- a/.sync.yml +++ b/.sync.yml @@ -4,6 +4,7 @@ - set: ubuntu1604-64 - set: ubuntu1804-64 - set: centos7-64 + - set: centos8-64 - set: debian8-64 secure: "FAK3Izs5bSZyblGvcFnGWm0exZV5+v9pbwfRDD2oihWxX3U3pArGW+3XcwcJfLQgrUYBsOTmHC8yPjlgTBYeIt/5pvg9X+3jwNgeto6kozpI/nvAq4NtcHhzxRejuPELhFYeXZ3hEw0w+v/ZRo2cNLwI0LLpiWEDvCMZN1CJ2RY=" spec/spec_helper.rb: diff --git a/.travis.yml b/.travis.yml index 391701cc4..a1c8dec16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,14 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker diff --git a/manifests/params.pp b/manifests/params.pp index a97a83d38..8e3fc53a1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -71,7 +71,10 @@ $config_file = '/etc/collectd.conf' $config_group = 'root' $java_dir = '/usr/share/collectd/java' - $default_python_dir = '/usr/lib/python2.7/site-packages' + $default_python_dir = $facts['os']['release']['major'] ? { + '7' => '/usr/lib/python2.7/site-packages', + default => '/usr/lib/python3.6/site-packages', + } $manage_repo = true $package_configs = { ovs_events => 'ovs-events.conf', diff --git a/metadata.json b/metadata.json index 891d4a991..36750d0d8 100644 --- a/metadata.json +++ b/metadata.json @@ -3,19 +3,22 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { diff --git a/spec/acceptance/class_plugin_python_spec.rb b/spec/acceptance/class_plugin_python_spec.rb index 5d486440b..54f397210 100644 --- a/spec/acceptance/class_plugin_python_spec.rb +++ b/spec/acceptance/class_plugin_python_spec.rb @@ -25,7 +25,7 @@ context 'trivial module' do it 'works idempotently with no errors' do pp = <<-EOS - if $facts['os']['family'] == 'Debian' { + if $facts['os']['family'] == 'Debian' or ( $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] != '7' ) { # for collectdctl command package{'collectd-utils': ensure => present, diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index fe6f8a8c0..291b2e695 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -16,7 +16,12 @@ hosts.each do |host| # python is pre-requisite to the python_path fact. - host.install_package('python') + case host['platform'] + when %r{centos8} + host.install_package('python3') + else + host.install_package('python') + end end end end diff --git a/spec/spec_helper_methods.rb b/spec/spec_helper_methods.rb index ffbb578b9..b078aec87 100644 --- a/spec/spec_helper_methods.rb +++ b/spec/spec_helper_methods.rb @@ -24,11 +24,11 @@ def all_supported_os_hash }, { 'operatingsystem' => 'CentOS', - 'operatingsystemrelease' => ['7'] + 'operatingsystemrelease' => %w[7 8] }, { 'operatingsystem' => 'Ubuntu', - 'operatingsystemrelease' => ['16.04', '18.04'] + 'operatingsystemrelease' => %w[16.04 18.04] }, { 'operatingsystem' => 'FreeBSD', @@ -46,7 +46,7 @@ def baseline_os_hash supported_os: [ { 'operatingsystem' => 'CentOS', - 'operatingsystemrelease' => ['7'] + 'operatingsystemrelease' => %w[7 8] } ] }