kitchen-puppet 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Puppet
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -55,6 +55,10 @@ module Kitchen
55
55
  raise 'No modules_path detected. Please specify one in .kitchen.yml'
56
56
  end
57
57
 
58
+ default_config :files_path do |provisioner|
59
+ provisioner.calculate_path('files')
60
+ end
61
+
58
62
  default_config :hiera_data_path do |provisioner|
59
63
  provisioner.calculate_path('hiera')
60
64
  end
@@ -63,6 +67,10 @@ module Kitchen
63
67
  provisioner.calculate_path('hiera.yaml', :file)
64
68
  end
65
69
 
70
+ default_config :fileserver_config_path do |provisioner|
71
+ provisioner.calculate_path('fileserver.conf', :file)
72
+ end
73
+
66
74
  default_config :puppetfile_path do |provisioner|
67
75
  provisioner.calculate_path('Puppetfile', :file)
68
76
  end
@@ -163,9 +171,9 @@ module Kitchen
163
171
  end
164
172
 
165
173
  def init_command
166
- dirs = %w{modules manifests hiera hiera.yaml}.
174
+ dirs = %w{modules manifests files hiera hiera.yaml}.
167
175
  map { |dir| File.join(config[:root_path], dir) }.join(" ")
168
- cmd = "#{sudo('rm')} -rf #{dirs} #{hiera_data_remote_path} /etc/hiera.yaml /etc/puppet/hiera.yaml;"
176
+ cmd = "#{sudo('rm')} -rf #{dirs} #{hiera_data_remote_path} /etc/hiera.yaml /etc/puppet/hiera.yaml /etc/puppet/fileserver.conf;"
169
177
  cmd = cmd+" mkdir -p #{config[:root_path]}"
170
178
  debug(cmd)
171
179
  cmd
@@ -179,7 +187,9 @@ module Kitchen
179
187
 
180
188
  prepare_modules
181
189
  prepare_manifests
190
+ prepare_files
182
191
  prepare_hiera_config
192
+ prepare_fileserver_config
183
193
  prepare_hiera_data
184
194
  info('Finished Preparing files for transfer')
185
195
 
@@ -204,6 +214,14 @@ module Kitchen
204
214
  ].join(' ')
205
215
  end
206
216
 
217
+ if fileserver_config
218
+ commands << [
219
+ sudo('cp'),
220
+ File.join(config[:root_path], 'fileserver.conf'),
221
+ '/etc/puppet',
222
+ ].join(' ')
223
+ end
224
+
207
225
  if hiera_data and hiera_data_remote_path == '/var/lib/hiera'
208
226
  commands << [
209
227
  sudo('cp -r'), File.join(config[:root_path], 'hiera'), '/var/lib/'
@@ -232,6 +250,7 @@ module Kitchen
232
250
  File.join(config[:root_path], 'manifests', manifest),
233
251
  "--modulepath=#{File.join(config[:root_path], 'modules')}",
234
252
  "--manifestdir=#{File.join(config[:root_path], 'manifests')}",
253
+ "--fileserverconfig=#{File.join(config[:root_path], 'fileserver.conf')}",
235
254
  puppet_noop_flag,
236
255
  puppet_verbose_flag,
237
256
  puppet_debug_flag,
@@ -267,10 +286,18 @@ module Kitchen
267
286
  config[:modules_path]
268
287
  end
269
288
 
289
+ def files
290
+ config[:files_path]
291
+ end
292
+
270
293
  def hiera_config
271
294
  config[:hiera_config_path]
272
295
  end
273
296
 
297
+ def fileserver_config
298
+ config[:fileserver_config_path]
299
+ end
300
+
274
301
  def hiera_data
275
302
  config[:hiera_data_path]
276
303
  end
@@ -344,6 +371,15 @@ module Kitchen
344
371
  FileUtils.cp_r(Dir.glob("#{manifests}/*"), tmp_manifests_dir)
345
372
  end
346
373
 
374
+ def prepare_files
375
+ info('Preparing files')
376
+ debug("Using files from #{files}")
377
+
378
+ tmp_files_dir = File.join(sandbox_path, 'files')
379
+ FileUtils.mkdir_p(tmp_files_dir)
380
+ FileUtils.cp_r(Dir.glob("#{files}/*"), tmp_files_dir)
381
+ end
382
+
347
383
  def prepare_modules
348
384
  info('Preparing modules')
349
385
  if File.exists?(puppetfile)
@@ -366,6 +402,15 @@ module Kitchen
366
402
  FileUtils.cp_r(hiera_config, File.join(sandbox_path, 'hiera.yaml'))
367
403
  end
368
404
 
405
+ def prepare_fileserver_config
406
+ return unless fileserver_config
407
+
408
+ info('Preparing fileserver')
409
+ debug("Using fileserver config from #{fileserver_config}")
410
+
411
+ FileUtils.cp_r(fileserver_config, File.join(sandbox_path, 'fileserver.conf'))
412
+ end
413
+
369
414
  def prepare_hiera_data
370
415
  return unless hiera_data
371
416
  info('Preparing hiera data')
@@ -14,6 +14,8 @@ puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an
14
14
  manifests_path | | puppet repo manifests directory
15
15
  manifest | 'site.pp' | manifest for puppet apply to run
16
16
  modules_path | | puppet repo manifests directory
17
+ files_path | | directory to place at /tmp/kitchen/files
18
+ fileserver_config_path | | file to place fileserver.conf
17
19
  hiera_data_path | | puppet repo hiera data directory
18
20
  hiera_data_remote_path | "/var/lib/hiera" | Hiera data directory on server
19
21
  puppet_debug| false| Enable full debugging logging
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.8
4
+ version: 0.0.9
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-12 00:00:00.000000000 Z
12
+ date: 2014-05-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! '== DESCRIPTION:
15
15