refacter: renamed facts to libs

This commit is contained in:
2024-02-17 23:03:54 +11:00
parent e10bed689c
commit 1030ba460e
16 changed files with 0 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# frozen_string_literal: true
# skip if mysql isnt installed or active
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%';"`
# 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
end
end
end
end