Skip to content

Commit

Permalink
[ovirt] add support for ca cert
Browse files Browse the repository at this point in the history
  • Loading branch information
abenari committed Mar 5, 2014
1 parent 3926539 commit ae7ddde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 12 additions & 3 deletions lib/fog/ovirt/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module Compute
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
Expand Down Expand Up @@ -107,9 +108,17 @@ def initialize(options={})
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
Expand Down
3 changes: 2 additions & 1 deletion tests/ovirt/compute_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
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
Expand Down

0 comments on commit ae7ddde

Please sign in to comment.