Update node add function
This commit is contained in:
parent
2f5e7afc80
commit
06f7a66feb
@ -1,24 +1,16 @@
|
||||
module VolumeHelper
|
||||
|
||||
def get_conf
|
||||
config = Hash.new
|
||||
output = `cat configure.conf`.split("\n")
|
||||
output.each do |t|
|
||||
if t.include? "project_path="
|
||||
config["project_path"] = t.split("project_path=")[1]
|
||||
elsif t.include? "server_name="
|
||||
config["server_name"] = t.split("server_name=")[1]
|
||||
elsif t.include? "host_user="
|
||||
config["host_user"] = t.split("host_user=")[1]
|
||||
elsif t.include? "host_ip="
|
||||
config["host_ip"] = t.split("host_ip=")[1]
|
||||
elsif t.include? "host_port=" and !t.split("host_port=")[1].nil?
|
||||
config["host_port"] = t.split("host_port=")[1] + " "
|
||||
elsif t.include? "host_password="
|
||||
config["host_password"] = t.split("host_password=")[1]
|
||||
end
|
||||
@config = Hash.new
|
||||
|
||||
one_node = Node.take
|
||||
if !one_node.nil?
|
||||
@config["host_name"] = one_node.host_name
|
||||
@config["host_ip"] = one_node.host_ip
|
||||
@config["user_name"] = one_node.user_name
|
||||
@config["user_password"] = one_node.user_password
|
||||
end
|
||||
return config
|
||||
return @config
|
||||
end
|
||||
|
||||
def get_volumes
|
||||
@ -27,7 +19,7 @@ module VolumeHelper
|
||||
command = "df -P"
|
||||
df = `#{command}`
|
||||
conf = get_conf
|
||||
command = "sshpass -p#{conf['host_password']} ssh #{conf['host_user']}@#{conf['host_ip']} gluster volume info"
|
||||
command = "sshpass -p#{conf['user_password']} ssh #{conf['user_name']}@#{conf['host_ip']} gluster volume info"
|
||||
info = `#{command}`.split("\n")
|
||||
info << "\n"
|
||||
info.each do |t|
|
||||
|
Loading…
Reference in New Issue
Block a user