kitchen-puppet 0.0.28 → 0.0.30

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: 36fd358f7c8da3bc3cd2b237ea8f019073f3dd0d
4
- data.tar.gz: 7a46cf27a5c6341575abb77973f0e7f48a0df2b4
3
+ metadata.gz: 5642be7475bf0630875b90636a565d6900b77ae7
4
+ data.tar.gz: 5243d5d8468c4ca6ec654b2f58b0ca395dfe986a
5
5
  SHA512:
6
- metadata.gz: 127466f7d9ce29f275bf2d47f2022b9a31e78bcd7a9f6fb834f6af5f0cf3220f7953655477fda48cd03d84082acc168043a6f95ca157ee07a61a4f650f745ff9
7
- data.tar.gz: ce52f4bf834f87126cf2e4b7a81c012d0b7a7eec0b85c408821f701b6a01ea5af516d9c61f5447ee7fa6346700ebee80103718ccf18f8d820941a37d2688dc09
6
+ metadata.gz: bb5906e46ad8d73d14e3ebf14f08afe42b4ceebb912636cbe8eb7db8a1eb07533bdfa528790e0990a7fa784ef1499592d092257906f6dfd85ffd80ed78ed3a1b
7
+ data.tar.gz: 1e2730f250b0d5dcd5746aeb18adff0fe627ac4d27c58434fa4ff4a0505a89e842d1aa40c444f33b3ccb3c44a8efd4f50bfb90b75cb1ec268944a4289c2c7150
data/README.md CHANGED
@@ -14,14 +14,28 @@ The PuppetApply provider works by passing the puppet repository based on attribu
14
14
  The PuppetAgent provider works by passing the puppetmaster and other attributes in .kitchen.yml & calling puppet agent.
15
15
 
16
16
 
17
- This provider has been tested against the Ubuntu 1204 and Centos 6.5 boxes running in vagrant/virtualbox.
17
+ This provider has been tested against the Ubuntu 1204 and Centos 6.5 boxes running in vagrant/virtualbox as well as various docker .
18
18
 
19
19
  ## Requirements
20
20
  You'll need a driver box without a chef installation so puppet can be installed. Puppet have one at http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box or http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box.
21
21
 
22
- For PuppetAgent a server with a puppet master is required that can resolve the hostname ip address of the server. The server must also be able to resolve the hostname ip address of the puppet master.
22
+ For PuppetAgent a server with a puppet master is required that can resolve the hostname ip address of the server. The server must also be able to resolve the hostname ip address of the puppet master.
23
+
24
+ You can also use the PuppetApply driver with a docker container, provided the necessary box requirements to install puppet are included inside the container. The easiest way to do this is to supply Kitchen-Docker with a custom dockerfile to install the needed dependencies for puppet installation.
23
25
 
24
26
  ## Installation & Setup
25
- You'll need the test-kitchen & kitchen-puppet gem's installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen.
27
+ You'll need the test-kitchen & kitchen-puppet gem's installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen.
26
28
 
27
29
  Please see the Provisioner Options (https://github.com/neillturner/kitchen-puppet/blob/master/provisioner_options.md).
30
+
31
+ ## Contributing
32
+ To contriubute to the repository, please follow the Fork / PR model:
33
+
34
+ 1. Fork The Repository
35
+ 2. Work on epic changes
36
+ 3. Write tests for your changes
37
+ 4. Update Documentation
38
+ 5. Commit
39
+ 6. Push
40
+ 7. Create PR
41
+ 8. Profit(?)
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.platform = Gem::Platform::RUBY
16
16
  s.require_paths = ['lib']
17
17
  s.rubyforge_project = '[none]'
18
+ s.add_dependency 'test-kitchen', '~> 1.4'
18
19
  s.description = <<-EOF
19
20
  == DESCRIPTION:
20
21
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kitchen
4
4
  module Puppet
5
- VERSION = '0.0.28'
5
+ VERSION = '0.0.30'
6
6
  end
7
7
  end
@@ -43,6 +43,7 @@ module Kitchen
43
43
  default_config :puppet_omnibus_url, nil
44
44
  default_config :puppet_omnibus_remote_path, '/opt/puppet'
45
45
  default_config :puppet_version, nil
46
+ default_config :facter_version, nil
46
47
  default_config :require_puppet_repo, true
47
48
  default_config :require_chef_for_busser, true
48
49
 
@@ -72,7 +73,7 @@ module Kitchen
72
73
  default_config :puppet_test, false
73
74
  default_config :puppet_onetime, true
74
75
  default_config :puppet_no_daemonize, true
75
- default_config :puppet_server, nil # will default to 'puppet'
76
+ default_config :puppet_server, nil # will default to 'puppet'
76
77
  default_config :puppet_waitforcert, '0'
77
78
  default_config :puppet_certname, nil
78
79
  default_config :puppet_digest, nil
@@ -120,6 +121,7 @@ module Kitchen
120
121
  #{sudo('wget')} #{wget_proxy_parm} #{puppet_apt_repo}
121
122
  #{sudo('dpkg')} -i #{puppet_apt_repo_file}
122
123
  #{update_packages_debian_cmd}
124
+ #{sudo_env('apt-get')} -y install facter#{facter_debian_version}
123
125
  #{sudo('apt-get')} -y install puppet-common#{puppet_debian_version}
124
126
  #{sudo('apt-get')} -y install puppet#{puppet_debian_version}
125
127
  fi
@@ -153,6 +155,7 @@ module Kitchen
153
155
  #{sudo('wget')} #{wget_proxy_parm} #{puppet_apt_repo}
154
156
  #{sudo('dpkg')} -i #{puppet_apt_repo_file}
155
157
  #{update_packages_debian_cmd}
158
+ #{sudo('apt-get')} -y install facter#{facter_debian_version}
156
159
  #{sudo('apt-get')} -y install puppet-common#{puppet_debian_version}
157
160
  #{sudo('apt-get')} -y install puppet#{puppet_debian_version}
158
161
  fi
@@ -255,6 +258,10 @@ module Kitchen
255
258
  config[:puppet_version] ? "=#{config[:puppet_version]}" : nil
256
259
  end
257
260
 
261
+ def facter_debian_version
262
+ config[:facter_version] ? "=#{config[:facter_version]}" : nil
263
+ end
264
+
258
265
  def puppet_redhat_version
259
266
  config[:puppet_version] ? "-#{config[:puppet_version]}" : nil
260
267
  end
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'uri'
24
24
  require 'json'
25
- require 'kitchen/provisioner/base'
25
+ require 'kitchen'
26
26
  require 'kitchen/provisioner/puppet/librarian'
27
27
 
28
28
  module Kitchen
@@ -44,6 +44,8 @@ module Kitchen
44
44
  default_config :puppet_apt_collections_repo, 'http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb'
45
45
  default_config :puppet_coll_remote_path, '/opt/puppetlabs'
46
46
  default_config :puppet_version, nil
47
+ default_config :facter_version, nil
48
+ default_config :hiera_version, nil
47
49
  default_config :require_puppet_repo, true
48
50
  default_config :require_chef_for_busser, true
49
51
  default_config :resolve_with_librarian_puppet, true
@@ -53,6 +55,7 @@ module Kitchen
53
55
  default_config :puppet_yum_repo, 'https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm'
54
56
  default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
55
57
  default_config :puppet_logdest, nil
58
+ default_config :custom_install_command, nil
56
59
 
57
60
  default_config :puppet_apply_command, nil
58
61
 
@@ -120,6 +123,7 @@ module Kitchen
120
123
  default_config :update_package_repos, true
121
124
  default_config :remove_puppet_repo, false
122
125
  default_config :custom_facts, {}
126
+ default_config :facterlib, nil
123
127
  default_config :puppet_detailed_exitcodes, nil
124
128
  default_config :facter_file, nil
125
129
  default_config :librarian_puppet_ssl_file, nil
@@ -162,12 +166,15 @@ module Kitchen
162
166
  #{sudo('wget')} #{wget_proxy_parm} #{puppet_apt_repo}
163
167
  #{sudo('dpkg')} -i #{puppet_apt_repo_file}
164
168
  #{update_packages_debian_cmd}
169
+ #{sudo_env('apt-get')} -y install facter#{facter_debian_version}
165
170
  #{sudo_env('apt-get')} -y install puppet-common#{puppet_debian_version}
166
171
  #{sudo_env('apt-get')} -y install puppet#{puppet_debian_version}
172
+ #{sudo_env('apt-get')} -y install hiera-puppet#{puppet_hiera_debian_version}
167
173
  fi
168
174
  #{install_eyaml}
169
175
  #{install_deep_merge}
170
176
  #{install_busser}
177
+ #{custom_install_command}
171
178
  INSTALL
172
179
  when 'redhat', 'centos', 'fedora', 'oracle', 'amazon'
173
180
  info("Installing puppet from yum on #{puppet_platform}")
@@ -178,6 +185,7 @@ module Kitchen
178
185
  #{install_eyaml}
179
186
  #{install_deep_merge}
180
187
  #{install_busser}
188
+ #{custom_install_command}
181
189
  INSTALL
182
190
  else
183
191
  info('Installing puppet, will try to determine platform os')
@@ -193,14 +201,17 @@ module Kitchen
193
201
  #{sudo('wget')} #{wget_proxy_parm} #{puppet_apt_repo}
194
202
  #{sudo('dpkg')} -i #{puppet_apt_repo_file}
195
203
  #{update_packages_debian_cmd}
204
+ #{sudo_env('apt-get')} -y install facter#{facter_debian_version}
196
205
  #{sudo_env('apt-get')} -y install puppet-common#{puppet_debian_version}
197
206
  #{sudo_env('apt-get')} -y install puppet#{puppet_debian_version}
207
+ #{sudo_env('apt-get')} -y install hiera-puppet#{puppet_hiera_debian_version}
198
208
  fi
199
209
  fi
200
210
  fi
201
211
  #{install_eyaml}
202
212
  #{install_deep_merge}
203
213
  #{install_busser}
214
+ #{custom_install_command}
204
215
  INSTALL
205
216
  end
206
217
  end
@@ -214,6 +225,7 @@ module Kitchen
214
225
  #{sudo('apt-get')} -y install wget
215
226
  #{sudo('wget')} #{wget_proxy_parm} #{config[:puppet_apt_collections_repo]}
216
227
  #{sudo('dpkg')} -i #{puppet_apt_coll_repo_file}
228
+ #{custom_install_command}
217
229
  INSTALL
218
230
  when 'redhat', 'centos', 'fedora', 'oracle', 'amazon'
219
231
  info("Installing Puppet Collections on #{puppet_platform}")
@@ -227,6 +239,7 @@ module Kitchen
227
239
  #{install_eyaml("#{config[:puppet_coll_remote_path]}/puppet/bin/gem")}
228
240
  #{install_deep_merge}
229
241
  #{install_busser}
242
+ #{custom_install_command}
230
243
  INSTALL
231
244
  else
232
245
  info('Installing Puppet Collections, will try to determine platform os')
@@ -257,6 +270,7 @@ module Kitchen
257
270
  #{install_eyaml("#{config[:puppet_coll_remote_path]}/puppet/bin/gem")}
258
271
  #{install_deep_merge}
259
272
  #{install_busser}
273
+ #{custom_install_command}
260
274
  INSTALL
261
275
  end
262
276
  end
@@ -336,12 +350,18 @@ module Kitchen
336
350
  INSTALL
337
351
  end
338
352
 
353
+ def custom_install_command
354
+ <<-INSTALL
355
+ #{config[:custom_install_command]}
356
+ INSTALL
357
+ end
358
+
339
359
  def init_command
340
360
  dirs = %w(modules manifests files hiera hiera.yaml)
341
361
  .map { |dir| File.join(config[:root_path], dir) }.join(' ')
342
362
  cmd = "#{sudo('rm')} -rf #{dirs} #{hiera_data_remote_path} /etc/hiera.yaml #{puppet_dir}/hiera.yaml #{puppet_dir}/fileserver.conf;"
343
363
  cmd += config[:puppet_environment] ? "#{sudo('rm')} -f #{File.join(puppet_dir, config[:puppet_environment])};" : ''
344
- cmd += " mkdir -p #{config[:root_path]} #{puppet_dir}"
364
+ cmd += " mkdir -p #{config[:root_path]}; #{sudo('mkdir')} -p #{puppet_dir}"
345
365
  debug(cmd)
346
366
  cmd
347
367
  end
@@ -447,7 +467,7 @@ module Kitchen
447
467
 
448
468
  if puppet_environment
449
469
  commands << [
450
- sudo('ln -s '), config[:root_path], File.join(puppet_dir, config[:puppet_environment])
470
+ sudo('ln -s '), config[:root_path], File.join(puppet_dir, config[:puppet_environment])
451
471
  ].join(' ')
452
472
  end
453
473
 
@@ -462,6 +482,7 @@ module Kitchen
462
482
  return config[:puppet_apply_command]
463
483
  else
464
484
  [
485
+ facterlib,
465
486
  custom_facts,
466
487
  facter_facts,
467
488
  puppet_cmd,
@@ -594,12 +615,24 @@ module Kitchen
594
615
  config[:puppet_version] ? "=#{config[:puppet_version]}" : nil
595
616
  end
596
617
 
618
+ def facter_debian_version
619
+ config[:facter_version] ? "=#{config[:facter_version]}" : nil
620
+ end
621
+
622
+ def puppet_hiera_debian_version
623
+ config[:hiera_version] ? "=#{config[:hiera_version]}" : nil
624
+ end
625
+
597
626
  def puppet_redhat_version
598
627
  config[:puppet_version] ? "-#{config[:puppet_version]}" : nil
599
628
  end
600
629
 
601
630
  def puppet_environment_flag
602
- config[:puppet_environment] ? "--environment=#{config[:puppet_environment]} --environmentpath=#{puppet_dir}" : nil
631
+ if config[:puppet_version] =~ /^2/
632
+ config[:puppet_environment] ? "--environment=#{config[:puppet_environment]}" : nil
633
+ else
634
+ config[:puppet_environment] ? "--environment=#{config[:puppet_environment]} --environmentpath=#{puppet_dir}" : nil
635
+ end
603
636
  end
604
637
 
605
638
  def puppet_manifestdir
@@ -661,6 +694,13 @@ module Kitchen
661
694
  config[:remove_puppet_repo]
662
695
  end
663
696
 
697
+ def facterlib
698
+ return nil if config[:facterlib].nil?
699
+ bash_vars = "export FACTERLIB='#{config[:facterlib]}';"
700
+ debug(bash_vars)
701
+ bash_vars
702
+ end
703
+
664
704
  def custom_facts
665
705
  return nil if config[:custom_facts].none?
666
706
  bash_vars = config[:custom_facts].map { |k, v| "FACTER_#{k}=#{v}" }.join(' ')
@@ -4,6 +4,8 @@
4
4
  key | default value | Notes
5
5
  ----|---------------|--------
6
6
  puppet_version | "latest"| desired version, affects apt installs.
7
+ facter_version | "latest"| desired version, affects apt installs.
8
+ hiera_version | "latest"| desired version, affects apt installs.
7
9
  puppet_platform | naively tries to determine | OS platform of server
8
10
  require_puppet_repo | true | Set if using a puppet install from yum or apt repo
9
11
  puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo
@@ -46,6 +48,7 @@ facter_file | nil | yaml file of custom facter_files to be provided to the puppe
46
48
  http_proxy | nil | use http proxy when installing puppet, packages and running puppet
47
49
  https_proxy | nil | use https proxy when installing puppet, packages and running puppet
48
50
  puppet_logdest | nil | _Array_ of log destinations. Include 'console' if wanted
51
+ custom_install_command | nil | Custom shell command to be used at install stage. Can be multiline. See examples below.
49
52
 
50
53
 
51
54
  ## Puppet Apply Configuring Provisioner Options
@@ -90,8 +93,29 @@ To override a setting at the suite-level, specify the setting name under the sui
90
93
  ```yaml
91
94
  suites:
92
95
  - name: default
93
- manifest: foobar.pp
96
+ provisioner:
97
+ manifest: foobar.pp
94
98
  ```
99
+
100
+ #### custom_install_command example usage
101
+
102
+ * One liner
103
+ ```yaml
104
+ custom_install_command: yum install -y git
105
+ ```
106
+ * Multiple lines, a.k.a embed shell script
107
+ ```yaml
108
+ custom_install_command: |
109
+ command1
110
+ command2
111
+ ```
112
+ * Multiple lines join without new line
113
+ ```yaml
114
+ custom_install_command: >
115
+ command1 &&
116
+ command2
117
+ ```
118
+
95
119
  ### Per-suite Structure
96
120
 
97
121
  It can be beneficial to keep different Puppet layouts for different suites. Rather than having to specify the manifest, modules, etc for each suite, you can create the following directory structure and they will automatically be found:
@@ -113,6 +137,7 @@ no idea why Puppet versioned their repository with a trailing
113
137
  key | default value | Notes
114
138
  ----|---------------|--------
115
139
  puppet_version | "latest"| desired version, affects apt installs.
140
+ facter_version | "latest"| desired version, affects apt installs.
116
141
  puppet_platform | naively tries to determine | OS platform of server
117
142
  require_puppet_repo | true | Set if using a puppet install from yum or apt repo
118
143
  puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo
@@ -135,6 +160,7 @@ puppet_verbose| false| Extra information logging on puppet run
135
160
  puppet_noop| false| puppet runs in a no-op or dry-run mode
136
161
  update_package_repos| true| update OS repository metadata
137
162
  custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
163
+ facterlib | nil | Path for dynamic fact generation, e.g. /etc/puppet/facter . See https://docs.puppetlabs.com/facter/2.2/custom_facts.html
138
164
  chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
139
165
  puppet_agent_command | nil | Overwrite the puppet agent command. Needs "sudo -E puppet agent" as a prefix.
140
166
  require_chef_for_busser | true | Install chef as currently needed by busser to run tests. NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
@@ -192,5 +218,6 @@ To override a setting at the suite-level, specify the setting name under the sui
192
218
  ```yaml
193
219
  suites:
194
220
  - name: default
195
- manifest: foobar.pp
221
+ provisioner:
222
+ manifest: foobar.pp
196
223
  ```
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.30
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-05-16 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2015-08-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
13
27
  description: |+
14
28
  == DESCRIPTION:
15
29
 
@@ -31,7 +45,6 @@ files:
31
45
  - lib/kitchen/provisioner/puppet/librarian.rb
32
46
  - lib/kitchen/provisioner/puppet_agent.rb
33
47
  - lib/kitchen/provisioner/puppet_apply.rb
34
- - lib/kitchen/provisioner/puppet_apply_spec.rb
35
48
  - provisioner_options.md
36
49
  homepage: https://github.com/neillturner/kitchen-puppet
37
50
  licenses: []
@@ -1,33 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Chris Lundquist (<chris.lundquist@github.com>) Neill Turner (<neillwturner@gmail.com>)
4
- #
5
- # Copyright (C) 2013,2014 Chris Lundquist, Neill Turner
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require_relative '../../spec_helper'
20
- require 'kitchen'
21
-
22
- # Work around for lazy loading
23
- require 'kitchen/provisioner/puppet_apply'
24
-
25
- describe Kitchen::Provisioner::PuppetApply do
26
- let(:provisioner) do
27
- Kitchen::Provisioner.for_plugin('puppet_apply', {})
28
- end
29
-
30
- it 'should give a sane run_command' do
31
- provisioner.run_command.must_match 'puppet apply'
32
- end
33
- end