kitchen-puppet 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,7 @@
20
20
  # for documentation configuration parameters with puppet_apply provisioner.
21
21
  #
22
22
 
23
+ require 'json'
23
24
  require 'kitchen/provisioner/base'
24
25
  require 'kitchen/provisioner/puppet/librarian'
25
26
 
@@ -75,6 +76,14 @@ module Kitchen
75
76
  provisioner.calculate_path('Puppetfile', :file)
76
77
  end
77
78
 
79
+ default_config :modulefile_path do |provisioner|
80
+ provisioner.calculate_path('Modulefile', :file)
81
+ end
82
+
83
+ default_config :metadata_json_path do |provisioner|
84
+ provisioner.calculate_path('metadata.json', :file)
85
+ end
86
+
78
87
  default_config :puppet_debug, false
79
88
  default_config :puppet_verbose, false
80
89
  default_config :puppet_noop, false
@@ -104,9 +113,11 @@ module Kitchen
104
113
  ""
105
114
  end
106
115
  <<-INSTALL
116
+ #{Util.shell_helpers}
117
+
107
118
  if [ ! -d "#{config[:puppet_omnibus_remote_path]}" ]; then
108
119
  echo "-----> Installing Puppet Omnibus"
109
- curl -o /tmp/puppet_install.sh #{config[:puppet_omnibus_url]}
120
+ do_download #{config[:puppet_omnibus_url]} /tmp/puppet_install.sh
110
121
  #{sudo('sh')} /tmp/puppet_install.sh #{version}
111
122
  fi
112
123
  #{install_busser}
@@ -157,6 +168,7 @@ module Kitchen
157
168
 
158
169
  def install_busser
159
170
  <<-INSTALL
171
+ #{Util.shell_helpers}
160
172
  # install chef omnibus so that busser works as this is needed to run tests :(
161
173
  # TODO: work out how to install enough ruby
162
174
  # and set busser: { :ruby_bindir => '/usr/bin/ruby' } so that we dont need the
@@ -164,7 +176,7 @@ module Kitchen
164
176
  if [ ! -d "/opt/chef" ]
165
177
  then
166
178
  echo "-----> Installing Chef Omnibus to install busser to run tests"
167
- curl -o /tmp/install.sh #{chef_url}
179
+ do_download #{chef_url} /tmp/install.sh
168
180
  #{sudo('sh')} /tmp/install.sh
169
181
  fi
170
182
  INSTALL
@@ -274,6 +286,14 @@ module Kitchen
274
286
  config[:puppetfile_path] or ''
275
287
  end
276
288
 
289
+ def modulefile
290
+ config[:modulefile_path] or ''
291
+ end
292
+
293
+ def metadata_json
294
+ config[:metadata_json_path] or ''
295
+ end
296
+
277
297
  def manifest
278
298
  config[:manifest]
279
299
  end
@@ -385,12 +405,34 @@ module Kitchen
385
405
  if File.exists?(puppetfile)
386
406
  resolve_with_librarian
387
407
  end
408
+
388
409
  debug("Using modules from #{modules}")
389
410
 
390
411
  tmp_modules_dir = File.join(sandbox_path, 'modules')
391
412
  FileUtils.mkdir_p(tmp_modules_dir)
392
413
  FileUtils.cp_r(Dir.glob("#{modules}/*"), tmp_modules_dir,
393
414
  :remove_destination => true)
415
+
416
+ if File.exists?(modulefile)
417
+ warn("Modulefile found but this is depricated, ignoring it, see https://tickets.puppetlabs.com/browse/PUP-1188")
418
+ end
419
+
420
+ if File.exists?(metadata_json)
421
+ module_name = nil
422
+ begin
423
+ module_name = JSON.parse( IO.read(metadata_json) )['name'].split("/").last
424
+ rescue
425
+ error("not able to load or parse #{metadata_json_path} for the name of the module")
426
+ end
427
+
428
+ if module_name
429
+ module_target_path = File.join(tmp_modules_dir,module_name)
430
+ FileUtils.mkdir_p(module_target_path)
431
+ FileUtils.cp_r(Dir.glob("*").reject{|entry| entry =~ /modules/}, module_target_path,
432
+ :remove_destination => true)
433
+
434
+ end
435
+ end
394
436
  end
395
437
 
396
438
  def prepare_hiera_config
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Puppet
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
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: 2014-05-14 00:00:00.000000000 Z
12
+ date: 2014-05-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! '== DESCRIPTION:
15
15