Guest User

Untitled

a guest
Jan 24th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. diff --git a/lib/fog/compute/libvirt.rb b/lib/fog/compute/libvirt.rb
  2. index 323c362..930be4f 100644
  3. --- a/lib/fog/compute/libvirt.rb
  4. +++ b/lib/fog/compute/libvirt.rb
  5. @@ -41,7 +41,18 @@ module Fog
  6. require 'libvirt'
  7.  
  8. begin
  9. - @connection = ::Libvirt::open(@uri.uri)
  10. + if options[:user] and options[:password]
  11. + @connection = ::Libvirt::open_auth(@uri.uri, [::Libvirt::CRED_AUTHNAME, ::Libvirt::CRED_PASSPHRASE]) do |cred|
  12. + if cred['type'] == ::Libvirt::CRED_AUTHNAME
  13. + res = options[:user]
  14. + elsif cred["type"] == ::Libvirt::CRED_PASSPHRASE
  15. + res = options[:password]
  16. + else
  17. + end
  18. + end
  19. + else
  20. + @connection = ::Libvirt::open(@uri.uri)
  21. + end
  22. rescue ::Libvirt::ConnectionError
  23. raise Fog::Errors::Error.new("Error making a connection to libvirt URI #{@uri.uri}:\n#{$!}")
  24. end
Add Comment
Please, Sign In to add comment