vagrant-multi-putty 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -36,33 +36,41 @@ or convert a private key of your own.
36
36
  4. Answer yes when prompted to save without a password.
37
37
  5. Save the key using the filename of "insecure_private_key.ppk".
38
38
 
39
- Note: If you do not explicity set the config.putty.private_key_path variable,
40
- you need to convert the insecure_private_key and store it with a ".ppk"
41
- extension. The vagrant-multi-putty plugin appends this extension automatically.
39
+ If you do not explicity set the `config.putty.private_key_path`
40
+ variable, you need to convert the insecure_private_key and store it
41
+ with a ".ppk" extension. The vagrant-multi-putty plugin appends this
42
+ extension automatically.
43
+
44
+ As of Vagrant 1.4.0, the `config.ssh.private_key_path` variable is converted into
45
+ an array. This allows multiple SSH keys to be passed to ssh. PuTTY does not
46
+ allow for a list of ssh keys via the command line. Therefore, if the
47
+ `config.putty.private_key_path` variable is not set, we attempt to use the first
48
+ key in the `config.ssh.private_key_path` list and append the '.ppk' extension
49
+ to it.
42
50
 
43
51
  ## Configuration
44
52
  Most of the ssh configuration options used to control vagrant ssh also
45
53
  control vagrant-multi-putty. The following Vagrantfile options are NOT used by
46
54
  vagrant-multi-putty:
47
55
 
48
- * config.ssh.max_tries
49
- * config.ssh.timeout
50
- * config.ssh.private_key_path
51
- * config.ssh.shell
56
+ * `config.ssh.max_tries`
57
+ * `config.ssh.timeout`
58
+ * `config.ssh.private_key_path`
59
+ * `config.ssh.shell`
52
60
 
53
61
  All other config.ssh options should work for vagrant-multi-putty just like they
54
62
  do for vagrant ssh.
55
63
 
56
64
  There are currently a few additional configuration parameters available:
57
65
 
58
- * config.putty.username: Overrides the username set with
59
- config.ssh.username.
60
- * config.putty.private_key_path: Used to explicity set the path to the
66
+ * `config.putty.username`: Overrides the username set with
67
+ ` config.ssh.username`.
68
+ * `config.putty.private_key_path`: Used to explicity set the path to the
61
69
  private key variable.
62
- * config.putty.modal: change vagrant-multi-putty to use modal window mode.
70
+ * `config.putty.modal`: change vagrant-multi-putty to use modal window mode.
63
71
  Execute putty and block the terminal until all putty processes have exited.
64
- Can be set on the command line with -m or --modal. This is false by default.
65
- * config.putty.after_modal: Configure a post hook block that will be called
72
+ Can be set on the command line with `-m` or `--modal`. This is false by default.
73
+ * `config.putty.after_modal`: Configure a post hook block that will be called
66
74
  once all child putty processes have exited and modal mode is enabled. The
67
75
  default block is empty.
68
76
 
@@ -5,7 +5,8 @@ require 'optparse'
5
5
  module VagrantMultiPutty
6
6
  class Command < Vagrant.plugin(2, :command)
7
7
  def execute
8
- options = {:modal => @env.config_global.putty.modal }
8
+ options = {:modal => @env.config_global.putty.modal,
9
+ :plain_auth => false }
9
10
  opts = OptionParser.new do |opts|
10
11
  opts.banner = "Usage: vagrant putty [vm-name...] [-- extra putty args]"
11
12
 
@@ -56,25 +57,27 @@ module VagrantMultiPutty
56
57
  # If ssh_info is nil, the machine is not ready for ssh.
57
58
  raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
58
59
 
59
- # The config.putty directive overrides the config.ssh private_key_path directive.
60
- private_key = vm.config.putty.private_key_path || "#{ssh_info[:private_key_path]}.ppk"
61
- pk_path = File.expand_path("#{private_key}", vm.env.root_path)
62
- @logger.debug("Putty Private Key: #{pk_path}")
63
-
64
60
  # Load options from machine ssh_info.
65
61
  ssh_options = [ssh_info[:host]]
66
62
  # config.putty.username overrides the machines ssh_info username.
67
63
  ssh_options += ["-l", vm.config.putty.username || ssh_info[:username]]
68
64
  ssh_options += ["-P", ssh_info[:port].to_s]
69
- ssh_options += ["-i", pk_path] unless options[:plain_auth]
70
65
  ssh_options += ["-X"] if ssh_info[:forward_x11]
71
66
  ssh_options += ["-A"] if ssh_info[:forward_agent]
72
67
 
68
+ # Putty only allows one ssh key to be passed with the -i option
69
+ # so we default to choosing the first default key if it is not
70
+ # explicitly set.
71
+ private_key = vm.config.putty.private_key_path ||
72
+ ssh_info[:private_key_path][0] + ".ppk"
73
+ @logger.debug("Putty Private Keys: #{private_key.to_s}")
74
+ ssh_options += ["-i", private_key] unless options[:plain_auth]
75
+
73
76
  # Add in additional args from the command line.
74
77
  ssh_options.concat(args) if !args.nil?
75
78
 
76
79
  # Spawn putty and detach it so we can move on.
77
- @logger.debug("Putty cmd line options: #{options.to_s}")
80
+ @logger.debug("Putty cmd line options: #{ssh_options.to_s}")
78
81
  pid = spawn("putty", *ssh_options)
79
82
  @logger.debug("Putty Child Pid: #{pid}")
80
83
  Process.detach(pid)
@@ -1,3 +1,3 @@
1
1
  module VagrantMultiPutty
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-multi-putty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-08 00:00:00.000000000 Z
12
+ date: 2013-12-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Vagrant plugin to allow VM ssh with PuTTY (multi-vm supported)
15
15
  email:
@@ -44,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
44
44
  version: '0'
45
45
  segments:
46
46
  - 0
47
- hash: 3685031145220800060
47
+ hash: -4207126925764807584
48
48
  required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements: