kitchen-puppet 0.0.31 → 1.0.32

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: 3f972d0a87b1def1a969330b08fee33887823ba7
4
- data.tar.gz: 536cd0b900f3e927578114c1fd62b1901ffe8df7
3
+ metadata.gz: af420180c29dc5ff3d167e94b7ed8a3926e939be
4
+ data.tar.gz: 615e9d379eaecc18518e2bbc2f0cb2c6c1628dc4
5
5
  SHA512:
6
- metadata.gz: 791e698c2111a21c9afe7c3cd9a2c84c0e97beea6defd4379cdaa241f33db77c0ac1ebe1ad7346907e1abe31e3f051c555a04381dc001cf92ad19cf435dccfa4
7
- data.tar.gz: 8620ff75720a0a8264b520b09fbdf71f1d2820719af142667a6744c09040252cda881998c15dc5a5f7bcb1e898a18a6b757168f04fd09f7d230d2d40e9c3abff
6
+ metadata.gz: 65466da1de6bc81a8ee56c4668745d7fc278f837e6a11604c1af51a9a729377d99b7bf50a264451d3b3b09c74e1fb62273e3600c4ccd6bb563d6a49ee772389d
7
+ data.tar.gz: 47ae5d2cf0d7211087feca2b10b698557bc36cf2e64e80f3e69d9fb2f8711e21d8c0135fdb998cb86c7a9419512919db5952ed8e36795e413581cfa7dba08f92
@@ -5,6 +5,7 @@ require 'kitchen-puppet/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'kitchen-puppet'
8
+ s.license = 'Apache-2.0'
8
9
  s.version = Kitchen::Puppet::VERSION
9
10
  s.authors = ['Neill Turner']
10
11
  s.email = ['neillwturner@gmail.com']
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kitchen
4
4
  module Puppet
5
- VERSION = '0.0.31'
5
+ VERSION = '1.0.32'
6
6
  end
7
7
  end
@@ -32,6 +32,12 @@ module Kitchen
32
32
  end
33
33
  end
34
34
 
35
+ module Configurable
36
+ def platform_name(*)
37
+ instance.platform.name
38
+ end
39
+ end
40
+
35
41
  module Provisioner
36
42
  #
37
43
  # Puppet Apply provisioner.
@@ -46,6 +52,7 @@ module Kitchen
46
52
  default_config :puppet_version, nil
47
53
  default_config :facter_version, nil
48
54
  default_config :hiera_version, nil
55
+ default_config :install_hiera, false
49
56
  default_config :require_puppet_repo, true
50
57
  default_config :require_chef_for_busser, true
51
58
  default_config :resolve_with_librarian_puppet, true
@@ -125,7 +132,9 @@ module Kitchen
125
132
  default_config :puppet_debug, false
126
133
  default_config :puppet_verbose, false
127
134
  default_config :puppet_noop, false
128
- default_config :puppet_platform, ''
135
+ default_config :platform do |provisioner|
136
+ provisioner.platform_name('')
137
+ end
129
138
  default_config :update_package_repos, true
130
139
  default_config :remove_puppet_repo, false
131
140
  default_config :custom_facts, {}
@@ -165,7 +174,7 @@ module Kitchen
165
174
  else
166
175
  case puppet_platform
167
176
  when 'debian', 'ubuntu'
168
- info("Installing puppet on #{puppet_platform}")
177
+ info("Installing puppet on #{config[:platform]}")
169
178
  <<-INSTALL
170
179
  if [ ! $(which puppet) ]; then
171
180
  #{sudo('apt-get')} -y install wget
@@ -175,7 +184,7 @@ module Kitchen
175
184
  #{sudo_env('apt-get')} -y install facter#{facter_debian_version}
176
185
  #{sudo_env('apt-get')} -y install puppet-common#{puppet_debian_version}
177
186
  #{sudo_env('apt-get')} -y install puppet#{puppet_debian_version}
178
- #{sudo_env('apt-get')} -y install hiera-puppet#{puppet_hiera_debian_version}
187
+ #{install_hiera}
179
188
  fi
180
189
  #{install_eyaml}
181
190
  #{install_deep_merge}
@@ -210,7 +219,7 @@ module Kitchen
210
219
  #{sudo_env('apt-get')} -y install facter#{facter_debian_version}
211
220
  #{sudo_env('apt-get')} -y install puppet-common#{puppet_debian_version}
212
221
  #{sudo_env('apt-get')} -y install puppet#{puppet_debian_version}
213
- #{sudo_env('apt-get')} -y install hiera-puppet#{puppet_hiera_debian_version}
222
+ #{install_hiera}
214
223
  fi
215
224
  fi
216
225
  fi
@@ -321,6 +330,13 @@ module Kitchen
321
330
  INSTALL
322
331
  end
323
332
 
333
+ def install_hiera
334
+ return unless config[:install_hiera]
335
+ <<-INSTALL
336
+ #{sudo_env('apt-get')} -y install hiera-puppet#{puppet_hiera_debian_version}
337
+ INSTALL
338
+ end
339
+
324
340
  # /bin/wget -P /etc/pki/rpm-gpg/ http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
325
341
  # changed to curl
326
342
 
@@ -363,7 +379,7 @@ module Kitchen
363
379
  end
364
380
 
365
381
  def init_command
366
- dirs = %w(modules manifests files hiera hiera.yaml)
382
+ dirs = %w(modules manifests files hiera hiera.yaml spec)
367
383
  .map { |dir| File.join(config[:root_path], dir) }.join(' ')
