Feature #2570: Add command line arguments for resource in group users creation ACL

This commit is contained in:
Tino Vazquez committed 2013-12-20 15:27:51 +01:00
1 parent eb515a4756
commit 2e09c94eb9
3 files changed
+65 -7

No files matched your search

+52
View File
@@ -110,6 +110,58 @@ EOT
}
]
GROUP_OPTIONS=[
{
:name => 'name',
:large => '--name name',
:short => "-n",
:description =>
'Name for the new group',
:format => String
},
{
:name => 'admin_group',
:large => '--admin_group name',
:short => "-a",
:description =>
'Creates an admin group with name',
:format => String
},
{
:name => 'admin_user',
:large => '--admin_user name',
:short => "-u",
:description =>
'Creates an admin user for the group with name',
:format => String
},
{
:name => 'admin_passwd',
:large => '--admin_passwd password',
:short => "-p",
:description =>
'Password for the admin user of the group',
:format => String
},
{
:name => 'admin_driver',
:large => '--admin_driver auth_driver',
:short => "-d",
:description =>
'Auth driver for the admin user of the group',
:format => String
},
{
:name => 'resources',
:large => '--resources resources_str',
:short => "-r",
:description =>
'Which resources can be created by group users "\
"(VM+NET+IMAGE+TEMPLATE by default)',
:format => String
}
]
#NOTE: Other options defined using this array, add new options at the end
TEMPLATE_OPTIONS=[
{
+3 -2
View File
@@ -148,12 +148,13 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
variable_reg =/\s*(#{name_reg})\s*=\s*/
single_variable_reg =/^#{variable_reg}([^\[]+?)(#.*)?$/
tmpl = Hash.new
tmpl['user'] = Hash.new
tmpl = Hash.new
tmpl['user'] = Hash.new
tmpl_str.scan(single_variable_reg) do | m |
key = m[0].strip.downcase
value = m[1].strip
puts key
case key
when "admin_user_name"
tmpl['user']['name']=value
+10 -5
View File
@@ -85,11 +85,16 @@ module OpenNebula
return rc_alloc
end
# If we have resource providers, add them
if group_hash[:cluster_ids]
for cid in group_hash[:cluster_ids]
# TODO 0 is zone_id
self.add_provider({"zone_id"=>0, "cluster_id"=>cid.to_i})
# Handle resource providers
if group_hash[:resource_providers]
for rp in group_hash[:resource_providers]
# If we have resource providers, add them
if rp[:cluster_ids] and rp[:cluster_ids]
for cid in rp[:cluster_ids]
self.add_provider({"zone_id"=>rp[:zone_id],
"cluster_id"=>cid.to_i})
end
end
end
end