ovirt authz now passed as a parameter, added to example.conf

This commit is contained in:
ts
2018-10-05 17:26:09 +01:00
parent a99195f889
commit 7bbeb8a2fa
3 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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