mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-10 00:58:17 +03:00
Changed check in create admin user (OCA)
This commit is contained in:
parent
86f46cced4
commit
a790d94f2e
@ -89,7 +89,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
onegroup create --name groupA
|
||||
--admin_user admin_userA --admin_password somestr
|
||||
--resource TEMPLATE+VM
|
||||
--resource TEMPLATE+VM
|
||||
--admin_resources TEMPLATE+VM+IMAGE+NET
|
||||
|
||||
EOT
|
||||
@ -110,14 +110,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
|
||||
admin_user=Hash.new
|
||||
admin_user[:name] = options[:admin_user]
|
||||
admin_user[:password] = options[:admin_password]
|
||||
if options[:admin_driver]
|
||||
admin_user[:auth_driver] = options[:admin_driver]
|
||||
end
|
||||
if options[:admin_resources]
|
||||
admin_user[:resources] = options[:admin_resources]
|
||||
end
|
||||
admin_user[:name] = options[:admin_user]
|
||||
admin_user[:password] = options[:admin_password]
|
||||
admin_user[:auth_driver]= options[:admin_driver] if options[:admin_driver]
|
||||
admin_user[:resources] = options[:admin_resources] if options[:admin_resources]
|
||||
|
||||
options[:group_admin] = admin_user
|
||||
end
|
||||
|
||||
@ -145,7 +142,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
obj.update(str, options[:append])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
delete_desc = <<-EOT.unindent
|
||||
Deletes the given Group
|
||||
@ -196,7 +193,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
exit -1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
batchquota_desc = <<-EOT.unindent
|
||||
Sets the quota limits in batch for various groups. If a path is not
|
||||
|
@ -79,10 +79,9 @@ module OpenNebula
|
||||
alias_method :info!, :info
|
||||
|
||||
# Creates a group based in a group definition hash
|
||||
# group_hash[:name]
|
||||
# group_hash[:admin_group]
|
||||
# group_hash[:user][:name]
|
||||
# group_hash[:user][:password]
|
||||
# group_hash[:name] the group name
|
||||
# group_hash[:group_admin] the admin user definition hash, see def
|
||||
# create_admin_user function description for details.
|
||||
# group_hash[:resource_providers]
|
||||
# group_hash[:resource_providers][:zone_id]
|
||||
# group_hash[:resource_providers][:cluster_id]
|
||||
@ -94,7 +93,7 @@ module OpenNebula
|
||||
end
|
||||
|
||||
if group_hash[:group_admin]
|
||||
if group_hash[:group_admin][:name] and !group_hash[:group_admin][:password]
|
||||
if group_hash[:group_admin][:name] && !group_hash[:group_admin][:password]
|
||||
error_msg = "Admin user password not defined"
|
||||
return OpenNebula::Error.new(error_msg)
|
||||
end
|
||||
@ -274,12 +273,12 @@ module OpenNebula
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
def create_admin_user(gdef)
|
||||
|
||||
return nil if !gdef[:group_admin] or !gdef[:group_admin][:name]
|
||||
return nil if gdef[:group_admin].nil? || gdef[:group_admin][:name].nil?
|
||||
|
||||
# Create group admin
|
||||
uadmin = gdef[:group_admin][:name]
|
||||
upasswd = gdef[:group_admin][:password]
|
||||
udriver = gdef[:group_admin][:auth_driver]
|
||||
uadmin = gdef[:group_admin][:name]
|
||||
upasswd = gdef[:group_admin][:password]
|
||||
udriver = gdef[:group_admin][:auth_driver]
|
||||
|
||||
if !uadmin.nil? && !upasswd.nil?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user