/usr/share/pcsd/fenceagent.rb is in pcs 0.9.164-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | def getFenceAgents(auth_user)
fence_agent_list = {}
stdout, stderr, retval = run_cmd(
auth_user, PCS, "stonith", "list", "--nodesc"
)
if retval != 0
$logger.error("Error running 'pcs stonith list --nodesc")
$logger.error(stdout + stderr)
return {}
end
agents = stdout
agents.each { |a|
fa = FenceAgent.new
fa.name = a.chomp
fence_agent_list[fa.name] = fa
}
return fence_agent_list
end
class FenceAgent
attr_accessor :name, :resource_class, :required_options, :optional_options, :advanced_options, :info
def initialize(name=nil, required_options={}, optional_options={}, resource_class=nil, advanced_options={})
@name = name
@required_options = {}
@optional_options = {}
@required_options = required_options
@optional_options = optional_options
@advanced_options = advanced_options
@resource_class = nil
end
def type
name
end
def to_json(options = {})
JSON.generate({:type => name})
end
def long_desc
if info && info.length >= 2
return info[1]
end
return ""
end
def short_desc
if info && info.length >= 1
return info[0]
end
return ""
end
end
|