kitchen-vagrant 0.18.0 → 0.19.0

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: 0217562d1cdfdc41b66c913b4fd79cf11719b457
4
- data.tar.gz: 6d99a767f3dc6154a3b5019c2bc72cf5525acbb1
3
+ metadata.gz: aa2fafbce94824f6ab027a6c789c348f632b1f73
4
+ data.tar.gz: 8c9e54c05057b57e46906e737c7a04c20101ede1
5
5
  SHA512:
6
- metadata.gz: 5fe5750855c7efd561e4643886213a8855d8bbeee9e2755b8bd7fd1c394d60cc677e34dabc403afa14f47b9a93c77d4541dda6fd3b3676b83d9fceaa294ea09d
7
- data.tar.gz: f124d452f8d77fec21cb7f2b9ded0ebde8035dc7e30b324325978ebcb4ca02db1912a0e1888229da2f72c35f8f7b8f52e96e2a936769784ddea720bddd21f8b2
6
+ metadata.gz: 21d53d3e3fa7bb48da1bf39d2af83cffeecea6c2d1fbf444ba188eaeb52650a6db05fdb19b552f3e27b3f2d61a2061c4059919a77fb9a3d30d9077345edee5ae
7
+ data.tar.gz: abacc35c6a871434db004664a72d88547d008ec9f5b9d3154ba404003233bfbf0e812ac4d1ebf82aa0c4f8ae0d35429ba4fabd995ce32e6142167fed6e430f92
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ -fd
@@ -1,3 +1,20 @@
1
+ ## 0.19.0 / 2015-09-18
2
+
3
+ ### Bug fixes
4
+
5
+ * Pull request [#163][]: Properly quote `config[:ssh]` values. ([@zuazo][])
6
+ * Pull request [#191][], pull request [#197][], issue [#190][]: Escape Bundler environment when shelling out to `vagrant` command. ([@ksubrama][], [@tknerr][])
7
+
8
+ ### New features
9
+
10
+ * Pull request 172, issue [#171][]: Add support for OpenStack provider. ([@xmik][])
11
+
12
+ ### Improvements
13
+
14
+ * Pull request [#174][]: Correct grammer error in README. ([@albsOps][])
15
+ * Support running unit test suite on Windows ([@ksubrama][])
16
+
17
+
1
18
  ## 0.18.0 / 2015-05-07
2
19
 
3
20
  ### Bug fixes
@@ -72,7 +89,7 @@
72
89
 
73
90
  ### New features
74
91
 
75
- * Pull request $84: Add support for Parallels provider. ([@jhx][])
92
+ * Pull request [#84][]: Add support for Parallels provider. ([@jhx][])
76
93
  * Pull request [#107][]: Add support for libvirt provider. ([@bradleyd][])
77
94
  * Pull request [#128][]: Add support for LXC provider. ([@tknerr][])
78
95
  * Pull request [#142][]: Add support for managed-servers provider. ([@kbruner][])
@@ -314,12 +331,19 @@ The initial release.
314
331
  [#157]: https://github.com/test-kitchen/kitchen-vagrant/issues/157
315
332
  [#158]: https://github.com/test-kitchen/kitchen-vagrant/issues/158
316
333
  [#161]: https://github.com/test-kitchen/kitchen-vagrant/issues/161
334
+ [#163]: https://github.com/test-kitchen/kitchen-vagrant/issues/163
317
335
  [#166]: https://github.com/test-kitchen/kitchen-vagrant/issues/166
336
+ [#171]: https://github.com/test-kitchen/kitchen-vagrant/issues/171
337
+ [#174]: https://github.com/test-kitchen/kitchen-vagrant/issues/174
338
+ [#190]: https://github.com/test-kitchen/kitchen-vagrant/issues/190
339
+ [#191]: https://github.com/test-kitchen/kitchen-vagrant/issues/191
340
+ [#197]: https://github.com/test-kitchen/kitchen-vagrant/issues/197
318
341
  [@Annih]: https://github.com/Annih
319
342
  [@Igorshp]: https://github.com/Igorshp
320
343
  [@RobertRehberg]: https://github.com/RobertRehberg
321
344
  [@TheDude05]: https://github.com/TheDude05
322
345
  [@albertsj1]: https://github.com/albertsj1
346
+ [@albsOps]: https://github.com/albsOps
323
347
  [@alex-slynko-wonga]: https://github.com/alex-slynko-wonga
324
348
  [@antonio-osorio]: https://github.com/antonio-osorio
325
349
  [@arangamani]: https://github.com/arangamani
@@ -338,6 +362,7 @@ The initial release.
338
362
  [@josephholsten]: https://github.com/josephholsten
339
363
  [@kbruner]: https://github.com/kbruner
340
364
  [@keiths-osc]: https://github.com/keiths-osc
365
+ [@ksubrama]: https://github.com/ksubrama
341
366
  [@manul]: https://github.com/manul
342
367
  [@martinisoft]: https://github.com/martinisoft
343
368
  [@mattray]: https://github.com/mattray
@@ -352,3 +377,5 @@ The initial release.
352
377
  [@tmatilai]: https://github.com/tmatilai
353
378
  [@vinyar]: https://github.com/vinyar
354
379
  [@whiteley]: https://github.com/whiteley
380
+ [@xmik]: https://github.com/xmik
381
+ [@zuazo]: https://github.com/zuazo
data/README.md CHANGED
@@ -129,7 +129,7 @@ Many host wide defaults for Vagrant can be set using `$HOME/.vagrant.d/Vagrantfi
129
129
  details, please read the Vagrant [machine settings][vagrant_machine_settings]
130
130
  page.
131
131
 
132
- The default will be computed from the platform name of the instance. Howver, for a small number of common/known platforms in the [Bento][bento] project, the default will prepend `"opscode-"` to the start to match the downloadable `box_url` (see below).
132
+ The default will be computed from the platform name of the instance. However, for a small number of common/known platforms in the [Bento][bento] project, the default will prepend `"opscode-"` to the start to match the downloadable `box_url` (see below).
133
133
 
134
134
  For example, a platform with a Bento box called "ubuntu-14.04" will produce a
135
135
  default `box` value of `"opscode-ubuntu-14.04"`. Alternatively, a box called
@@ -310,11 +310,36 @@ module Kitchen
310
310
  # * `:log_subject` defaults to a String representation of the Driver's
311
311
  # class name
312
312
  #
313
+ # Since vagrant does not support being run through bundler, we escape
314
+ # any bundler environment should we detect one. Otherwise, subcommands
315
+ # will inherit our bundled environment.
316
+ # @see https://github.com/test-kitchen/kitchen-vagrant/issues/190
313
317
  # @see Kitchen::ShellOut#run_command
314
318
  def run_command(cmd, options = {})
315
319
  merged = {
316
- :use_sudo => config[:use_sudo], :log_subject => name
320
+ :use_sudo => config[:use_sudo],
321
+ :log_subject => name,
322
+ :environment => {}
317
323
  }.merge(options)
324
+
325
+ # Attempt to extract bundler and associated GEM related values.
326
+ # TODO: To this accurately, we'd need to create a test-kitchen
327
+ # launch wrapper that serializes the existing environment before
328
+ # bundler touches it so that we can go back to it. Since that is
329
+ # "A Hard Problem"(TM), we simply blow away all known bundler
330
+ # related changes.
331
+ env = merged[:environment]
332
+ %w[BUNDLE_BIN_PATH BUNDLE_GEMFILE GEM_HOME GEM_PATH GEM_ROOT RUBYLIB
333
+ RUBYOPT _ORIGINAL_GEM_PATH].each do |var|
334
+ env[var] = nil
335
+ end
336
+ gem_home = ENV["GEM_HOME"]
337
+ if gem_home && (env["PATH"] || ENV["PATH"])
338
+ env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
339
+ gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
340
+ env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)
341
+ end
342
+
318
343
  super(cmd, merged)
319
344
  end
320
345
 
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "0.18.0"
24
+ VAGRANT_VERSION = "0.19.0"
25
25
  end
26
26
  end
@@ -61,7 +61,17 @@ describe Kitchen::Driver::Vagrant do
61
61
  )
62
62
  end
63
63
 
64
- before { stub_const("ENV", env) }
64
+ module RunCommandStub
65
+ def run_command(_cmd, options = {})
66
+ options
67
+ end
68
+ end
69
+
70
+ before(:all) do
71
+ Kitchen::Driver::Vagrant.instance_eval { include RunCommandStub }
72
+ end
73
+
74
+ before(:each) { stub_const("ENV", env) }
65
75
 
66
76
  after do
67
77
  driver_object.class.send(:winrm_plugin_passed=, nil)
@@ -77,6 +87,64 @@ describe Kitchen::Driver::Vagrant do
77
87
  Kitchen::Driver::VAGRANT_VERSION)
78
88
  end
79
89
 
90
+ describe "#run_command" do
91
+
92
+ context "when invoked from a clean environment" do
93
+
94
+ it "passes through environment variables" do
95
+ options = driver.send(
96
+ :run_command,
97
+ "cmd",
98
+ :environment => { "EV1" => "Val1", "EV2" => "Val2" })
99
+ expect(options[:environment]["EV1"]).to eq("Val1")
100
+ expect(options[:environment]["EV2"]).to eq("Val2")
101
+ end
102
+
103
+ it "leaves path alone" do
104
+ path = "/foo/#{File::PATH_SEPARATOR}/bar"
105
+ options = driver.send(
106
+ :run_command,
107
+ "cmd",
108
+ :environment => { "PATH" => path })
109
+ expect(options[:environment]["PATH"]).to eq(path)
110
+ end
111
+
112
+ end
113
+
114
+ context "when invoked from a bundler[:environment]" do
115
+
116
+ let(:bundler_env) do
117
+ {
118
+ "BUNDLE_BIN_PATH" => "bundle_bin_path",
119
+ "BUNDLE_GEMFILE" => "bundle_gem_file",
120
+ "GEM_HOME" => "gem_home",
121
+ "GEM_PATH" => "gem_path",
122
+ "GEM_ROOT" => "gem_root",
123
+ "RUBYLIB" => "ruby_lib",
124
+ "RUBYOPT" => "ruby_opt",
125
+ "_ORIGINAL_GEM_PATH" => "original_gem_path"
126
+ }
127
+ end
128
+
129
+ it "removes all bundler related variables" do
130
+ env.merge!(bundler_env)
131
+ options = driver.send(:run_command, "cmd")
132
+ bundler_env.each do |k, _v|
133
+ expect(options[:environment]).to include(k)
134
+ expect(options[:environment][k]).to eq(nil)
135
+ end
136
+ end
137
+
138
+ it "fixes path if it notices gem_home in it" do
139
+ env.merge!(bundler_env)
140
+ env["PATH"] = "gem_home/bin#{File::PATH_SEPARATOR}/something/else"
141
+ options = driver.send(:run_command, "cmd")
142
+ puts(options)
143
+ expect(options[:environment]["PATH"]).to eq("/something/else")
144
+ end
145
+ end
146
+ end
147
+
80
148
  describe "configuration" do
81
149
 
82
150
  %W[centos debian fedora opensuse ubuntu].each do |name|
@@ -252,7 +320,7 @@ describe Kitchen::Driver::Vagrant do
252
320
  ]
253
321
 
254
322
  expect(driver[:synced_folders]).to eq([
255
- ["/host_path", "/vm_path", "create: true, type: :nfs"]
323
+ [File.expand_path("/host_path"), "/vm_path", "create: true, type: :nfs"]
256
324
  ])
257
325
  end
258
326
 
@@ -262,7 +330,7 @@ describe Kitchen::Driver::Vagrant do
262
330
  ]
263
331
 
264
332
  expect(driver[:synced_folders]).to eq([
265
- ["/root/suitey-fooos-99", "/vm_path", "stuff"]
333
+ [File.expand_path("/root/suitey-fooos-99"), "/vm_path", "stuff"]
266
334
  ])
267
335
  end
268
336
 
@@ -272,7 +340,7 @@ describe Kitchen::Driver::Vagrant do
272
340
  ]
273
341
 
274
342
  expect(driver[:synced_folders]).to eq([
275
- ["/kroot/a", "/vm_path", "stuff"]
343
+ [File.expand_path("/kroot/a"), "/vm_path", "stuff"]
276
344
  ])
277
345
  end
278
346
 
@@ -282,7 +350,7 @@ describe Kitchen::Driver::Vagrant do
282
350
  ]
283
351
 
284
352
  expect(driver[:synced_folders]).to eq([
285
- ["/host_path", "/vm_path", "nil"]
353
+ [File.expand_path("/host_path"), "/vm_path", "nil"]
286
354
  ])
287
355
  end
288
356
 
@@ -295,13 +363,15 @@ describe Kitchen::Driver::Vagrant do
295
363
  it "sets :vagrantfile_erb to a default value" do
296
364
  config[:vagrantfile_erb] = "/a/Vagrantfile.erb"
297
365
 
298
- expect(driver[:vagrantfile_erb]).to eq("/a/Vagrantfile.erb")
366
+ expect(driver[:vagrantfile_erb]).to eq(
367
+ File.expand_path("/a/Vagrantfile.erb"))
299
368
  end
300
369
 
301
370
  it "expands path for :vagrantfile_erb" do
302
371
  config[:vagrantfile_erb] = "Yep.erb"
303
372
 
304
- expect(driver[:vagrantfile_erb]).to eq("/kroot/Yep.erb")
373
+ expect(driver[:vagrantfile_erb]).to eq(
374
+ File.expand_path("/kroot/Yep.erb"))
305
375
  end
306
376
 
307
377
  it "sets :vagrantfiles to an empty array by default" do
@@ -312,7 +382,7 @@ describe Kitchen::Driver::Vagrant do
312
382
  config[:vagrantfiles] = %W[one two three]
313
383
 
314
384
  expect(driver[:vagrantfiles]).to eq(
315
- %W[/kroot/one /kroot/two /kroot/three]
385
+ %W[/kroot/one /kroot/two /kroot/three].map { |f| File.expand_path(f) }
316
386
  )
317
387
  end
318
388
 
@@ -972,9 +1042,9 @@ describe Kitchen::Driver::Vagrant do
972
1042
 
973
1043
  it "adds a vm.ssh line for each key/value pair in :ssh" do
974
1044
  config[:ssh] = {
975
- :username => %{"jdoe"},
976
- :password => %{"secret"},
977
- :private_key_path => %{"/key"}
1045
+ :username => %{jdoe},
1046
+ :password => %{secret},
1047
+ :private_key_path => %{/key}
978
1048
  }
979
1049
  cmd
980
1050
 
@@ -1365,6 +1435,28 @@ describe Kitchen::Driver::Vagrant do
1365
1435
  RUBY
1366
1436
  end
1367
1437
  end
1438
+
1439
+ context "for openstack provider" do
1440
+
1441
+ before { config[:provider] = "openstack" }
1442
+
1443
+ it "adds a line for each element in :customize" do
1444
+ config[:customize] = {
1445
+ :key1 => "some string value",
1446
+ :key2 => 22,
1447
+ :key3 => false
1448
+ }
1449
+ cmd
1450
+
1451
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1452
+ c.vm.provider :openstack do |p|
1453
+ p.key1 = "some string value"
1454
+ p.key2 = 22
1455
+ p.key3 = false
1456
+ end
1457
+ RUBY
1458
+ end
1459
+ end
1368
1460
  end
1369
1461
 
1370
1462
  def debug_lines
@@ -50,7 +50,7 @@ Vagrant.configure("2") do |c|
50
50
  c.ssh.private_key_path = "<%= config[:ssh_key] %>"
51
51
  <% end %>
52
52
  <% config[:ssh].each do |key, value| %>
53
- c.ssh.<%= key %> = <%= value %>
53
+ c.ssh.<%= key %> = "<%= value %>"
54
54
  <% end %>
55
55
  <% if config[:winrm] %>
56
56
  <% config[:winrm].each do |key, value| %>
@@ -118,6 +118,12 @@ Vagrant.configure("2") do |c|
118
118
  <% else %>
119
119
  p.vmx["<%= key %>"] = "<%= value %>"
120
120
  <% end %>
121
+ <% when "openstack" %>
122
+ <% if value.is_a? String %>
123
+ p.<%= key %> = "<%= value%>"
124
+ <% else %>
125
+ p.<%= key %> = <%= value%>
126
+ <% end %>
121
127
  <% end %>
122
128
  <% end %>
123
129
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-07 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
+ - ".rspec"
119
120
  - ".travis.yml"
120
121
  - CHANGELOG.md
121
122
  - Gemfile
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  version: '0'
150
151
  requirements: []
151
152
  rubyforge_project:
152
- rubygems_version: 2.4.5
153
+ rubygems_version: 2.4.5.1
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: Kitchen::Driver::Vagrant - A Vagrant Driver for Test Kitchen.