Merge branch 'master' of https://github.com/oss2016summer/gluster-web-interface
This commit is contained in:
commit
a37d4b6051
@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
|
||||
include ApplicationHelper
|
||||
include HomeHelper
|
||||
include VolumeHelper
|
||||
include NodeHelper
|
||||
|
||||
def require_login
|
||||
unless user_signed_in?
|
||||
@ -12,5 +13,4 @@ class ApplicationController < ActionController::Base
|
||||
redirect_to "/users/sign_in" # halts request cycle
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,6 +3,37 @@ class NodeController < ApplicationController
|
||||
def index
|
||||
@hosts = Array.new
|
||||
@nodes = Node.all.order("id asc")
|
||||
|
||||
@node_connects = Array.new
|
||||
node_info = Hash.new
|
||||
one_node = Node.take
|
||||
|
||||
node_info["Hostname"] = one_node.host_name
|
||||
node_info["State"] = "Peer in Cluster Disconnected"
|
||||
node_info = Hash.new
|
||||
|
||||
if !one_node.blank?
|
||||
if ping_test?(one_node.host_ip)
|
||||
command = String.new
|
||||
command << "sshpass -p#{one_node.user_password} ssh #{one_node.user_name}@#{one_node.host_ip} gluster peer status info"
|
||||
puts command
|
||||
output = `#{command}`.split("\n")
|
||||
output << "\n"
|
||||
|
||||
output.each do |t|
|
||||
next if t.equal? output.first
|
||||
if t.include? ":"
|
||||
temp = t.split(":")
|
||||
node_info[temp[0]] = temp[1]
|
||||
else
|
||||
@node_connects << node_info
|
||||
node_info = Hash.new
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if get_hosts.blank?
|
||||
flash[:danger] = "Check Server"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user