kitchen-puppet 1.47.4 → 1.48.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: fd46c32e4becafc637420cc03535bb3659fda372
4
- data.tar.gz: 2a1d3a3bfbc3fee0e5266f84b9e31f881df8d3b1
3
+ metadata.gz: 942ab91b20ef7cd39f819db78b5f6beb9f7a6bd5
4
+ data.tar.gz: 6f214a9565ccf1b9db8508d939971b63dafb2097
5
5
  SHA512:
6
- metadata.gz: ca129ce3c76fe3f4224ff8b3bfd51ad3736d76f150a2d21aece84ae21e1cf4df026fa115cd79b2788aabf12739980a86967e570ceee0671ddd0a93e370a0df9b
7
- data.tar.gz: 75f93ad8af5526438b751dddb9f11ae9b1f5370cf4af6d704fc93ec203103e0967a10a7c44c7d8ea39e610bc6ddb3d9766edfb60cb6f91b784549392ed11c5c5
6
+ metadata.gz: 835b2f4473b1531a4a841abc509be2c411afe12c5b168b157a4f4eb62eaacd1bef813497f682db440d054a96c4b679a9e1b310fac631adf92000a9e0d5c4d0d2
7
+ data.tar.gz: 99cbab9178d8b3a63aa10522431bd1c7a9691bc0dadd78466a0ff5bfa8701734905d03acfe61a389b5de4d528b472c1ef9edf20b612abb527e715ff8abecadd0
data/README.md CHANGED
@@ -188,8 +188,60 @@ suites:
188
188
  - modules/mycompany_base/spec/acceptance/base_spec.rb
