update
This commit is contained in:
parent
179afe0bd7
commit
2f5e7afc80
@ -14,22 +14,22 @@ class ApplicationController < ActionController::Base
|
|||||||
@config["user_password"] = one_node.user_password
|
@config["user_password"] = one_node.user_password
|
||||||
end
|
end
|
||||||
|
|
||||||
output = `cat configure.conf`.split("\n")
|
# output = `cat configure.conf`.split("\n")
|
||||||
output.each do |t|
|
# output.each do |t|
|
||||||
if t.include? "project_path="
|
# if t.include? "project_path="
|
||||||
@config["project_path"] = t.split("project_path=")[1]
|
# @config["project_path"] = t.split("project_path=")[1]
|
||||||
elsif t.include? "server_name="
|
# elsif t.include? "server_name="
|
||||||
@config["server_name"] = t.split("server_name=")[1]
|
# @config["server_name"] = t.split("server_name=")[1]
|
||||||
elsif t.include? "host_user="
|
# elsif t.include? "host_user="
|
||||||
@config["host_user"] = t.split("host_user=")[1]
|
# @config["host_user"] = t.split("host_user=")[1]
|
||||||
elsif t.include? "host_ip="
|
# elsif t.include? "host_ip="
|
||||||
@config["host_ip"] = t.split("host_ip=")[1]
|
# @config["host_ip"] = t.split("host_ip=")[1]
|
||||||
elsif t.include? "host_port=" and !t.split("host_port=")[1].nil?
|
# elsif t.include? "host_port=" and !t.split("host_port=")[1].nil?
|
||||||
@config["host_port"] = t.split("host_port=")[1] + " "
|
# @config["host_port"] = t.split("host_port=")[1] + " "
|
||||||
elsif t.include? "host_password="
|
# elsif t.include? "host_password="
|
||||||
@config["host_password"] = t.split("host_password=")[1]
|
# @config["host_password"] = t.split("host_password=")[1]
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
return @config
|
return @config
|
||||||
|
@ -62,12 +62,10 @@ class VolumeController < ApplicationController
|
|||||||
bricks = params[:bricks]
|
bricks = params[:bricks]
|
||||||
# make command string
|
# make command string
|
||||||
command = String.new
|
command = String.new
|
||||||
command << "sshpass -p" + @config["host_password"].to_s
|
command << "sshpass -p" + @config["user_password"].to_s
|
||||||
command << " ssh "
|
command << " ssh "
|
||||||
if !@config["host_port"].nil?
|
|
||||||
command << "-p " + @config["host_port"].to_s + " "
|
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
|
||||||
end
|
|
||||||
command << @config["host_user"].to_s + "@" + @config["host_ip"].to_s
|
|
||||||
command << " gluster volume create " + volume_name + " "
|
command << " gluster volume create " + volume_name + " "
|
||||||
if !volume_type.include? "Distribute"
|
if !volume_type.include? "Distribute"
|
||||||
command << volume_type.downcase + " " + num_of_brick + " "
|
command << volume_type.downcase + " " + num_of_brick + " "
|
||||||
@ -86,12 +84,10 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
# make command string
|
# make command string
|
||||||
command = String.new
|
command = String.new
|
||||||
command << "yes | sshpass -p" + @config["host_password"].to_s
|
command << "yes | sshpass -p" + @config["user_password"].to_s
|
||||||
command << " ssh "
|
command << " ssh "
|
||||||
if !@config["host_port"].nil?
|
|
||||||
command << "-p " + @config["host_port"].to_s + " "
|
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
|
||||||
end
|
|
||||||
command << @config["host_user"].to_s + "@" + @config["host_ip"].to_s
|
|
||||||
command << " gluster volume stop " + volume_name
|
command << " gluster volume stop " + volume_name
|
||||||
puts command
|
puts command
|
||||||
`#{command}`
|
`#{command}`
|
||||||
@ -103,12 +99,10 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
# make command string
|
# make command string
|
||||||
command = String.new
|
command = String.new
|
||||||
command << "sshpass -p" + @config["host_password"].to_s
|
command << "sshpass -p" + @config["user_password"].to_s
|
||||||
command << " ssh "
|
command << " ssh "
|
||||||
if !@config["host_port"].nil?
|
|
||||||
command << "-p " + @config["host_port"].to_s + " "
|
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
|
||||||
end
|
|
||||||
command << @config["host_user"].to_s + "@" + @config["host_ip"].to_s
|
|
||||||
command << " gluster volume start " + volume_name.to_s
|
command << " gluster volume start " + volume_name.to_s
|
||||||
puts command
|
puts command
|
||||||
`#{command}`
|
`#{command}`
|
||||||
@ -120,12 +114,10 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
# make command string
|
# make command string
|
||||||
command = String.new
|
command = String.new
|
||||||
command << "yes | sshpass -p" + @config["host_password"].to_s
|
command << "yes | sshpass -p" + @config["user_password"].to_s
|
||||||
command << " ssh "
|
command << " ssh "
|
||||||
if !@config["host_port"].nil?
|
|
||||||
command << "-p " + @config["host_port"].to_s + " "
|
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
|
||||||
end
|
|
||||||
command << @config["host_user"].to_s + "@" + @config["host_ip"].to_s
|
|
||||||
command << " gluster volume delete " + volume_name
|
command << " gluster volume delete " + volume_name
|
||||||
puts command
|
puts command
|
||||||
`#{command}`
|
`#{command}`
|
||||||
|
Loading…
Reference in New Issue
Block a user