kitchen-puppet 0.0.18 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -21
- data/kitchen-puppet.gemspec +0 -1
- data/lib/kitchen-puppet/version.rb +1 -1
- data/lib/kitchen/provisioner/puppet_agent.rb +17 -17
- data/lib/kitchen/provisioner/puppet_apply.rb +41 -21
- data/provisioner_options.md +3 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
The
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
# Kitchen Puppet
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/kitchen-puppet.svg)](http://badge.fury.io/rb/kitchen-puppet)
|
4
|
+
|
5
|
+
# kitchen-puppet
|
6
|
+
A Test Kitchen Provisioner for Puppet
|
7
|
+
|
8
|
+
The providers supports both puppet apply and puppet agent clients
|
9
|
+
|
10
|
+
The PuppetApply provider works by passing the puppet repository based on attributes in .kitchen.yml & calling puppet apply.
|
11
|
+
|
12
|
+
The PuppetAgent provider works by passing the puppetmaster and other attributes in .kitchen.yml & calling puppet agent.
|
13
|
+
|
14
|
+
|
15
|
+
This provider has been tested against the Ubuntu 1204 and Centos 6.5 boxes running in vagrant/virtualbox.
|
16
|
+
|
17
|
+
## Requirements
|
18
|
+
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.
|
19
|
+
|
20
|
+
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.
|
21
|
+
|
22
|
+
## Installation & Setup
|
23
|
+
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.
|
24
|
+
|
25
|
+
Please see the Provisioner Options (https://github.com/neillturner/kitchen-puppet/blob/master/provisioner_options.md).
|
data/kitchen-puppet.gemspec
CHANGED
@@ -51,7 +51,7 @@ module Kitchen
|
|
51
51
|
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
52
52
|
|
53
53
|
default_config :puppet_agent_command, nil
|
54
|
-
|
54
|
+
|
55
55
|
default_config :http_proxy, nil
|
56
56
|
|
57
57
|
default_config :puppet_config_path do |provisioner|
|
@@ -280,10 +280,10 @@ module Kitchen
|
|
280
280
|
def update_packages_redhat_cmd
|
281
281
|
config[:update_package_repos] ? "#{sudo_env('yum')} makecache" : nil
|
282
282
|
end
|
283
|
-
|
283
|
+
|
284
284
|
def sudo_env(pm)
|
285
285
|
http_proxy ? "#{sudo('env')} http_proxy=#{http_proxy} #{pm}" : "#{sudo(pm)}"
|
286
|
-
end
|
286
|
+
end
|
287
287
|
|
288
288
|
def custom_facts
|
289
289
|
return nil if config[:custom_facts].none?
|
@@ -348,22 +348,22 @@ module Kitchen
|
|
348
348
|
def puppet_yum_repo
|
349
349
|
config[:puppet_yum_repo]
|
350
350
|
end
|
351
|
-
|
352
|
-
def proxy_parm
|
353
|
-
|
354
|
-
end
|
355
|
-
|
356
|
-
def gem_proxy_parm
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
def wget_proxy_parm
|
361
|
-
|
362
|
-
end
|
363
|
-
|
351
|
+
|
352
|
+
def proxy_parm
|
353
|
+
http_proxy ? "--httpproxy #{URI.parse(http_proxy).host.downcase} --httpport #{URI.parse(http_proxy).port} " : nil
|
354
|
+
end
|
355
|
+
|
356
|
+
def gem_proxy_parm
|
357
|
+
http_proxy ? "--http-proxy #{http_proxy}" : nil
|
358
|
+
end
|
359
|
+
|
360
|
+
def wget_proxy_parm
|
361
|
+
http_proxy ? "-e use_proxy=yes -e http_proxy=#{http_proxy}" : nil
|
362
|
+
end
|
363
|
+
|
364
364
|
def http_proxy
|
365
365
|
config[:http_proxy]
|
366
|
-
end
|
366
|
+
end
|
367
367
|
|
368
368
|
def chef_url
|
369
369
|
config[:chef_bootstrap_url]
|
@@ -48,12 +48,13 @@ module Kitchen
|
|
48
48
|
default_config :require_chef_for_busser, true
|
49
49
|
default_config :resolve_with_librarian_puppet, true
|
50
50
|
default_config :puppet_environment, nil
|
51
|
+
default_config :install_custom_facts, false
|
51
52
|
default_config :puppet_apt_repo, 'http://apt.puppetlabs.com/puppetlabs-release-precise.deb'
|
52
53
|
default_config :puppet_yum_repo, 'https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm'
|
53
54
|
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
54
55
|
|
55
56
|
default_config :puppet_apply_command, nil
|
56
|
-
|
57
|
+
|
57
58
|
default_config :http_proxy, nil
|
58
59
|
|
59
60
|
default_config :hiera_data_remote_path, '/var/lib/hiera'
|
@@ -91,7 +92,6 @@ module Kitchen
|
|
91
92
|
default_config :fileserver_config_path do |provisioner|
|
92
93
|
provisioner.calculate_path('fileserver.conf', :file)
|
93
94
|
end
|
94
|
-
|
95
95
|
default_config :puppetfile_path do |provisioner|
|
96
96
|
provisioner.calculate_path('Puppetfile', :file)
|
97
97
|
end
|
@@ -115,6 +115,7 @@ module Kitchen
|
|
115
115
|
default_config :update_package_repos, true
|
116
116
|
default_config :remove_puppet_repo, false
|
117
117
|
default_config :custom_facts, {}
|
118
|
+
default_config :puppet_detailed_exitcodes, nil
|
118
119
|
default_config :facter_file, nil
|
119
120
|
default_config :librarian_puppet_ssl_file, nil
|
120
121
|
|
@@ -257,6 +258,7 @@ module Kitchen
|
|
257
258
|
prepare_modules
|
258
259
|
prepare_manifests
|
259
260
|
prepare_files
|
261
|
+
prepare_facts
|
260
262
|
prepare_puppet_config
|
261
263
|
prepare_hiera_config
|
262
264
|
prepare_fileserver_config
|
@@ -344,6 +346,7 @@ module Kitchen
|
|
344
346
|
"--fileserverconfig=#{File.join(config[:root_path], 'fileserver.conf')}",
|
345
347
|
puppet_environment_flag,
|
346
348
|
puppet_noop_flag,
|
349
|
+
puppet_detailed_exitcodes_flag,
|
347
350
|
puppet_verbose_flag,
|
348
351
|
puppet_debug_flag,
|
349
352
|
remove_repo
|
@@ -462,12 +465,12 @@ module Kitchen
|
|
462
465
|
|
463
466
|
def facter_facts
|
464
467
|
return nil unless config[:facter_file]
|
465
|
-
fact_vars =
|
468
|
+
fact_vars = 'export '
|
466
469
|
fact_hash = YAML.load_file(config[:facter_file])
|
467
470
|
fact_hash.each do |key, value|
|
468
471
|
fact_vars << "FACTER_#{key}=#{value} "
|
469
472
|
end
|
470
|
-
fact_vars <<
|
473
|
+
fact_vars << ';'
|
471
474
|
fact_vars
|
472
475
|
end
|
473
476
|
|
@@ -476,13 +479,13 @@ module Kitchen
|
|
476
479
|
end
|
477
480
|
|
478
481
|
def update_packages_redhat_cmd
|
479
|
-
|
482
|
+
# #{sudo('yum')}
|
480
483
|
config[:update_package_repos] ? "#{sudo_env('yum')} makecache" : nil
|
481
484
|
end
|
482
|
-
|
485
|
+
|
483
486
|
def sudo_env(pm)
|
484
487
|
http_proxy ? "#{sudo('env')} http_proxy=#{http_proxy} #{pm}" : "#{sudo(pm)}"
|
485
|
-
end
|
488
|
+
end
|
486
489
|
|
487
490
|
def remove_puppet_repo
|
488
491
|
config[:remove_puppet_repo]
|
@@ -496,6 +499,10 @@ module Kitchen
|
|
496
499
|
bash_vars
|
497
500
|
end
|
498
501
|
|
502
|
+
def puppet_detailed_exitcodes_flag
|
503
|
+
config[:puppet_detailed_exitcodes] ? '--detailed-exitcodes' : nil
|
504
|
+
end
|
505
|
+
|
499
506
|
def remove_repo
|
500
507
|
remove_puppet_repo ? "; #{sudo('rm')} -rf /tmp/kitchen #{hiera_data_remote_path} #{hiera_eyaml_key_remote_path} /etc/puppet/* " : nil
|
501
508
|
end
|
@@ -511,22 +518,22 @@ module Kitchen
|
|
511
518
|
def puppet_yum_repo
|
512
519
|
config[:puppet_yum_repo]
|
513
520
|
end
|
514
|
-
|
515
|
-
def proxy_parm
|
516
|
-
|
517
|
-
end
|
518
|
-
|
519
|
-
def gem_proxy_parm
|
520
|
-
|
521
|
-
end
|
522
|
-
|
523
|
-
def wget_proxy_parm
|
524
|
-
|
525
|
-
end
|
526
|
-
|
521
|
+
|
522
|
+
def proxy_parm
|
523
|
+
http_proxy ? "--httpproxy #{URI.parse(http_proxy).host.downcase} --httpport #{URI.parse(http_proxy).port} " : nil
|
524
|
+
end
|
525
|
+
|
526
|
+
def gem_proxy_parm
|
527
|
+
http_proxy ? "--http-proxy #{http_proxy}" : nil
|
528
|
+
end
|
529
|
+
|
530
|
+
def wget_proxy_parm
|
531
|
+
http_proxy ? "-e use_proxy=yes -e http_proxy=#{http_proxy}" : nil
|
532
|
+
end
|
533
|
+
|
527
534
|
def http_proxy
|
528
535
|
config[:http_proxy]
|
529
|
-
end
|
536
|
+
end
|
530
537
|
|
531
538
|
def chef_url
|
532
539
|
config[:chef_bootstrap_url]
|
@@ -555,6 +562,19 @@ module Kitchen
|
|
555
562
|
FileUtils.cp_r(Dir.glob("#{files}/*"), tmp_files_dir)
|
556
563
|
end
|
557
564
|
|
565
|
+
def prepare_facts
|
566
|
+
return unless config[:install_custom_facts]
|
567
|
+
return unless config[:custom_facts]
|
568
|
+
info 'installing custom facts'
|
569
|
+
facter_dir = File.join(sandbox_path, 'facter')
|
570
|
+
FileUtils.mkdir_p(facter_dir)
|
571
|
+
tmp_facter_file = File.join(facter_dir, 'kitchen.yaml')
|
572
|
+
facter_facts = config[:custom_facts]
|
573
|
+
File.open(tmp_facter_file, 'w') do |out|
|
574
|
+
YAML.dump(facter_facts, out)
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
558
578
|
def prepare_modules
|
559
579
|
info('Preparing modules')
|
560
580
|
|
data/provisioner_options.md
CHANGED
@@ -11,6 +11,7 @@ puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
|
|
11
11
|
require_puppet_omnibus | false | Set if using omnibus puppet install
|
12
12
|
puppet_omnibus_url | | omnibus puppet install location.
|
13
13
|
puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
|
14
|
+
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
|
14
15
|
manifests_path | | puppet repo manifests directory
|
15
16
|
manifest | 'site.pp' | manifest for puppet apply to run
|
16
17
|
modules_path | | puppet repo manifests directory
|
@@ -24,6 +25,7 @@ puppet_verbose| false| Extra information logging on puppet run
|
|
24
25
|
puppet_noop| false| puppet runs in a no-op or dry-run mode
|
25
26
|
update_package_repos| true| update OS repository metadata
|
26
27
|
custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
|
28
|
+
install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.yaml"
|
27
29
|
chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
|
28
30
|
puppetfile_path | | Path to Puppetfile
|
29
31
|
puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
|
@@ -160,4 +162,4 @@ To override a setting at the suite-level, specify the setting name under the sui
|
|
160
162
|
|
161
163
|
suites:
|
162
164
|
- name: default
|
163
|
-
manifest: foobar.pp
|
165
|
+
manifest: foobar.pp
|
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.
|
4
|
+
version: 0.0.20
|
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:
|
12
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! '== DESCRIPTION:
|
15
15
|
|