189
189
  ```
190
190
 
191
- See [busser-beaker](https://github.com/neillturner/kitchen-verifier-serverspec)
191
+ See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec)
192
192
 
193
+ ## hiera_writer_files option
194
+
195
+ Allows creation of arbitrary YAML files in the target instance's `hieradata/`
196
+ dir in test-kitchen configuration (eg `kitchen.yml`). Like setting chef
197
+ attributes in `kitchen.yml`, except for Hiera YAML files.
198
+
199
+ set `hiera_writer_files` in `kitchen.yml`
200
+
201
+ ```
202
+ ---
203
+ driver:
204
+ name: vagrant
205
+
206
+ provisioner:
207
+ #name: puppet_apply
208
+ name: puppet_hierawriter_apply
209
+ manifests_path: /repository/puppet_repo/manifests
210
+ modules_path: /repository/puppet_repo/modules-mycompany
211
+ hiera_data_path: /repository/puppet_repo/hieradata
212
+ hiera_writer_files:
213
+ - datacenter/vagrant.yaml:
214
+ logstash_servers: []
215
+ hosts:
216
+ 10.1.2.3:
217
+ - puppet
218
+ - puppetdb
219
+
220
+ platforms:
221
+ - name: nocm_ubuntu-12.04
222
+ driver_plugin: vagrant
223
+ driver_config:
224
+ box: nocm_ubuntu-12.04
225
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
226
+
227
+ suites:
228
+ - name: default
229
+ ```
230
+
231
+ The above configuration will result in the creation of a file on the guest named
232
+ `${hieradata}/datacenter/vagrant.yaml` containing:
233
+
234
+ ```
235
+ ---
236
+ logstash_servers: []
237
+ hosts:
238
+ 10.1.2.3:
239
+ - puppet
240
+ - puppetdb
241
+ ```
242
+
243
+ It will overwrite any existing Hiera YAML files with the same name (on the
244
+ guest), not merge.
193
245
 
194
246
  ## Provisioner Options
195
247
  Please see the Provisioner Options (https://github.com/neillturner/kitchen-puppet/blob/master/provisioner_options.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kitchen
4
4
  module Puppet
5
- VERSION = '1.47.4'.freeze
5
+ VERSION = '1.48.0'.freeze
6
6
  end
7
7
  end
@@ -54,6 +54,7 @@ module Kitchen
54
54
  default_config :hiera_version, nil
55
55
  default_config :install_hiera, false
56
56
  default_config :hiera_package, 'hiera-puppet'
57
+ default_config :hiera_writer_files, nil
57
58
  default_config :require_puppet_repo, true
58
59
  default_config :require_chef_for_busser, true
59
60
  default_config :resolve_with_librarian_puppet, true
@@ -790,6 +791,10 @@ module Kitchen
790
791
  powershell? ? 'C:/ProgramData/PuppetLabs/hiera/var' : '/var/lib/hiera'
791
792
  end
792
793
 
794
+ def hiera_writer
795
+ config[:hiera_writer_files]
796
+ end
797
+
793
798
  def hiera_eyaml
794
799
  config[:hiera_eyaml]
795
800
  end
@@ -1268,6 +1273,19 @@ module Kitchen
1268
1273
  debug("Copying hiera data from #{hiera_data} to #{tmp_hiera_dir}")
1269
1274
  FileUtils.mkdir_p(tmp_hiera_dir)
1270
1275
  FileUtils.cp_r(Dir.glob("#{hiera_data}/*"), tmp_hiera_dir)
1276
+ if hiera_writer
1277
+ hiera_writer.each do |file|
1278
+ file.each do |filename, hiera_hash|
1279
+ debug("Creating hiera yaml file #{tmp_hiera_dir}/#{filename}")
1280
+ dir = File.join(tmp_hiera_dir, File.dirname(filename.to_s))
1281
+ FileUtils.mkdir_p(dir)
1282
+ output_file = open(File.join(dir, File.basename(filename.to_s)), 'w')
1283
+ # convert json and back before converting to yaml to recursively convert symbols to strings, heh
1284
+ output_file.write JSON[hiera_hash.to_json].to_yaml
1285
+ output_file.close
1286
+ end
1287
+ end
1288
+ end
1271
1289
  return unless hiera_eyaml_key_path
1272
1290
  tmp_hiera_key_dir = File.join(sandbox_path, 'hiera_keys')
1273
1291
  debug("Copying hiera eyaml keys from #{hiera_eyaml_key_path} to #{tmp_hiera_key_dir}")
@@ -51,6 +51,7 @@ hiera_eyaml_key_remote_path | "/etc/puppet/secure/keys" | directory of hiera-eya
51
51
  hiera_eyaml_key_path | "hiera_keys" | directory of hiera-eyaml keys on workstation
52
52
  hiera_package | 'hiera-puppet' | Only used if `install_hiera` is set
53
53
  hiera_version | "latest"| desired version, affects apt installs.
54
+ hiera_writer_files | | Adds hiera YAML file generation
54
55
  http_proxy | nil | use http proxy when installing puppet, packages and running puppet
55
56
  https_proxy | nil | use https proxy when installing puppet, packages and running puppet
56
57
  ignored_paths_from_root | ['spec'] | allow extra paths to be ignored when copying from puppet repository
@@ -62,17 +63,17 @@ manifest | 'site.pp' | manifest for puppet apply to run
62
63
  manifests_path | | puppet repo manifests directory
63
64
  max_retries| 1 | maximum number of retry attempts of converge command
64
65
  modules_path | | puppet repo manifests directory. Can be multiple directories separated by colons and then they will be merged
65
- no_proxy | nil | list of URLs or IPs that should be excluded from proxying
66
+ no_proxy | nil | list of URLs or IPs that should be excluded from proxying
66
67
  platform | platform_name kitchen.yml parameter | OS platform of server
67
68
  puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
68
69
  puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo Ubuntu12 see https://apt.puppetlabs.com for others
69
- _for Ubuntu14 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-trusty.deb" |
70
+ _for Ubuntu14 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-trusty.deb" |
70
71
  _for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-jessie.deb" |
71
- _for Ubuntu16.04 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-xenial.deb" |
72
+ _for Ubuntu16.04 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-xenial.deb" |
72
73
  puppet_apt_collections_repo | "http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb" | apt collections repo
73
- _for Ubuntu14 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb" |
74
+ _for Ubuntu14 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb" |
74
75
  _for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb" |
75
- _for Ubuntu16.04 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb" |
76
+ _for Ubuntu16.04 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb" |
76
77
  puppet_coll_remote_path | "/opt/puppetlabs" | Server Installation location of a puppet collections install.
77
78
  puppet_config_path | | path of custom puppet.conf file
78
79
  puppet_debug| false| Enable full debugging logging on puppet run
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.47.4
4
+ version: 1.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen