From 02c56be5340b079797fdb9944e1e048f1c3a18b7 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Fri, 2 Feb 2018 12:30:22 -0600 Subject: [PATCH] Remove the rabbitmq_nodename fact This fact will not work on a standby node. it requires a drbd folder in order for rabbitmqctl status to work. --- lib/facter/rabbitmq_nodename.rb | 8 ------ spec/unit/rabbitmq_nodename_spec.rb | 50 ------------------------------------- 2 files changed, 58 deletions(-) delete mode 100644 lib/facter/rabbitmq_nodename.rb delete mode 100644 spec/unit/rabbitmq_nodename_spec.rb diff --git a/lib/facter/rabbitmq_nodename.rb b/lib/facter/rabbitmq_nodename.rb deleted file mode 100644 index 2ee7926..0000000 --- a/lib/facter/rabbitmq_nodename.rb +++ /dev/null @@ -1,8 +0,0 @@ -Facter.add(:rabbitmq_nodename) do - setcode do - if Facter::Core::Execution.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/rabbitmq_nodename_spec.rb b/spec/unit/rabbitmq_nodename_spec.rb deleted file mode 100644 index 621d7eb..0000000 --- a/spec/unit/rabbitmq_nodename_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -require "spec_helper" - -describe Facter::Util::Fact do - before { - Facter.clear - } - - describe "rabbitmq_nodename" do - context 'with value' do - before :each do - Facter::Core::Execution.stubs(:which).with('rabbitmqctl').returns(true) - Facter::Core::Execution.stubs(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit1 ...') - end - it { - expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit1') - } - end - - context 'with dashes in hostname' do - before :each do - Facter::Core::Execution.stubs(:which).with('rabbitmqctl').returns(true) - Facter::Core::Execution.stubs(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit-1 ...') - end - it { - expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1') - } - end - - context 'with quotes around node name' do - before :each do - Facter::Core::Execution.stubs(:which).with('rabbitmqctl').returns(true) - Facter::Core::Execution.stubs(:execute).with('rabbitmqctl status 2>&1').returns('Status of node \'monty@rabbit-1\' ...') - end - it { - expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1') - } - end - - context 'without trailing points' do - before :each do - Facter::Core::Execution.stubs(:which).with('rabbitmqctl').returns(true) - Facter::Core::Execution.stubs(:execute).with('rabbitmqctl status 2>&1').returns('Status of node monty@rabbit-1') - end - it { - expect(Facter.fact(:rabbitmq_nodename).value).to eq('monty@rabbit-1') - } - end - - end -end -- 1.8.3.1