mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-20 13:50:45 +00:00
ovirt authz now passed as a parameter, added to example.conf
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
--ovirtuser test
|
||||
--ovirtpass test
|
||||
--ovirt-url https://test.ac.uk/
|
||||
--ovirtauthz @test.ac.uk-authz
|
||||
--ovirt-cluster test
|
||||
--ovirt-network test
|
||||
@@ -6,9 +6,8 @@ require_relative './print.rb'
|
||||
|
||||
class OVirtFunctions
|
||||
|
||||
# TODO supply this as a parameter/option instead
|
||||
def self.authz
|
||||
'@aet.leedsbeckett.ac.uk-authz'
|
||||
def self.authz(options)
|
||||
options[:ovirtauthz]
|
||||
end
|
||||
|
||||
# @param [Hash] options -- command-line opts
|
||||
@@ -167,7 +166,7 @@ class OVirtFunctions
|
||||
def self.assign_permissions(options, scenario_path, vm_names)
|
||||
ovirt_connection = get_ovirt_connection(options)
|
||||
username = options[:prefix].chomp
|
||||
user = get_user(ovirt_connection, username)
|
||||
user = get_user(options, ovirt_connection, username)
|
||||
if user
|
||||
vms = []
|
||||
|
||||
@@ -208,9 +207,9 @@ class OVirtFunctions
|
||||
|
||||
# @param [String] username
|
||||
# @return [OvirtUser]
|
||||
def self.get_user(ovirt_connection, username)
|
||||
def self.get_user(options, ovirt_connection, username)
|
||||
un = username.chomp
|
||||
search_string = "usrname=#{un}#{authz}"
|
||||
search_string = "usrname=#{un}#{authz(options)}"
|
||||
puts "Searching for VMs owned by #{un}"
|
||||
user = users_service(ovirt_connection).list(search: search_string).first
|
||||
if user
|
||||
|
||||
@@ -406,6 +406,9 @@ opts.each do |opt, arg|
|
||||
when '--ovirt-url'
|
||||
Print.info "Ovirt API url : #{arg}"
|
||||
options[:ovirturl] = arg
|
||||
when '--ovirtauthz'
|
||||
Print.info "Ovirt Authz: #{arg}"
|
||||
options[:ovirtauthz] = arg
|
||||
when '--ovirt-cluster'
|
||||
Print.info "Ovirt Cluster : #{arg}"
|
||||
options[:ovirtcluster] = arg
|
||||
|
||||
Reference in New Issue
Block a user