[DRE-commits] [vagrant-libvirt] 08/67: add default network and ssk key file parameters

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:56:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.14
in repository vagrant-libvirt.

commit 6492e0ae6340712194ae29aa5fef7fea2b0645b8
Author: Mathilde Ffrench <ffrench.mathilde at gmail.com>
Date:   Tue Nov 19 19:22:11 2013 +0100

    add default network and ssk key file parameters
---
 lib/vagrant-libvirt/action/connect_libvirt.rb           |  9 ++++++---
 lib/vagrant-libvirt/action/create_network_interfaces.rb |  5 +++--
 lib/vagrant-libvirt/config.rb                           | 10 ++++++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/vagrant-libvirt/action/connect_libvirt.rb b/lib/vagrant-libvirt/action/connect_libvirt.rb
index 1f089de..20f2cbc 100644
--- a/lib/vagrant-libvirt/action/connect_libvirt.rb
+++ b/lib/vagrant-libvirt/action/connect_libvirt.rb
@@ -53,9 +53,12 @@ module VagrantPlugins
 
           uri << virt_path
           uri << '?no_verify=1'
-          # set ssh key for access to libvirt host
-          home_dir = `echo ${HOME}`.chomp
-          uri << "&keyfile=#{home_dir}/.ssh/id_rsa"
+
+          if config.id_ssh_key_file
+            # set ssh key for access to libvirt host
+            home_dir = `echo ${HOME}`.chomp
+            uri << "&keyfile=#{home_dir}/.ssh/"+config.id_ssh_key_file
+          end
 
           conn_attr = {}
           conn_attr[:provider] = 'libvirt'
diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb
index cae02cf..d74ea20 100644
--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb
+++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb
@@ -16,6 +16,7 @@ module VagrantPlugins
 
         def initialize(app, env)
           @logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
+          @default_network = env[:machine].provider_config.default_network;
           @app = app
         end
 
@@ -58,7 +59,7 @@ module VagrantPlugins
             # We have slot for interface, fill it with interface configuration.
             adapters[free_slot] = options
             adapters[free_slot][:network_name] = interface_network(
-              env[:libvirt_compute].client, adapters[free_slot])
+              env[:libvirt_compute].client, adapters[free_slot], )
           end
 
           # Create each interface as new domain device.
@@ -151,7 +152,7 @@ module VagrantPlugins
           end
 
           # TODO Network default can be missing or named different.
-          return 'default'
+          return @default_network;
         end
       end
     end
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 166c833..71e426d 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -18,10 +18,16 @@ module VagrantPlugins
       # Password for Libvirt connection.
       attr_accessor :password
 
+      # ID SSH key file
+      attr_accessor :id_ssh_key_file
+
       # Libvirt storage pool name, where box image and instance snapshots will
       # be stored.
       attr_accessor :storage_pool_name
 
+      # Libvirt default network
+      attr_accessor :default_network
+
       # Domain specific settings used while creating new domain.
       attr_accessor :memory
       attr_accessor :cpus
@@ -34,7 +40,9 @@ module VagrantPlugins
         @connect_via_ssh   = UNSET_VALUE
         @username          = UNSET_VALUE
         @password          = UNSET_VALUE
+        @id_ssh_key_file   = UNSET_VALUE
         @storage_pool_name = UNSET_VALUE
+        @default_network   = UNSET_VALUE
 
         # Domain specific settings.
         @memory            = UNSET_VALUE
@@ -49,7 +57,9 @@ module VagrantPlugins
         @connect_via_ssh = false if @connect_via_ssh == UNSET_VALUE
         @username = nil if @username == UNSET_VALUE
         @password = nil if @password == UNSET_VALUE
+        @id_ssh_key_file = nil if @id_ssh_key_file == UNSET_VALUE
         @storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
+        @default_network = 'default' if @default_network == UNSET_VALUE
 
         # Domain specific settings.
         @memory = 512 if @memory == UNSET_VALUE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list