1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Bug in CLI: filter flag option for list and top commands was ignored

This commit is contained in:
Carlos Martín 2011-07-01 17:54:01 +02:00
parent 3cd1abe7ab
commit 08b64e8090
5 changed files with 16 additions and 15 deletions

View File

@ -81,9 +81,10 @@ EOT
end
end
def list_pool(options, top=false)
user_flag = options[:filter_flag] ? options[:filter_flag] : -2
pool = factory_pool(user_flag)
def list_pool(options, top=false, filter_flag=-2)
filter_flag ||= -2
pool = factory_pool(filter_flag)
rc = pool.info
return -1, rc.message if OpenNebula.is_error?(rc)
@ -200,15 +201,15 @@ EOT
def filterflag_to_i(str)
filter_flag = case str
when "a", "all" then "-2"
when "m", "mine" then "-3"
when "g", "group" then "-1"
when "a", "all" then -2
when "m", "mine" then -3
when "g", "group" then -1
else
if str.match(/^[0123456789]+$/)
str
str.to_i
else
user = translation_hash[:users].select { |k,v| v==str }
user.length > 0 ? user.first.first : "-2"
user.length > 0 ? user.first.first.to_i : -2
end
end

View File

@ -195,7 +195,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -211,6 +211,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :top, top_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -169,7 +169,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -185,6 +185,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :top, top_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -314,7 +314,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -332,6 +332,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :top, top_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -158,7 +158,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent