From a9aabfa161e18b5079caf04dc624e88042cbce14 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Fri, 8 Dec 2023 21:32:32 +1100 Subject: [PATCH] fix: failed to test previously - change next's outside of a loop to a single if statement --- site/profiles/lib/facter/mysql_wsrep.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/site/profiles/lib/facter/mysql_wsrep.rb b/site/profiles/lib/facter/mysql_wsrep.rb index caf5459..e5ff2a2 100644 --- a/site/profiles/lib/facter/mysql_wsrep.rb +++ b/site/profiles/lib/facter/mysql_wsrep.rb @@ -1,21 +1,21 @@ # frozen_string_literal: true # skip if mysql isnt installed or active -next unless system('which mysql > /dev/null 2>&1') -next unless system('systemctl is-active --quiet mariadb') +if system('which mysql > /dev/null 2>&1') && system('systemctl is-active --quiet mariadb') -# export mysql wsrep status -wsrep_status = `mysql -e "SHOW STATUS LIKE 'wsrep%';"` + # export mysql wsrep status + wsrep_status = `mysql -e "SHOW STATUS LIKE 'wsrep%';"` -# loop over the output -wsrep_status.each_line do |line| - # skip the line unless it starts with 'wsrep_' - next unless line.match(/^wsrep_/) + # loop over the output + wsrep_status.each_line do |line| + # skip the line unless it starts with 'wsrep_' + next unless line.match(/^wsrep_/) - key, value = line.split("\t") - Facter.add("mysql_#{key.strip}") do - setcode do - value.strip + key, value = line.split("\t") + Facter.add("mysql_#{key.strip}") do + setcode do + value.strip + end end end end