Update
This commit is contained in:
parent
aeeabdc41c
commit
c0188d971f
@ -127,26 +127,30 @@ module ApplicationHelper
|
|||||||
node["updated_at"] = db_node.updated_at
|
node["updated_at"] = db_node.updated_at
|
||||||
node["ping"] = (ping_test?(db_node.host_ip) ? "true" : "false")
|
node["ping"] = (ping_test?(db_node.host_ip) ? "true" : "false")
|
||||||
|
|
||||||
if node["ping"].eql? "true"
|
begin
|
||||||
command = String.new
|
if node["ping"].eql? "true"
|
||||||
command << "sshpass -p#{node["user_password"]} ssh #{node["user_name"]}@#{node["host_ip"]} gluster peer status"
|
command = String.new
|
||||||
puts command
|
command << "sshpass -p#{node["user_password"]} ssh #{node["user_name"]}@#{node["host_ip"]} gluster peer status"
|
||||||
output = `#{command}`.split("\n")
|
puts command
|
||||||
|
output = `#{command}`.split("\n")
|
||||||
|
|
||||||
if output[0].include? "Number of Peers"
|
if output[0].include? "Number of Peers"
|
||||||
node["ssh"] = "on"
|
node["ssh"] = "on"
|
||||||
node["gluster"] = "on"
|
node["gluster"] = "on"
|
||||||
node["number_of_peers"] = output[0].split(": ")[1]
|
node["number_of_peers"] = output[0].split(": ")[1]
|
||||||
# put peers
|
# put peers
|
||||||
|
elsif output[0].include? "check if gluster daemon is operational."
|
||||||
elsif output[0].include? "check if gluster daemon is operational."
|
node["ssh"] = "on"
|
||||||
node["ssh"] = "on"
|
node["gluster"] = "off"
|
||||||
node["gluster"] = "off"
|
else
|
||||||
else
|
node["ssh"] = "off"
|
||||||
node["ssh"] = "off"
|
node["gluster"] = "off"
|
||||||
node["gluster"] = "off"
|
end
|
||||||
end
|
end
|
||||||
|
rescue => ex
|
||||||
|
puts ex
|
||||||
end
|
end
|
||||||
|
|
||||||
nodes << node
|
nodes << node
|
||||||
node = Hash.new
|
node = Hash.new
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user