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

Feature #661: Implement onegrop and oneuser commands marked with "TODO"

This commit is contained in:
Carlos Martín 2011-06-16 18:34:17 +02:00
parent 4b0dbe5071
commit e1aa008db1
5 changed files with 54 additions and 17 deletions

View File

@ -41,6 +41,21 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
OpenNebula::GroupPool.new(@client)
end
def format_resource(group)
str="%-15s: %-20s"
str_h1="%-80s"
CLIHelper.print_header(str_h1 % "GROUP #{group['ID']} INFORMATION")
puts str % ["ID", group.id.to_s]
puts str % ["NAME", group.name]
puts
CLIHelper.print_header(str_h1 % "USERS",false)
group.user_ids.each do |uid|
puts str % ["ID", uid]
end
end
def format_pool(pool, options, top=false)
config_file=self.class.table_conf
table=CLIHelper::ShowTable.new(config_file, self) do

View File

@ -63,6 +63,24 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
OpenNebula::UserPool.new(@client)
end
def format_resource(user)
str="%-15s: %-20s"
str_h1="%-80s"
CLIHelper.print_header(str_h1 % "USER #{user['ID']} INFORMATION")
puts str % ["ID", user.id.to_s]
puts str % ["NAME", user.name]
puts str % ["GROUP", user.gid]
puts str % ["PASSWORD", user['PASSWORD']]
puts str % ["ENABLED", user['ENABLED']]
puts
CLIHelper.print_header(str_h1 % "SECONDARY GROUPS",false)
user.group_ids.each do |gid|
puts str % ["ID", uid]
end
end
def format_pool(pool, options, top=false)
config_file=self.class.table_conf
table=CLIHelper::ShowTable.new(config_file, self) do

View File

@ -93,8 +93,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :show, show_desc, :groupid, :options=>OpenNebulaHelper::XML do
puts "TODO"
-1
helper.show_resource(args[0],options)
end
end

View File

@ -93,6 +93,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
publish_desc = <<-EOT.unindent
Publishes the given Image. A public Image can be seen and used by other
Users in the Image's group
EOT
command :publish, publish_desc, [:range,:imageid_list] do
helper.perform_actions(args[0],options,"published") do |image|
image.publish
@ -185,10 +190,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
show_desc = <<-EOT.unindent
Shows information for the given Image
EOT
list_desc = <<-EOT.unindent
Lists Images in the pool
EOT
@ -197,15 +198,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
helper.list_pool(options)
end
show_desc = <<-EOT.unindent
Shows information for the given Image
EOT
command :show, show_desc, :imageid, :options=>OpenNebulaHelper::XML do
helper.show_resource(args[0],options)
end
publish_desc = <<-EOT.unindent
Publishes the given Image. A public Image can be seen and used by other
Users in the Image's group
EOT
top_desc = <<-EOT.unindent
Lists Images continuously
EOT

View File

@ -129,8 +129,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :addgroup, addgroup_desc, [:range, :userid_list], :groupid do
puts "TODO"
-1
gid = args[1]
helper.perform_actions(args[0],options,"group added") do |user|
user.addgroup( gid )
end
end
delgroup_desc = <<-EOT.unindent
@ -138,8 +141,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :delgroup, delgroup_desc, [:range, :userid_list], :groupid do
puts "TODO"
-1
gid = args[1]
helper.perform_actions(args[0],options,"group deleted") do |user|
user.delgroup( gid )
end
end
list_desc = <<-EOT.unindent
@ -155,8 +161,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :show, show_desc, :userid, :options=>OpenNebulaHelper::XML do
puts "TODO"
-1
helper.show_resource(args[0],options)
end
end