Vincent Untz dd48572ffe Refer to "Fencing agent", not "STONITH plugin"
This is the recommendation from HA people.
2014-03-28 23:49:03 +01:00

25 lines
545 B
Ruby

module PacemakerStonithHelper
@@stonith_agents = nil
def self.stonith_agent_valid?(agent)
if agent.nil? || agent.empty?
false
else
if @@stonith_agents.nil?
out = %x{stonith -L}
if $?.success?
@@stonith_agents = out.split("\n")
end
end
!@@stonith_agents.nil? && @@stonith_agents.include?(agent)
end
end
def self.assert_stonith_agent_valid(agent)
unless stonith_agent_valid? agent
raise "STONITH fencing agent #{agent} is not available!"
end
end
end