From 1f583ce6a62ffd6246a9b6d000ad1b7a2dce94b8 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Thu, 14 Nov 2024 12:23:02 -0800 Subject: [PATCH 1/2] Fix apt pin for new version of apt module * Require package_apt_pin to be a non-empty string or number * Use `nil` instead of empty string in test for empty pin --- REFERENCE.md | 2 +- manifests/init.pp | 2 +- spec/classes/rabbitmq_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 6edb6d4bc..8ac74408f 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -725,7 +725,7 @@ Default value: `undef` ##### `package_apt_pin` -Data type: `Optional[Variant[Numeric, String]]` +Data type: `Optional[Variant[Numeric, String[1]]]` Whether to pin the package to a particular source diff --git a/manifests/init.pp b/manifests/init.pp index d27a681f3..671214f41 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -378,7 +378,7 @@ Boolean $management_ssl = true, Optional[String] $management_hostname = undef, Optional[String] $node_ip_address = undef, - Optional[Variant[Numeric, String]] $package_apt_pin = undef, + Optional[Variant[Numeric, String[1]]] $package_apt_pin = undef, String $package_ensure = 'installed', Optional[String] $package_gpg_key = undef, Optional[String] $repo_gpg_key = undef, diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 4e81698ce..c52ebf8da 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -83,7 +83,7 @@ end context 'with no pin', if: os_facts['os']['family'] == 'Debian' do - let(:params) { { repos_ensure: true, package_apt_pin: '' } } + let(:params) { { repos_ensure: true, package_apt_pin: nil } } describe 'it sets up an apt::source' do it { From 2a742df3fb105229cf7ee3882019ec29288d4b69 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Thu, 14 Nov 2024 17:44:27 -0800 Subject: [PATCH 2/2] Fix acceptance test on Ubuntu 22.04 - Add hosts entry for `foobar` in acceptance test step (resolves issue that was causing rabbitmq not to start) - Switch `rabbitmq::cluster[:local_node]` to have `catch_failures = true` vs `expect_failures = true` --- spec/acceptance/clustering_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/clustering_spec.rb b/spec/acceptance/clustering_spec.rb index e0a2b68c9..a3b205614 100644 --- a/spec/acceptance/clustering_spec.rb +++ b/spec/acceptance/clustering_spec.rb @@ -68,6 +68,10 @@ class { 'rabbitmq': context 'rabbitmq::cluster[:local_node] = foobar' do it 'runs successfully' do pp = <<-EOS + # Needed to avoid nxdomain error + host { 'foobar': + ip => '127.0.0.1', + } class { 'rabbitmq': cluster => { 'name' => 'rabbit_cluster', 'init_node' => 'foobar', 'local_node' => 'foobar' }, config_cluster => true, @@ -78,7 +82,7 @@ class { 'rabbitmq': } EOS - apply_manifest(pp, expect_failures: true) + apply_manifest(pp, catch_failures: true) end end end