Skip to content

Commit

Permalink
Add ubuntu 20 Puppet 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jul 6, 2021
1 parent 2ae1207 commit 8e45a7e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 45 deletions.
3 changes: 0 additions & 3 deletions .sync.yml

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$config_group = 'root'
$java_dir = '/usr/share/collectd/java'
$default_python_dir = '/usr/local/lib/python2.7/dist-packages'
$manage_repo = $facts['os']['release']['full'] != '18.04'
$manage_repo = $facts['os']['release']['full'] == '16.04'
$package_configs = {}
}
'Solaris': {
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/cuda.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
include collectd

$_manage_package = pick($manage_package, $collectd::manage_package)
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
$_python_pip_package = 'python3-pip'
if $package_provider =~ Undef {
$_package_provider = 'pip3'
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/iscdhcp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

$_manage_package = pick($manage_package, $collectd::manage_package)

if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
$_python_pip_package = 'python3-pip'
if $package_provider =~ Undef {
$_package_provider = 'pip3'
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/rabbitmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
) {
include collectd

if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'],'8') >= 0 {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
fail('https://pypi.org/project/collectd-rabbitmq/ does not support Python 3')
}

Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
"18.04",
"20.04"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/class_plugin_python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class { 'collectd::plugin::csv':}
context 'trivial pip module connect-time' do
it 'works idempotently with no errors' do
pp = <<-EOS
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
$_python_pip_package = 'python3-pip'
$_pip_provider = 'pip3'
} else {
Expand Down Expand Up @@ -85,7 +85,7 @@ class { 'collectd::plugin::csv':}
ensure => present,
}
}
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
$_python_pip_package = 'python3-pip'
$_pip_provider = 'pip3'
} else {
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class { '::collectd': }
class { '::collectd::plugin::memory': }
# rabbitmq plugin not ported to Python3
unless $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' {
unless ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
class { '::collectd::plugin::rabbitmq': }
}
class { 'collectd::plugin::csv':}
Expand All @@ -43,7 +43,7 @@ class { 'collectd::plugin::csv':}
apply_manifest(pp, catch_changes: true)
end

if fact('osfamily') == 'Debian'
if fact('osfamily') == 'Debian' && fact('os.release.major') != '20.04'
describe file('/etc/collectd/conf.d/10-rabbitmq.conf') do
it { is_expected.to be_file }
it { is_expected.to contain 'TypesDB "/usr/local/share/collectd-rabbitmq/types.db.custom"' }
Expand Down
14 changes: 7 additions & 7 deletions spec/classes/collectd_plugin_rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'import collectd_rabbitmq.collectd_plugin in python-config' do
Expand Down Expand Up @@ -67,7 +67,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'override custom TypesDB' do
Expand All @@ -82,7 +82,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'override Username to foo in python-config' do
Expand All @@ -97,7 +97,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'override Username to foo in python-config' do
Expand All @@ -112,7 +112,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'override Username to foo in python-config' do
Expand All @@ -128,7 +128,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it 'Will remove python-config' do
Expand All @@ -155,7 +155,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 8]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
it do
Expand Down
26 changes: 0 additions & 26 deletions spec/spec_helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,6 @@ def os_specific_options(facts)
end
end

def all_supported_os_hash
{
supported_os: [
{
'operatingsystem' => 'Debian',
'operatingsystemrelease' => ['8']
},
{
'operatingsystem' => 'CentOS',
'operatingsystemrelease' => %w[7 8]
},
{
'operatingsystem' => 'Ubuntu',
'operatingsystemrelease' => %w[16.04 18.04]
},
{
'operatingsystem' => 'FreeBSD',
'operatingsystemrelease' => %w[11 12]
},
{
'operatingsystem' => 'Archlinux'
}
]
}
end

def baseline_os_hash
{
supported_os: [
Expand Down

0 comments on commit 8e45a7e

Please sign in to comment.