[DRE-commits] [vagrant-libvirt] 160/163: Improve doc for id_ssh_key_file. Do not prepend ~/.ssh/ if the pathname includes a directory

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:57:19 UTC 2016


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

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

commit e8d1b94ad927b34f0bbe3654b6585b19e51335af
Author: Jim Salem <jsalem at backupify.com>
Date:   Wed Apr 15 14:26:21 2015 -0400

    Improve doc for id_ssh_key_file. Do not prepend ~/.ssh/ if the pathname includes a directory
---
 README.md                     | 2 +-
 lib/vagrant-libvirt/config.rb | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 947b08c..9e9981e 100644
--- a/README.md
+++ b/README.md
@@ -121,7 +121,7 @@ Although it should work without any configuration for most people, this provider
 * `connect_via_ssh` - If use ssh tunnel to connect to Libvirt.
 * `username` - Username and password to access Libvirt.
 * `password` - Password to access Libvirt.
-* `id_ssh_key_file` - The id ssh key file name to access Libvirt (eg: id_dsa or id_rsa or ... in the user .ssh directory)
+* `id_ssh_key_file` - If not nil, uses this ssh private key to access Libvirt. Default is $HOME/.ssh/id_rsa. Prepends $HOME/.ssh/ if no directory.  
 * `socket` - Path to the libvirt unix socket (eg: /var/run/libvirt/libvirt-sock)
 * `uri` - For advanced usage. Directly specifies what libvirt connection URI vagrant-libvirt should use. Overrides all other connection configuration options.
 
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 70c6758..dbf0497 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -245,8 +245,10 @@ module VagrantPlugins
 
         if @id_ssh_key_file
           # set ssh key for access to libvirt host
-          home_dir = `echo ${HOME}`.chomp
-          uri << "\&keyfile=#{home_dir}/.ssh/"+ at id_ssh_key_file
+          uri << "\&keyfile="
+          # if no slash, prepend $HOME/.ssh/
+          uri << "#{`echo ${HOME}`.chomp}/.ssh/" if @id_ssh_key_file !~ /\//
+          uri << @id_ssh_key_file
         end
         # set path to libvirt socket
         uri << "\&socket="+ at socket if @socket

-- 
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