Test mount check

This commit is contained in:
Youngkyun Kim
2016-09-03 10:03:45 +00:00
parent d95f04f3ba
commit 0a576e4e99
4 changed files with 79 additions and 104 deletions

View File

@@ -32,17 +32,17 @@ class ApplicationController < ActionController::Base
file = Hash.new
@total_list = parsing_list[0]
for t in 1..(parsing_list.length-1)
parsing_file = parsing_list[t].split(" ")
file["auth"] = parsing_file[0]
file["size"] = parsing_file[4]
file["date"] = parsing_file[5] + " " + parsing_file[6] + " " + parsing_file[7]
file["name"] = parsing_file[8]
@files << file
file = Hash.new
end
puts @files
return @files
for t in 1..(parsing_list.length-1)
parsing_file = parsing_list[t].split(" ")
file["auth"] = parsing_file[0]
file["size"] = parsing_file[4]
file["date"] = parsing_file[5] + " " + parsing_file[6] + " " + parsing_file[7]
file["name"] = parsing_file[8]
@files << file
file = Hash.new
end
puts @files
return @files
end
def checkDir

View File

@@ -10,21 +10,35 @@ class VolumeController < ApplicationController
if get_info.blank?
flash[:danger] = "Check Server"
else
output = get_info.split("\n")
for t in 1..(output.length-1)
if output[t].include? ":"
temp = output[t].split(":")
volume[temp[0]] = temp[1]
else
@volumes << volume
volume = Hash.new
end
info = get_info.split("\n")
df = get_df
puts df
for t in 1..(info.length-1)
if info[t].include? ":"
temp = info[t].split(":")
volume[temp[0]] = temp[1]
else
if df.include? volume['Volume Name']
volume['Mount State'] = "Mounted"
else
volume['Mount State'] = "UnMounted"
end
puts volume['Volume Name'] + ": " + volume['Mount State']
@volumes << volume
volume = Hash.new
end
end
@volumes << volume
# puts @volumes
end
end
def get_df
@config = get_conf
return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} df -P`
end
def get_info
@config = get_conf