integ/config/puppet-modules/puppet-rabbitmq-8.5.0/debian/patches/0003-Remove-the-rabbitmq_nodename-fact.patch
Dan Voiculeasa f15d12a123 Add debian package for puppet-rabbitmq-8.5.0
Aligned with Debian Bullseye version puppet-rabbitmq-8.5.0-6.

Did build puppet-rabbitmq-8.5.0 + starlingx patches(adapted from
CentOS7).
Did build an iso.

Story: 2009101
Task: 43300
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I4f859b16e719e0a48c45e99906893362833bddaa
2021-09-23 18:17:53 +03:00

126 lines
4.5 KiB
Diff

From 7f96ef518f58f80071541a7780877a3ed29c088c Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Mon, 13 Sep 2021 20:25:50 +0300
Subject: [PATCH] Remove the rabbitmq_nodename fact
The work represents an adaptation of
0005-Remove-the-rabbitmq_nodename-fact.patch from CentOS.
This fact will not work on a standby node. It requires a drbd folder in
order for rabbitmqctl status to work.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
lib/facter/rabbitmq_nodename.rb | 8 --
.../util/fact_rabbitmq_nodename_spec.rb | 83 -------------------
2 files changed, 91 deletions(-)
delete mode 100644 lib/facter/rabbitmq_nodename.rb
delete mode 100644 spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb
diff --git a/lib/facter/rabbitmq_nodename.rb b/lib/facter/rabbitmq_nodename.rb
deleted file mode 100644
index 8dee93c..0000000
--- a/lib/facter/rabbitmq_nodename.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-Facter.add(:rabbitmq_nodename) do
- setcode do
- if Facter::Util::Resolution.which('rabbitmqctl')
- rabbitmq_nodename = Facter::Core::Execution.execute('rabbitmqctl status 2>&1')
- %r{^Status of node '?([\w\.\-]+@[\w\.\-]+)'?}.match(rabbitmq_nodename)[1]
- end
- end
-end
diff --git a/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb b/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb
deleted file mode 100644
index 0abf833..0000000
--- a/spec/unit/facter/util/fact_rabbitmq_nodename_spec.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-require 'spec_helper'
-
-describe Facter::Util::Fact do
- before { Facter.clear }
-
- describe 'rabbitmq_nodename' do
- context 'with value' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit1 ...')
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit1')
- end
- end
-
- context 'with dashes in hostname' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit-1 ...')
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
- end
- end
-
- context 'with dashes in nodename/hostname' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty-python@rabbit-1 ...')
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty-python@rabbit-1')
- end
- end
-
- context 'with quotes around node name' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns('Status of node \'monty@rabbit-1\' ...')
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
- end
- end
-
- context 'without trailing points' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit-1')
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
- end
- end
-
- context 'rabbitmq is not running' do
- it do
- error_string = <<-EOS
-Status of node 'monty@rabbit-1' ...
-Error: unable to connect to node 'monty@rabbit-1': nodedown
-
-DIAGNOSTICS
-===========
-
-attempted to contact: ['monty@rabbit-1']
-
-monty@rabbit-1:
- * connected to epmd (port 4369) on centos-7-x64
- * epmd reports: node 'rabbit' not running at all
- no other nodes on centos-7-x64
- * suggestion: start the node
-
-current node details:
-- node name: 'rabbitmq-cli-73@centos-7-x64'
-- home dir: /var/lib/rabbitmq
-- cookie hash: 6WdP0nl6d3HYqA5vTKMkIg==
-
- EOS
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true)
- Facter::Core::Execution.expects(:execute).with('rabbitmqctl status 2>&1').returns(error_string)
- expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1')
- end
- end
-
- context 'rabbitmqctl is not in path' do
- it do
- Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(false)
- expect(Facter.fact(:rabbitmq_nodename).value).to be_nil
- end
- end
- end
-end
--
2.30.0