[ovirt] add support for ca cert

This commit is contained in:
Amos Benari 2014-03-05 15:05:32 +02:00
parent 3926539680
commit ae7ddde584
2 changed files with 14 additions and 4 deletions

View File

@ -5,7 +5,8 @@ module Fog
class Ovirt < Fog::Service
requires :ovirt_username, :ovirt_password
recognizes :ovirt_url, :ovirt_server, :ovirt_port, :ovirt_api_path, :ovirt_datacenter
recognizes :ovirt_url, :ovirt_server, :ovirt_port, :ovirt_api_path, :ovirt_datacenter,
:ovirt_ca_cert_store, :ovirt_ca_cert_file
model_path 'fog/ovirt/models/compute'
model :server
@ -107,9 +108,17 @@ module Fog
port = options[:ovirt_port] || 8080
api_path = options[:ovirt_api_path] || '/api'
url = options[:ovirt_url] || "#{@scheme}://#{server}:#{port}#{api_path}"
datacenter = options[:ovirt_datacenter]
@client = OVIRT::Client.new(username, password, url, datacenter)
connection_opts = {}
connection_opts[:datacenter_id] = options[:ovirt_datacenter]
connection_opts[:ca_cert_store] = options[:ovirt_ca_cert_store]
connection_opts[:ca_cert_file] = options[:ovirt_ca_cert_file]
@client = OVIRT::Client.new(username, password, url, connection_opts)
end
def api_version
client.api_version
end
private

View File

@ -17,7 +17,8 @@ Shindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do
tests("Compute requests") do
%w{ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
get_virtual_machine list_clusters list_networks list_template_interfaces list_templates
list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action }.each do |collection|
list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action
api_version}.each do |collection|
test("it should respond to #{collection}") { compute.respond_to? collection }
end
end