close #43 key file set in provider url

This commit is contained in:
dima 2013-08-15 02:01:08 +02:00
parent 5fd30fe1f4
commit ba235915b3
4 changed files with 12 additions and 7 deletions

View File

@ -6,7 +6,7 @@ module VagrantPlugins
module Action
class ConnectLibvirt
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::connect_libvirt")
@logger = Log4r::Logger.new('vagrant_libvirt::action::connect_libvirt')
@app = app
end
@ -39,7 +39,11 @@ module VagrantPlugins
uri << '://'
uri << config.host if config.host
end
uri << '/system?no_verify=1'
# set ssh key for access to libvirt host
home_dir = `echo ${HOME}`.chomp
uri << "&keyfile=#{home_dir}/.ssh/id_rsa"
conn_attr = {}
conn_attr[:provider] = 'libvirt'

View File

@ -12,8 +12,8 @@ module VagrantPlugins
end
def call(env)
env[:machine_ssh_info] = read_ssh_info(
env[:libvirt_compute], env[:machine])
env[:machine_ssh_info] = read_ssh_info(env[:libvirt_compute],
env[:machine])
@app.call(env)
end
@ -34,6 +34,7 @@ module VagrantPlugins
ip_address = nil
domain.wait_for(2) {
addresses.each_pair do |type, ip|
puts ip
ip_address = ip[0] if ip[0] != nil
end
ip_address != nil
@ -53,7 +54,7 @@ module VagrantPlugins
end
ssh_info
end
end
end
end
end

View File

@ -45,7 +45,7 @@ module VagrantPlugins
# :username => "mitchellh",
# :private_key_path => "/path/to/my/key"
#}
env = @machine.action("read_ssh_info")
env = @machine.action('read_ssh_info')
env[:machine_ssh_info]
end
@ -55,7 +55,7 @@ module VagrantPlugins
# Run a custom action we define called "read_state" which does
# what it says. It puts the state in the `:machine_state_id`
# key in the environment.
env = @machine.action("read_state")
env = @machine.action('read_state')
state_id = env[:machine_state_id]

View File

@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = VagrantPlugins::ProviderLibvirt::VERSION
gem.add_runtime_dependency "fog", "~> 1.10.0"
gem.add_runtime_dependency "fog", "1.10.0"
gem.add_runtime_dependency "ruby-libvirt", "~> 0.4.0"
gem.add_development_dependency "rake"