fix: failed to test previously
- change next's outside of a loop to a single if statement
This commit is contained in:
parent
c91e3e632e
commit
a9aabfa161
@ -1,21 +1,21 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# skip if mysql isnt installed or active
|
# skip if mysql isnt installed or active
|
||||||
next unless system('which mysql > /dev/null 2>&1')
|
if system('which mysql > /dev/null 2>&1') && system('systemctl is-active --quiet mariadb')
|
||||||
next unless system('systemctl is-active --quiet mariadb')
|
|
||||||
|
|
||||||
# export mysql wsrep status
|
# export mysql wsrep status
|
||||||
wsrep_status = `mysql -e "SHOW STATUS LIKE 'wsrep%';"`
|
wsrep_status = `mysql -e "SHOW STATUS LIKE 'wsrep%';"`
|
||||||
|
|
||||||
# loop over the output
|
# loop over the output
|
||||||
wsrep_status.each_line do |line|
|
wsrep_status.each_line do |line|
|
||||||
# skip the line unless it starts with 'wsrep_'
|
# skip the line unless it starts with 'wsrep_'
|
||||||
next unless line.match(/^wsrep_/)
|
next unless line.match(/^wsrep_/)
|
||||||
|
|
||||||
key, value = line.split("\t")
|
key, value = line.split("\t")
|
||||||
Facter.add("mysql_#{key.strip}") do
|
Facter.add("mysql_#{key.strip}") do
|
||||||
setcode do
|
setcode do
|
||||||
value.strip
|
value.strip
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user