Add top tiles to dashboard
This commit is contained in:
@@ -1,32 +1,5 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def get_conf
|
||||
conf = Hash.new
|
||||
node = Node.take
|
||||
if !node.nil?
|
||||
conf["host_name"] = node.host_name
|
||||
conf["host_ip"] = node.host_ip
|
||||
conf["user_name"] = node.user_name
|
||||
conf["user_password"] = node.user_password
|
||||
end
|
||||
return conf
|
||||
end
|
||||
|
||||
def get_conf_all
|
||||
conf_all = Array.new
|
||||
conf = Hash.new
|
||||
nodes = Node.all
|
||||
nodes.each do |node|
|
||||
conf["host_name"] = node.host_name
|
||||
conf["host_ip"] = node.host_ip
|
||||
conf["user_name"] = node.user_name
|
||||
conf["user_password"] = node.user_password
|
||||
conf_all << conf
|
||||
conf = Hash.new
|
||||
end
|
||||
return conf_all
|
||||
end
|
||||
|
||||
def get_df
|
||||
df = Array.new
|
||||
df_each = Hash.new
|
||||
@@ -49,25 +22,13 @@ module ApplicationHelper
|
||||
return df
|
||||
end
|
||||
|
||||
def users
|
||||
users = User.all
|
||||
return users
|
||||
end
|
||||
|
||||
def nodes
|
||||
nodes = Node.all
|
||||
return nodes
|
||||
end
|
||||
|
||||
def volumes
|
||||
volumes = Array.new
|
||||
volume = Hash.new
|
||||
conf = get_conf
|
||||
node = Node.take
|
||||
df = get_df
|
||||
command = String.new
|
||||
command << "sshpass -p#{conf['user_password']} "
|
||||
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
|
||||
command << "gluster volume info"
|
||||
command << "sshpass -p#{node.user_password} ssh #{node.user_name}@#{node.host_ip} gluster volume info"
|
||||
puts command
|
||||
output = `#{command}`.split("\n")
|
||||
output << "\n"
|
||||
@@ -89,4 +50,5 @@ module ApplicationHelper
|
||||
end
|
||||
return volumes
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
2
app/helpers/node_helper.rb
Normal file
2
app/helpers/node_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module NodeHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module PeerHelper
|
||||
end
|
||||
Reference in New Issue
Block a user