From 450d168e3e651e97ee62b5ec223262f47b35d3d6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 19 May 2024 14:02:26 +0200 Subject: [PATCH] CentOS7: default to EPEL7 as source Historically we used the garethr/erlang module as soft dependency on CentOS 7. This also configured the EPEL7 repository. I always always a bit unsure where the actual rabbitmq packages come from. I assumed somehow from the erlang repo. My impression is that the erlan repo isn't used at all. rabbitmq packages where always pulled from EPEL7. The problem with the garethr/erlang is that it depends on the deprecated `stahnma/epel` (which is now puppet/epel) and uses topscope facts and variables. The module doesn't work anymore with Puppet 8. This PR replaces the unused garethr/erlang directly with the EPEL module. --- .fixtures.yml | 3 ++- README.md | 4 ++++ manifests/init.pp | 4 ++++ spec/acceptance/class_spec.rb | 20 ++------------------ spec/acceptance/clustering_spec.rb | 12 ------------ spec/acceptance/delete_guest_user_spec.rb | 4 ---- spec/acceptance/parameter_spec.rb | 4 ---- spec/acceptance/policy_spec.rb | 4 ---- spec/acceptance/queue_spec.rb | 12 ------------ spec/acceptance/rabbitmqadmin_spec.rb | 16 ---------------- spec/acceptance/user_spec.rb | 4 ---- spec/acceptance/vhost_spec.rb | 8 ++------ spec/spec_helper_acceptance.rb | 2 +- 13 files changed, 15 insertions(+), 82 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index d8e86d6ae..7f22ca1c8 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,8 +1,9 @@ +--- fixtures: repositories: stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib' apt: 'https://github.com/puppetlabs/puppetlabs-apt' archive: 'https://github.com/voxpupuli/puppet-archive' - erlang: 'https://github.com/garethr/garethr-erlang' + epel: 'https://github.com/voxpupuli/puppet-epel' systemd: 'https://github.com/voxpupuli/puppet-systemd' yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core' diff --git a/README.md b/README.md index 471ea7c89..a1a4a44f1 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ These are now documented via [Puppet Strings](https://github.com/puppetlabs/pupp You can view example usage in [REFERENCE](REFERENCE.md). +**[puppet/epel](https://forge.puppet.com/modules/puppet/epel) is a soft dependency. The module requires it if you're on CentOS 7** + +Version v13.2.0 and older also added an erlang repository on CentOS 7. That isn't used and can be safely removed. + ## Reference See [REFERENCE](REFERENCE.md). diff --git a/manifests/init.pp b/manifests/init.pp index 2eb9164b3..942cbe1c2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -492,6 +492,8 @@ } } + # when repos_ensure is true, we configure externel repos + # CentOS 7 doesn't contain rabbitmq. It's only in EPEL. if $repos_ensure { case $facts['os']['family'] { 'RedHat': { @@ -505,6 +507,8 @@ default: { } } + } elsif ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') { + require epel } contain rabbitmq::install diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 009b35b08..9198c1889 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -15,11 +15,7 @@ context 'default class inclusion' do let(:pp) do <<-EOS - class { 'rabbitmq': } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } + include rabbitmq EOS end @@ -54,10 +50,6 @@ class { 'erlang': epel_enable => true} class { 'rabbitmq': service_ensure => 'stopped', } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS end @@ -72,11 +64,7 @@ class { 'erlang': epel_enable => true} context 'service is unmanaged' do it 'runs successfully' do pp_pre = <<-EOS - class { 'rabbitmq': } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } + include rabbitmq EOS pp = <<-EOS @@ -84,10 +72,6 @@ class { 'rabbitmq': service_manage => false, service_ensure => 'stopped', } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp_pre, catch_failures: true) diff --git a/spec/acceptance/clustering_spec.rb b/spec/acceptance/clustering_spec.rb index fa689cf42..49e3261cc 100644 --- a/spec/acceptance/clustering_spec.rb +++ b/spec/acceptance/clustering_spec.rb @@ -14,10 +14,6 @@ class { 'rabbitmq': erlang_cookie => 'TESTCOOKIE', wipe_db_on_cookie_change => false, } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp, expect_failures: true) @@ -39,10 +35,6 @@ class { 'rabbitmq': erlang_cookie => 'TESTCOOKIE', wipe_db_on_cookie_change => true, } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp, catch_failures: true) @@ -84,10 +76,6 @@ class { 'rabbitmq': environment_variables => { 'NODENAME' => 'rabbit@foobar' }, erlang_cookie => 'TESTCOOKIE', } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp, expect_failures: true) diff --git a/spec/acceptance/delete_guest_user_spec.rb b/spec/acceptance/delete_guest_user_spec.rb index 15bdff93f..faa9ca957 100644 --- a/spec/acceptance/delete_guest_user_spec.rb +++ b/spec/acceptance/delete_guest_user_spec.rb @@ -10,10 +10,6 @@ class { 'rabbitmq': port => 5672, delete_guest_user => true, } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp, catch_failures: true) diff --git a/spec/acceptance/parameter_spec.rb b/spec/acceptance/parameter_spec.rb index 38ed4b53a..59c5bc50d 100644 --- a/spec/acceptance/parameter_spec.rb +++ b/spec/acceptance/parameter_spec.rb @@ -6,10 +6,6 @@ context 'create parameter resource' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, diff --git a/spec/acceptance/policy_spec.rb b/spec/acceptance/policy_spec.rb index 1cd126344..857c0a698 100644 --- a/spec/acceptance/policy_spec.rb +++ b/spec/acceptance/policy_spec.rb @@ -6,10 +6,6 @@ context 'create policy resource' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, diff --git a/spec/acceptance/queue_spec.rb b/spec/acceptance/queue_spec.rb index 2934796e9..cb2c4efba 100644 --- a/spec/acceptance/queue_spec.rb +++ b/spec/acceptance/queue_spec.rb @@ -6,10 +6,6 @@ context 'create binding and queue resources when using default management port' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, @@ -80,10 +76,6 @@ class { 'rabbitmq': context 'create multiple bindings when same source / destination / vhost but different routing keys' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, @@ -168,10 +160,6 @@ class { 'rabbitmq': context 'create binding and queue resources when using a non-default management port' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, diff --git a/spec/acceptance/rabbitmqadmin_spec.rb b/spec/acceptance/rabbitmqadmin_spec.rb index fa127f1b4..fb7a6334e 100644 --- a/spec/acceptance/rabbitmqadmin_spec.rb +++ b/spec/acceptance/rabbitmqadmin_spec.rb @@ -10,10 +10,6 @@ class { 'rabbitmq': admin_enable => true, service_manage => true, } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS apply_manifest(pp, catch_failures: true) @@ -31,10 +27,6 @@ class { 'rabbitmq': admin_enable => true, service_manage => false, } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS shell('rm -f /var/lib/rabbitmq/rabbitmqadmin') @@ -55,10 +47,6 @@ class { 'rabbitmq': default_user => 'foobar', default_pass => 'bazblam', } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS pp = <<-EOS @@ -68,10 +56,6 @@ class { 'rabbitmq': default_user => 'foobar', default_pass => 'bazblam', } - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true} - Class['erlang'] -> Class['rabbitmq'] - } EOS shell('rm -f /var/lib/rabbitmq/rabbitmqadmin') diff --git a/spec/acceptance/user_spec.rb b/spec/acceptance/user_spec.rb index a8d369218..63b22baf7 100644 --- a/spec/acceptance/user_spec.rb +++ b/spec/acceptance/user_spec.rb @@ -6,10 +6,6 @@ context 'create user resource' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 782e33df9..0a7e466a4 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -6,18 +6,14 @@ context 'create vhost resource' do it 'runs successfully' do pp = <<-EOS - if $facts['os']['family'] == 'RedHat' { - class { 'erlang': epel_enable => true } - Class['erlang'] -> Class['rabbitmq'] - } class { 'rabbitmq': service_manage => true, port => 5672, delete_guest_user => true, admin_enable => true, - } -> + } - rabbitmq_vhost { 'myhost': + -> rabbitmq_vhost { 'myhost': ensure => present, } EOS diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index a4332b42f..159e0b155 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -7,7 +7,7 @@ when 'Debian' install_puppet_module_via_pmt_on(host, 'puppetlabs-apt', '>= 4.1.0 < 9.0.0') when 'RedHat' - install_puppet_module_via_pmt_on(host, 'garethr-erlang', '>= 0.3.0 < 1.0.0') + install_puppet_module_via_pmt_on(host, 'puppet-epel', '>= 5.0.0 < 6.0.0') if fact_on(host, 'os.selinux.enabled') # Make sure selinux is disabled so the tests work. on host, puppet('resource', 'exec', 'setenforce 0', 'path=/bin:/sbin:/usr/bin:/usr/sbin', 'onlyif=which setenforce && getenforce | grep Enforcing')