Merge branch 'DecoyJoe-bugfix/fix-548-cluster_status-output-formatting' into v5.x

(cherry picked from commit 1fe409b3)
parent f3ccb38f
......@@ -129,7 +129,7 @@ suites:
esl:
version: "1:23.0.2-2"
rabbitmq:
version: "3.8.4"
version: "3.8.5"
virtualhosts:
- vhost1
- vhost2
......@@ -224,7 +224,7 @@ suites:
erlang:
enabled: true
version: "22.3.4"
version: "3.8.4"
version: "3.8.5"
verifier:
inspec_tests:
- test/integration/default
......
......@@ -43,15 +43,20 @@ end
# Get cluster status result
def cluster_status
# Default formatting changed to "table" in 3.8, need to explicity specify
# "erlang" to parse output properly.
installed_version = Gem::Version.new(installed_rabbitmq_version)
version_requiring_formatter = Gem::Version.new('3.8.0')
cmd = +'rabbitmqctl -q cluster_status'
cmd << ' --formatter erlang' if installed_version >= version_requiring_formatter
# execute > rabbitmqctl cluster_status"
# This removes an optional "... Done" linee that older version used to output
cmd = 'rabbitmqctl -q cluster_status'
Chef::Log.debug("[rabbitmq_cluster] Executing #{cmd}")
cmd = get_shellout(cmd)
cmd.run_command
cmd.error!
result = cmd.stdout.squeeze(' ').gsub(/\n */, '').gsub('...done.', '')
Chef::Log.debug("[rabbitmq_cluster] rabbitmqctl cluster_status : #{result}")
Chef::Log.debug("[rabbitmq_cluster] #{cmd} : #{result}")
result
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment