kitchen-puppet 0.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/kitchen-puppet.gemspec +1 -0
- data/lib/kitchen-puppet/version.rb +1 -1
- data/lib/kitchen/provisioner/puppet_apply.rb +59 -8
- data/provisioner_options.md +33 -4
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af420180c29dc5ff3d167e94b7ed8a3926e939be
|
|
4
|
+
data.tar.gz: 615e9d379eaecc18518e2bbc2f0cb2c6c1628dc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65466da1de6bc81a8ee56c4668745d7fc278f837e6a11604c1af51a9a729377d99b7bf50a264451d3b3b09c74e1fb62273e3600c4ccd6bb563d6a49ee772389d
|
|
7
|
+
data.tar.gz: 47ae5d2cf0d7211087feca2b10b698557bc36cf2e64e80f3e69d9fb2f8711e21d8c0135fdb998cb86c7a9419512919db5952ed8e36795e413581cfa7dba08f92
|
data/kitchen-puppet.gemspec
CHANGED
|
@@ -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 :
|
|
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 #{
|
|
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
|
-
#{
|
|
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
|
-
#{
|
|
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[:
|
|
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[:
|
|
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
|
-
|
|
803
|
+
puppet_apt_repo.split('/').last
|
|
753
804
|
end
|
|
754
805
|
|
|
755
806
|
def puppet_apt_coll_repo_file
|
data/provisioner_options.md
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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-
|
|
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: []
|