knife-vagrant2 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ee941f5425873c296f1813ea350eee29f1c1320
4
- data.tar.gz: c7254238b04f65993b8fb7de035b0d581ff62c5d
3
+ metadata.gz: b31adf4a18a201fde7677235f3655c3378f5b59f
4
+ data.tar.gz: 10407edf414831de9ff1f154180843da97e3f318
5
5
  SHA512:
6
- metadata.gz: 21875e807264aaeaaeebd2577c3ef99b2ff921b865be5e341dc988f2f7488d37a2bfb505b9d48807a6f6dd0baca3b0e79cf7b222a2a1bc7ccb966de9f8838d99
7
- data.tar.gz: 4508b2332c2c063871df1b3ddd376b61883ef495f7ca311868d0680ce5ac233002513f2f3e8e06e31280f82fd4a331a6402e4041f1ba97b5ea783bc84c517c8c
6
+ metadata.gz: 9799ac9ba92cba75333505371e098f025d23cd3c23fca728bcec22fe34365c1e931c4690225a3162ef4fc6df165b4069e495aa883c2ea260c8907479c8e543b9
7
+ data.tar.gz: 52fd676f4a6a913d554b58bb12da2060eb6daef91f9d170f4ed2a26cfb8b556749e5eff0086fb88de96be436a8c1456492335090096d38876d4cd3c47c39e1ac
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ Icon?
7
7
  *.gem
8
8
  Gemfile.lock
9
9
 
10
+ .idea
@@ -1,3 +1,15 @@
1
+ # 0.0.6 (2014-12-30)
2
+
3
+ ## Changes and new features
4
+
5
+ * Support for the new, random SSH keys in Vagrant 1.7
6
+
7
+
8
+ ## Fixes
9
+
10
+ * Make --vmx-customize option actually work
11
+
12
+
1
13
  # 0.0.5 (2014-12-11)
2
14
 
3
15
  ## Changes and new features
@@ -49,3 +61,4 @@
49
61
  * [Robert J. Berger](https://github.com/rberger)
50
62
  * [xsunsmile](https://github.com/xsunsmile)
51
63
  * [Mevan Samaratunga](https://github.com/mevansam)
64
+ * [Joshua Kruck](https://github.com/krujos)
@@ -93,6 +93,17 @@ class Chef
93
93
  @vagrant_instances
94
94
  end
95
95
 
96
+ def vagrant_version
97
+ @vagrant_version ||= begin
98
+ version = vagrant_exec('', '-v', { :no_cwd_change => true, :fetch_output => true })
99
+ version = /Vagrant\s+([0-9\.]+)/.match(version) { |m| m[1] }
100
+ end
101
+ end
102
+
103
+ def vagrant_version_cmp(version)
104
+ Gem::Version.new(vagrant_version) <=> Gem::Version.new(version)
105
+ end
106
+
96
107
  def write_insecure_key
97
108
  # The private key most vagrant boxes use.
98
109
  insecure_key = <<-EOF
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife/vagrant_base'
2
+ require 'find'
2
3
 
3
4
  class Chef
4
5
  class Knife
@@ -191,7 +192,6 @@ class Chef
191
192
  cmd = "up --provider #{locate_config_value(:provider)}"
192
193
  vagrant_exec(@server.name, cmd)
193
194
 
194
- write_insecure_key
195
195
  print "\n#{ui.color("Waiting for sshd", :magenta)}"
196
196
  wait_for_sshd(@server.ip_address)
197
197
 
@@ -217,7 +217,7 @@ class Chef
217
217
  end
218
218
 
219
219
  def build_vmx_customize(customize)
220
- customize.split(/::/).collect { |k| "v.vmx [ #{k} ]" }.join("\n") if customize
220
+ customize.split(/::/).collect { |k| "v.vmx[#{k.split('=')[0]}] = #{k.split('=')[1]}" }.join("\n") if customize
221
221
  end
222
222
 
223
223
  def build_shares(share_folders)
@@ -235,6 +235,9 @@ class Chef
235
235
  if @server.vagrant_config
236
236
  additions << @server.vagrant_config.split(/::/)
237
237
  end
238
+ unless config[:identity_file].nil?
239
+ additions << 'config.ssh.private_key_path = "' + config[:identity_file] + '"'
240
+ end
238
241
 
239
242
  file = <<-EOF
240
243
  Vagrant.configure("2") do |config|
@@ -281,8 +284,27 @@ end
281
284
  bootstrap.config[:ssh_user] = config[:ssh_user]
282
285
  bootstrap.config[:ssh_port] = config[:ssh_port]
283
286
  bootstrap.config[:ssh_gateway] = config[:ssh_gateway]
284
- bootstrap.config[:identity_file] = config[:identity_file] || File.join(locate_config_value(:vagrant_dir), 'insecure_key')
285
287
  bootstrap.config[:chef_node_name] = locate_config_value(:chef_node_name) || server.ip
288
+
289
+ # Starting from version 1.7 Vagrant replaces the fixed insecure key with a new,
290
+ # random one the first time it is brought up. If that's the case we need to use
291
+ # it to bootstrap.
292
+ msg_pair("Vagrant version", vagrant_version)
293
+ if config[:identity_file]
294
+ bootstrap.config[:identity_file] = config[:identity_file]
295
+ elsif vagrant_version_cmp('1.7') < 0
296
+ write_insecure_key
297
+ bootstrap.config[:identity_file] = File.join(locate_config_value(:vagrant_dir), 'insecure_key')
298
+ else
299
+ # Vagrant puts the private key under the provider (i.e. 'virtualbox') so we search for it
300
+ path = File.join(locate_config_value(:vagrant_dir), server.name, '.vagrant/')
301
+ Find.find(path) do |f|
302
+ if File.basename(f) == 'private_key'
303
+ bootstrap.config[:identity_file] = f
304
+ end
305
+ end
306
+ end
307
+
286
308
  bootstrap.config[:distro] = locate_config_value(:distro) || "chef-full"
287
309
  bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'
288
310
  bootstrap.config[:host_key_verify] = config[:host_key_verify]
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Vagrant
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vagrant2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Kern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef