1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #661: Add default format

This commit is contained in:
Daniel Molina 2011-06-14 17:34:35 +02:00
parent cd10967d2a
commit 021587d453
2 changed files with 9 additions and 15 deletions

View File

@ -74,7 +74,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Sets CPU, MEMORY and NUM_VMs quota for a given user
EOT
command 'quota-set', quotaset_desc , :userid, :text, :text, :text do
command 'quota-set', quotaset_desc , :userid, :cpu, :memory, :num_vms do
Dir.chdir VAR_LOCATION
begin
add_quota(*args[1..4])

View File

@ -160,7 +160,7 @@ module CommandParser
begin
rc = comm[:proc].call
rescue Exception =>e
puts e.message
#puts e.message
exit -1
end
@ -340,20 +340,14 @@ module CommandParser
argument = nil
error_msg = nil
format.each { |f|
if @formats[f]
rc = @formats[f][:proc].call(arg)
if rc[0]==0
argument=rc[1]
break
else
error_msg=rc[1]
next
end
format_hash = @formats[f] ? @formats[f] : @formats[:text]
rc = format_hash[:proc].call(arg)
if rc[0]==0
argument=rc[1]
break
else
puts "<#{f}> is not an aceptted format."
puts "Change your command specification or add " <<
"a new formatter"
exit -1
error_msg=rc[1]
next
end
}