mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
added openauth support thanks to @rubiojr
This commit is contained in:
parent
695090a6b7
commit
39ac0365c1
1 changed files with 13 additions and 1 deletions
|
@ -41,7 +41,19 @@ module Fog
|
||||||
require 'libvirt'
|
require 'libvirt'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if options[:libvirt_user] and options[:libvirt_password]
|
||||||
|
@connection = ::Libvirt::open_auth(@uri.uri, [::Libvirt::CRED_AUTHNAME, ::Libvirt::CRED_PASSPHRASE]) do |cred|
|
||||||
|
if cred['type'] == ::Libvirt::CRED_AUTHNAME
|
||||||
|
res = options[:libvirt_user]
|
||||||
|
elsif cred["type"] == ::Libvirt::CRED_PASSPHRASE
|
||||||
|
res = options[:libvirt_password]
|
||||||
|
else
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
@connection = ::Libvirt::open(@uri.uri)
|
@connection = ::Libvirt::open(@uri.uri)
|
||||||
|
end
|
||||||
|
|
||||||
rescue ::Libvirt::ConnectionError
|
rescue ::Libvirt::ConnectionError
|
||||||
raise Fog::Errors::Error.new("Error making a connection to libvirt URI #{@uri.uri}:\n#{$!}")
|
raise Fog::Errors::Error.new("Error making a connection to libvirt URI #{@uri.uri}:\n#{$!}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue