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

feature #1112: Fix CLI option procs

This commit is contained in:
Daniel Molina 2012-03-13 16:00:55 +01:00
parent dce32e1351
commit b304a6d896
4 changed files with 16 additions and 4 deletions

View File

@ -311,7 +311,7 @@ EOT
opts.on(*args) do |o|
if e[:proc]
@options[e[:name].to_sym]=e[:proc].call(o, @options)
e[:proc].call(o, @options)
elsif e[:name]=="help"
help
exit

View File

@ -202,7 +202,7 @@ EOT
result = names.split(',').collect { |name|
if name.match(/^[0123456789]+$/)
name
name.to_i
else
rc = OneHelper.name_to_id(name, pool, poolname)

View File

@ -27,7 +27,13 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
:proc => lambda { |o, options|
ch = OneClusterHelper.new
rc, cid = ch.to_id(o)
cid
if rc == 0
options[:cluster] = cid
else
puts cid
puts "option cluster: Parsing error"
exit -1
end
}
}

View File

@ -26,7 +26,13 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
:proc => lambda { |o, options|
ch = OneDatastoreHelper.new
rc, dsid = ch.to_id(o)
dsid
if rc == 0
options[:datastore] = dsid
else
puts dsid
puts "option datastore: Parsing error"
exit -1
end
}
}