kitchen-puppet 1.48.2 → 2.0.0
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/lib/kitchen-puppet/version.rb +1 -1
- data/lib/kitchen/provisioner/puppet_apply.rb +97 -17
- data/provisioner_options.md +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc443e789c42271e0ea4a036a0f64824b9e4947e
|
4
|
+
data.tar.gz: 66021dc606cc056dc2d2776d9cc9e5591e7c02cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33c28b9cfe62c3ef95a0450fe9745b6d68ee3edf83cbc9d07cd8e7dc868c618e7ffd6ce56179012630b4907854d5c7022a1640843069b266ba53fe74f077cf80
|
7
|
+
data.tar.gz: f8c5e852419e4c5432b3128637f8abec967aa40e8383c2ba4c918264980adc5be2b12d11e1817890e8e33c310f01c996551075d94579c6157282f4709ed3011b
|
@@ -60,6 +60,15 @@ module Kitchen
|
|
60
60
|
default_config :require_chef_for_busser, true
|
61
61
|
default_config :resolve_with_librarian_puppet, true
|
62
62
|
default_config :puppet_environment, nil
|
63
|
+
default_config :puppet_environment_config_path do |provisioner|
|
64
|
+
provisioner.calculate_path('environment.conf')
|
65
|
+
end
|
66
|
+
default_config :puppet_environment_remote_modules_path, 'modules'
|
67
|
+
default_config :puppet_environment_remote_manifests_path, 'manifests'
|
68
|
+
default_config :puppet_environment_remote_hieradata_path, 'hieradata'
|
69
|
+
default_config :puppet_environment_hiera_config_path do |provisioner|
|
70
|
+
provisioner.calculate_path('hiera.yaml', :file)
|
71
|
+
end
|
63
72
|
default_config :puppet_apt_repo, 'http://apt.puppetlabs.com/puppetlabs-release-precise.deb'
|
64
73
|
default_config :puppet_yum_repo, 'https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm'
|
65
74
|
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
@@ -112,6 +121,7 @@ module Kitchen
|
|
112
121
|
end
|
113
122
|
|
114
123
|
default_config :hiera_config_path do |provisioner|
|
124
|
+
provisioner.calculate_path('hiera.global.yaml', :file) ||
|
115
125
|
provisioner.calculate_path('hiera.yaml', :file)
|
116
126
|
end
|
117
127
|
|
@@ -157,6 +167,7 @@ module Kitchen
|
|
157
167
|
|
158
168
|
default_config :hiera_eyaml, false
|
159
169
|
default_config :hiera_eyaml_key_remote_path, '/etc/puppet/secure/keys'
|
170
|
+
default_config :puppet_environmentpath_remote_path, nil
|
160
171
|
|
161
172
|
default_config :hiera_eyaml_gpg, false
|
162
173
|
default_config :hiera_eyaml_gpg_recipients, false
|
@@ -521,14 +532,15 @@ module Kitchen
|
|
521
532
|
end
|
522
533
|
|
523
534
|
def init_command
|
524
|
-
todelete = %w[modules manifests files hiera hiera.yaml facter spec enc]
|
535
|
+
todelete = %w[modules manifests files hiera hiera.yaml hiera.global.yaml facter spec enc environment]
|
525
536
|
.map { |dir| File.join(config[:root_path], dir) }
|
526
537
|
todelete += [hiera_data_remote_path,
|
527
538
|
'/etc/hiera.yaml',
|
528
539
|
"#{puppet_dir}/hiera.yaml",
|
529
540
|
spec_files_remote_path.to_s,
|
530
541
|
"#{puppet_dir}/fileserver.conf"]
|
531
|
-
todelete << File.join(puppet_dir,
|
542
|
+
todelete << File.join(puppet_dir, puppet_environment) if puppet_environment
|
543
|
+
todelete << File.join(puppet_environmentpath_remote_path, puppet_environment) if puppet_environment_config && puppet_environment
|
532
544
|
cmd = "#{sudo(rm_command_paths(todelete))};"
|
533
545
|
cmd += " #{mkdir_command} #{config[:root_path]};"
|
534
546
|
cmd += " #{sudo(mkdir_command)} #{puppet_dir}"
|
@@ -547,6 +559,7 @@ module Kitchen
|
|
547
559
|
prepare_facts
|
548
560
|
prepare_puppet_config
|
549
561
|
prepare_hiera_config
|
562
|
+
prepare_puppet_environment
|
550
563
|
prepare_fileserver_config
|
551
564
|
prepare_hiera_data
|
552
565
|
prepare_enc
|
@@ -602,16 +615,6 @@ module Kitchen
|
|
602
615
|
].join(' ')
|
603
616
|
end
|
604
617
|
|
605
|
-
if hiera_config
|
606
|
-
commands << [
|
607
|
-
sudo(cp_command), File.join(config[:root_path], 'hiera.yaml'), '/etc/'
|
608
|
-
].join(' ')
|
609
|
-
|
610
|
-
commands << [
|
611
|
-
sudo(cp_command), File.join(config[:root_path], 'hiera.yaml'), hiera_config_dir
|
612
|
-
].join(' ')
|
613
|
-
end
|
614
|
-
|
615
618
|
if fileserver_config
|
616
619
|
commands << [
|
617
620
|
sudo(cp_command),
|
@@ -655,7 +658,31 @@ module Kitchen
|
|
655
658
|
|
656
659
|
if puppet_environment
|
657
660
|
commands << [
|
658
|
-
sudo('ln -s '), config[:root_path], File.join(puppet_dir,
|
661
|
+
sudo('ln -s '), config[:root_path], File.join(puppet_dir, puppet_environment)
|
662
|
+
].join(' ')
|
663
|
+
end
|
664
|
+
|
665
|
+
if puppet_environment_config && puppet_environment
|
666
|
+
commands << [
|
667
|
+
sudo(mkdir_command), puppet_environmentpath_remote_path
|
668
|
+
].join(' ')
|
669
|
+
commands << [
|
670
|
+
sudo(mkdir_command), File.join(puppet_environmentpath_remote_path, puppet_environment)
|
671
|
+
].join(' ')
|
672
|
+
commands << [
|
673
|
+
sudo('ln -s '), File.join(config[:root_path], 'modules'), File.join(puppet_environmentpath_remote_path, puppet_environment, puppet_environment_remote_modules_path)
|
674
|
+
].join(' ')
|
675
|
+
commands << [
|
676
|
+
sudo('ln -s '), File.join(config[:root_path], 'manifests'), File.join(puppet_environmentpath_remote_path, puppet_environment, puppet_environment_remote_manifests_path)
|
677
|
+
].join(' ')
|
678
|
+
commands << [
|
679
|
+
sudo('ln -s '), File.join(config[:root_path], 'hiera'), File.join(puppet_environmentpath_remote_path, puppet_environment, puppet_environment_remote_hieradata_path)
|
680
|
+
].join(' ')
|
681
|
+
commands << [
|
682
|
+
sudo('cp'), File.join(config[:root_path], 'environment', 'environment.conf'), File.join(puppet_environmentpath_remote_path, puppet_environment, 'environment.conf')
|
683
|
+
].join(' ')
|
684
|
+
commands << [
|
685
|
+
sudo('cp'), File.join(config[:root_path], 'environment', 'hiera.yaml'), File.join(puppet_environmentpath_remote_path, puppet_environment, 'hiera.yaml')
|
659
686
|
].join(' ')
|
660
687
|
end
|
661
688
|
|
@@ -694,6 +721,7 @@ module Kitchen
|
|
694
721
|
puppet_environment_flag,
|
695
722
|
puppet_noop_flag,
|
696
723
|
puppet_enc_flag,
|
724
|
+
puppet_hiera_flag,
|
697
725
|
puppet_detailed_exitcodes_flag,
|
698
726
|
puppet_verbose_flag,
|
699
727
|
puppet_debug_flag,
|
@@ -768,6 +796,25 @@ module Kitchen
|
|
768
796
|
config[:puppet_environment]
|
769
797
|
end
|
770
798
|
|
799
|
+
def puppet_environment_config
|
800
|
+
if config[:puppet_environment_config_path] && !puppet_environment
|
801
|
+
raise("ERROR: found environment config '#{config[:puppet_environment_config_path]}', however no 'puppet_environment' is specified. Please specify 'puppet_environment' or unset 'puppet_environment_config_path' in .kitchen.yml")
|
802
|
+
end
|
803
|
+
config[:puppet_environment_config_path]
|
804
|
+
end
|
805
|
+
|
806
|
+
def puppet_environment_remote_modules_path
|
807
|
+
config[:puppet_environment_remote_modules_path]
|
808
|
+
end
|
809
|
+
|
810
|
+
def puppet_environment_remote_manifests_path
|
811
|
+
config[:puppet_environment_remote_manifests_path]
|
812
|
+
end
|
813
|
+
|
814
|
+
def puppet_environment_remote_hieradata_path
|
815
|
+
config[:puppet_environment_remote_hieradata_path]
|
816
|
+
end
|
817
|
+
|
771
818
|
def puppet_git_init
|
772
819
|
config[:puppet_git_init]
|
773
820
|
end
|
@@ -780,6 +827,10 @@ module Kitchen
|
|
780
827
|
config[:hiera_config_path]
|
781
828
|
end
|
782
829
|
|
830
|
+
def puppet_environment_hiera_config
|
831
|
+
config[:puppet_environment_hiera_config_path]
|
832
|
+
end
|
833
|
+
|
783
834
|
def fileserver_config
|
784
835
|
config[:fileserver_config_path]
|
785
836
|
end
|
@@ -859,6 +910,15 @@ module Kitchen
|
|
859
910
|
config[:require_puppet_collections] ? '/etc/puppetlabs/puppet' : '/etc/puppet'
|
860
911
|
end
|
861
912
|
|
913
|
+
def puppet_environmentpath_remote_path
|
914
|
+
return config[:puppet_environmentpath_remote_path] if config[:puppet_environmentpath_remote_path]
|
915
|
+
if config[:puppet_version] =~ /^3/
|
916
|
+
powershell? ? 'C:/ProgramData/PuppetLabs/puppet/etc' : '/etc/puppet/environments'
|
917
|
+
else
|
918
|
+
powershell? ? 'C:/ProgramData/PuppetLabs/code/environments' : '/etc/puppetlabs/code/environments'
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
862
922
|
def hiera_config_dir
|
863
923
|
return 'C:/ProgramData/PuppetLabs/puppet/etc' if powershell?
|
864
924
|
config[:require_puppet_collections] ? '/etc/puppetlabs/code' : '/etc/puppet'
|
@@ -890,9 +950,9 @@ module Kitchen
|
|
890
950
|
|
891
951
|
def puppet_environment_flag
|
892
952
|
if config[:puppet_version] =~ /^2/
|
893
|
-
config[:puppet_environment] ? "--environment=#{
|
953
|
+
config[:puppet_environment] ? "--environment=#{puppet_environment}" : nil
|
894
954
|
else
|
895
|
-
config[:puppet_environment] ? "--environment=#{
|
955
|
+
config[:puppet_environment] ? "--environment=#{puppet_environment} --environmentpath=#{puppet_environmentpath_remote_path}" : nil
|
896
956
|
end
|
897
957
|
end
|
898
958
|
|
@@ -1000,6 +1060,10 @@ module Kitchen
|
|
1000
1060
|
config[:puppet_enc] ? "--node_terminus=exec --external_nodes=#{config[:root_path]}/enc/#{File.basename(config[:puppet_enc])}" : nil
|
1001
1061
|
end
|
1002
1062
|
|
1063
|
+
def puppet_hiera_flag
|
1064
|
+
hiera_config ? "--hiera_config=#{config[:root_path]}/hiera.global.yaml" : nil
|
1065
|
+
end
|
1066
|
+
|
1003
1067
|
def puppet_detailed_exitcodes_flag
|
1004
1068
|
config[:puppet_detailed_exitcodes] ? '--detailed-exitcodes' : nil
|
1005
1069
|
end
|
@@ -1255,13 +1319,29 @@ module Kitchen
|
|
1255
1319
|
FileUtils.cp_r(config[:puppet_enc], File.join(enc_dir, '/'))
|
1256
1320
|
end
|
1257
1321
|
|
1322
|
+
def prepare_puppet_environment
|
1323
|
+
return unless puppet_environment_config
|
1324
|
+
|
1325
|
+
info('Preparing Environment Config')
|
1326
|
+
environment_dir = File.join(sandbox_path, 'environment')
|
1327
|
+
FileUtils.mkdir_p(environment_dir)
|
1328
|
+
debug("Using Environment Config environment.conf from #{puppet_environment_config}")
|
1329
|
+
FileUtils.cp_r(puppet_environment_config, File.join(environment_dir, 'environment.conf'))
|
1330
|
+
if puppet_environment_hiera_config
|
1331
|
+
debug("Using Environment Hiera Config hiera.yaml from #{puppet_environment_hiera_config}")
|
1332
|
+
FileUtils.cp_r(puppet_environment_hiera_config, File.join(environment_dir, 'hiera.yaml'))
|
1333
|
+
else
|
1334
|
+
info('No Environment hiera.yaml found')
|
1335
|
+
end
|
1336
|
+
end
|
1337
|
+
|
1258
1338
|
def prepare_hiera_config
|
1259
1339
|
return unless hiera_config
|
1260
1340
|
|
1261
|
-
info('Preparing hiera')
|
1341
|
+
info('Preparing hiera (global layer)')
|
1262
1342
|
debug("Using hiera from #{hiera_config}")
|
1263
1343
|
|
1264
|
-
FileUtils.cp_r(hiera_config, File.join(sandbox_path, 'hiera.yaml'))
|
1344
|
+
FileUtils.cp_r(hiera_config, File.join(sandbox_path, 'hiera.global.yaml'))
|
1265
1345
|
end
|
1266
1346
|
|
1267
1347
|
def prepare_fileserver_config
|
data/provisioner_options.md
CHANGED
@@ -38,7 +38,7 @@ facter_file | nil | yaml file of custom facter_files to be provided to the puppe
|
|
38
38
|
facter_version | "latest"| desired version, affects apt installs.
|
39
39
|
files_path | | directory to place at /tmp/kitchen/files
|
40
40
|
fileserver_config_path | | file to place fileserver.conf
|
41
|
-
hiera_config_path | | path to hiera.yaml
|
41
|
+
hiera_config_path | hiera.global.yaml then hiera.yaml | path to hiera.yaml
|
42
42
|
hiera_data_path | | puppet repo hiera data directory
|
43
43
|
hiera_data_remote_path | "/var/lib/hiera" | Hiera data directory on server
|
44
44
|
hiera_deep_merge | false | install the deep_merge gem to support hiera deep merge mode
|
@@ -80,6 +80,12 @@ puppet_debug| false| Enable full debugging logging on puppet run
|
|
80
80
|
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes. See `--detailed-exitcodes` section of `puppet help apply`
|
81
81
|
puppet_enc | | path for external node classifier script
|
82
82
|
puppet_environment | nil | puppet environment for running puppet apply (Must set if using Puppet v4)
|
83
|
+
puppet_environment _config_path | "environment.conf" | Puppet environment config file
|
84
|
+
puppet_environment _hiera_config_path | "hiera.yaml" | Environment layer hiera config file (see Puppet 4.10), only used if puppet _environmentpath = true
|
85
|
+
puppet_environment _remote_hieradata_path | "hieradata" | Path in `puppet_environmentpath_remote_path` to contains the hiera data.
|
86
|
+
puppet_environment _remote_modules_path | "modules" | Path in `puppet_environmentpath_remote_path` to contains the modules.
|
87
|
+
puppet_environment _remote_manifests_path | "manifests" | Path in `puppet_environmentpath_remote_path` to contains the manifests.
|
88
|
+
puppet _environmentpath_remote_path | "/etc/puppet/environments" (v3), "/etc/puppetlabs/code/environments" (v4) | The remote path for environments if `puppet_environmentpath` is true
|
83
89
|
puppet_future_parser | false | Run puppet with the future parser enabled (see https://docs.puppet.com/puppet/3.8/experiments_future.html).
|
84
90
|
puppet_git_init | nil | initialize puppet from GIT repository, e.g. "git@github.com:example/puppet-repo.git"
|
85
91
|
puppet_git_pr | nil | checkout specific Pull Request from repository specified in puppet_git_init, e.g. "324"
|
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: 2.0.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-05-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|