From 0eee3687c7f261172c4c46b26e1bc87f3dcbf788 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 19 May 2024 19:09:51 +0200 Subject: [PATCH 1/2] metadata.json: Re-add Puppet 8 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 02d12ab66..16eb5c1d9 100644 --- a/metadata.json +++ b/metadata.json @@ -52,7 +52,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "dependencies": [ From 73d60aa0d0952aa388ddb79f504df88ee7d3535c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 19 May 2024 19:30:09 +0200 Subject: [PATCH 2/2] switch from legacy facts to structed facts --- lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb | 2 +- spec/acceptance/clustering_spec.rb | 4 ++-- templates/rabbitmqadmin.conf.epp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb b/lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb index 7cb38cc07..1d529f831 100644 --- a/lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb +++ b/lib/puppet/provider/rabbitmq_cluster/rabbitmqctl.rb @@ -18,7 +18,7 @@ def create init_node = @resource[:init_node].to_s.gsub(%r{^.*@}, '') local_node = @resource[:local_node].to_s.gsub(%r{^.*@}, '') - if local_node == init_node || [Facter.value(:hostname), Facter.value(:fqdn)].include?(init_node) + if local_node == init_node || [Facter.value(:networking)['hostname'], Facter.value(:networking)['fqdn']].include?(init_node) return rabbitmqctl('set_cluster_name', @resource[:name]) unless cluster_name == resource[:name].to_s else rabbitmqctl('stop_app') diff --git a/spec/acceptance/clustering_spec.rb b/spec/acceptance/clustering_spec.rb index 49e3261cc..e0a2b68c9 100644 --- a/spec/acceptance/clustering_spec.rb +++ b/spec/acceptance/clustering_spec.rb @@ -7,7 +7,7 @@ it 'runs successfully' do pp = <<-EOS class { 'rabbitmq': - cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] }, + cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['networking']['fqdn'] }, config_cluster => true, cluster_nodes => ['rabbit1', 'rabbit2'], cluster_node_type => 'ram', @@ -28,7 +28,7 @@ class { 'rabbitmq': it 'runs successfully' do pp = <<-EOS class { 'rabbitmq': - cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['fqdn'] }, + cluster => { 'name' => 'rabbit_cluster', 'init_node' => $facts['networking']['fqdn'] }, config_cluster => true, cluster_nodes => ['rabbit1', 'rabbit2'], cluster_node_type => 'ram', diff --git a/templates/rabbitmqadmin.conf.epp b/templates/rabbitmqadmin.conf.epp index 6989bd734..7ec543d3d 100644 --- a/templates/rabbitmqadmin.conf.epp +++ b/templates/rabbitmqadmin.conf.epp @@ -6,7 +6,7 @@ ssl_cert_file = <%= $rabbitmq::config::ssl_management_cert %> ssl_key_file = <%= $rabbitmq::config::ssl_management_key %> port = <%= $rabbitmq::config::ssl_management_port %> <% unless $rabbitmq::config::management_hostname {-%> -hostname = <%= $networking[fqdn] %> +hostname = <%= $facts['networking']['fqdn'] %> <% } -%> <% } else {-%> port = <%= $rabbitmq::config::management_port %>