368
384
  cmd = "#{sudo('rm')} -rf #{dirs} #{hiera_data_remote_path} \
369
385
  /etc/hiera.yaml #{puppet_dir}/hiera.yaml \
@@ -680,7 +696,7 @@ module Kitchen
680
696
  end
681
697
 
682
698
  def puppet_platform
683
- config[:puppet_platform].to_s.downcase
699
+ config[:platform].gsub(/-.*/, '')
684
700
  end
685
701
 
686
702
  def facter_facts
@@ -744,12 +760,47 @@ module Kitchen
744
760
  remove_puppet_repo ? "; #{sudo('rm')} -rf /tmp/kitchen #{hiera_data_remote_path} #{hiera_eyaml_key_remote_path} #{puppet_dir}/* " : nil
745
761
  end
746
762
 
763
+ # rubocop:disable Metrics/CyclomaticComplexity
747
764
  def puppet_apt_repo
748
- config[:puppet_apt_repo]
765
+ platform_version = config[:platform].partition('-')[2]
766
+ case puppet_platform
767
+ when 'ubuntu'
768
+ case platform_version
769
+ when '14.10'
770
+ # Utopic Repo
771
+ 'https://apt.puppetlabs.com/puppetlabs-release-utopic.deb'
772
+ when '14.04'
773
+ # Trusty Repo
774
+ 'https://apt.puppetlabs.com/puppetlabs-release-trusty.deb'
775
+ when '12.04'
776
+ # Precise Repo
777
+ 'https://apt.puppetlabs.com/puppetlabs-release-precise.deb'
778
+ else
779
+ # Configured Repo
780
+ config[:puppet_apt_repo]
781
+ end
782
+ when 'debian'
783
+ case platform_version.gsub(/\..*/, '')
784
+ when '8'
785
+ # Debian Jessie
786
+ 'https://apt.puppetlabs.com/puppetlabs-release-jessie.deb'
787
+ when '7'
788
+ # Debian Wheezy
789
+ 'https://apt.puppetlabs.com/puppetlabs-release-wheezy.deb'
790
+ when '6'
791
+ # Debian Squeeze
792
+ 'https://apt.puppetlabs.com/puppetlabs-release-squeeze.deb'
793
+ else
794
+ # Configured Repo
795
+ config[:puppet_apt_repo]
796
+ end
797
+ else
798
+ error("Unsupported Platform - #{config[:platform]}")
799
+ end
749
800
  end
750
801
 
751
802
  def puppet_apt_repo_file
752
- config[:puppet_apt_repo].split('/').last
803
+ puppet_apt_repo.split('/').last
753
804
  end
754
805
 
755
806
  def puppet_apt_coll_repo_file
@@ -5,8 +5,9 @@ key | default value | Notes
5
5
  ----|---------------|--------
6
6
  puppet_version | "latest"| desired version, affects apt installs.
7
7
  facter_version | "latest"| desired version, affects apt installs.
8
+ platform | platform_name kitchen.yml parameter | OS platform of server
8
9
  hiera_version | "latest"| desired version, affects apt installs.
9
- puppet_platform | naively tries to determine | OS platform of server
10
+ install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
10
11
  require_puppet_repo | true | Set if using a puppet install from yum or apt repo
11
12
  puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo
12
13
  puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"| yum repo
@@ -83,9 +84,9 @@ The provisioner can be configured globally or per suite, global settings act as
83
84
  verifier:
84
85
  ruby_bindir: '/usr/bin'
85
86
  ```
86
- where /usr/bin is the location of the ruby command.
87
+ where /usr/bin is the location of the ruby command.
87
88
 
88
- in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
89
+ in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
89
90
  latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp
90
91
 
91
92
  To override a setting at the suite-level, specify the setting name under the suite:
@@ -202,7 +203,7 @@ The provisioner can be configured globally or per suite, global settings act as
202
203
  verifier:
203
204
  ruby_bindir: '/usr/bin'
204
205
  ```
205
- where /usr/bin is the location of the ruby command.
206
+ where /usr/bin is the location of the ruby command.
206
207
 
207
208
  In this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the latest puppet and run puppet agent against a puppet master at puppetmaster-nocm-ubuntu-1204
208
209
 
@@ -221,3 +222,31 @@ To override a setting at the suite-level, specify the setting name under the sui
221
222
  provisioner:
222
223
  manifest: foobar.pp
223
224
  ```
225
+
226
+ ## Custom ServerSpec or Beaker Invocation
227
+
228
+ Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
229
+ With such setup there is no dependency on busser and any other chef library.
230
+
231
+ Also you can specify you tests in a different directory structure or even call [beaker](https://github.com/puppetlabs/beaker) instead of server spec and have tests in beaker structure
232
+
233
+ Using a structure like
234
+ ```yaml
235
+ verifier:
236
+ name: shell
237
+ remote_exec: true
238
+ command: |
239
+ sudo -s <<SERVERSPEC
240
+ cd /opt/gdc/serverspec-core
241
+ export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
242
+ export SERVERSPEC_BACKEND=exec
243
+ serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
244
+ SERVERSPEC
245
+ ```
246
+
247
+ where `serverspec` is a wrapper around `rake` invocation.
248
+ Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
249
+
250
+ With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
251
+
252
+ Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
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: 0.0.31
4
+ version: 1.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -47,7 +47,8 @@ files:
47
47
  - lib/kitchen/provisioner/puppet_apply.rb
48
48
  - provisioner_options.md
49
49
  homepage: https://github.com/neillturner/kitchen-puppet
50
- licenses: []
50
+ licenses:
51
+ - Apache-2.0
51
52
  metadata: {}
52
53
  post_install_message:
53
54
  rdoc_options: []