Skip to content

Commit

Permalink
handle Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoll committed May 17, 2020
1 parent 640f347 commit ae5ad69
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
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
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
2 changes: 1 addition & 1 deletion 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 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

0 comments on commit ae5ad69

Please sign in to comment.