1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

bug: fixes exitstatus access in Ruby scripts

This commit is contained in:
Ruben S. Montero 2011-09-16 13:39:52 +02:00
parent 58d26c0c24
commit db74e8532a
3 changed files with 7 additions and 6 deletions

View File

@ -398,7 +398,8 @@ EOT
editor_path = ENV["EDITOR"] ? ENV["EDITOR"] : EDITOR_PATH
system("#{editor_path} #{path}")
unless $?==0
unless $?.exitstatus == 0
puts "Editor not defined"
exit -1
end

View File

@ -27,7 +27,7 @@ end
######
nodeinfo_text = `virsh -c qemu:///system nodeinfo`
exit(-1) if $?!=0
exit(-1) if $?.exitstatus != 0
nodeinfo_text.split(/\n/).each{|line|
if line.match('^CPU\(s\)')
@ -46,7 +46,7 @@ nodeinfo_text.split(/\n/).each{|line|
NETINTERFACE = "eth1"
top_text=`top -bin2`
exit(-1) if $?!=0
exit(-1) if $?.exitstatus != 0
top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output
@ -72,7 +72,7 @@ $used_memory=tmp[0]
$free_memory=tmp[1]
net_text=`cat /proc/net/dev`
exit(-1) if $?!=0
exit(-1) if $?.exitstatus != 0
net_text.split(/\n/).each{|line|
if line.match("^ *#{NETINTERFACE}")

View File

@ -27,10 +27,10 @@ def print_info(name, value)
end
xentop_text=`sudo #{XENTOP_PATH} -bi2`
exit(-1) if $?!=0
exit(-1) if $?.exitstatus != 0
xm_text=`sudo #{XM_PATH} info`
exit(-1) if $?!=0
exit(-1) if $?.exitstatus != 0
#xentop_text.gsub!(/^xentop.*^xentop.*?$/m, "") # Strip first top output
xentop_text.gsub!("no limit", "no_limit")