puppet 8.6.0-x64-mingw32 → 8.8.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -2
  3. data/Gemfile.lock +63 -53
  4. data/Rakefile +45 -22
  5. data/examples/hiera/README.md +68 -57
  6. data/examples/hiera/data/common.yaml +12 -0
  7. data/examples/hiera/data/dc1.yaml +6 -0
  8. data/examples/hiera/hiera.yaml +15 -0
  9. data/examples/hiera/modules/ntp/data/common.yaml +4 -0
  10. data/examples/hiera/modules/ntp/hiera.yaml +9 -0
  11. data/examples/hiera/modules/ntp/manifests/config.pp +16 -4
  12. data/examples/hiera/modules/ntp/templates/ntp.conf.epp +3 -0
  13. data/examples/hiera/modules/users/manifests/common.pp +7 -2
  14. data/examples/hiera/modules/users/manifests/dc1.pp +7 -2
  15. data/examples/hiera/site.pp +1 -1
  16. data/ext/project_data.yaml +0 -45
  17. data/ext/windows/service/daemon.rb +9 -2
  18. data/lib/puppet/application/doc.rb +1 -5
  19. data/lib/puppet/application/lookup.rb +2 -0
  20. data/lib/puppet/defaults.rb +5 -19
  21. data/lib/puppet/file_serving/http_metadata.rb +2 -0
  22. data/lib/puppet/functions/regsubst.rb +11 -14
  23. data/lib/puppet/indirector/catalog/compiler.rb +2 -35
  24. data/lib/puppet/module_tool/tar/gnu.rb +10 -8
  25. data/lib/puppet/node/server_facts.rb +43 -0
  26. data/lib/puppet/parser/functions/generate.rb +2 -1
  27. data/lib/puppet/pops/evaluator/deferred_resolver.rb +41 -6
  28. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
  29. data/lib/puppet/pops/evaluator/runtime3_support.rb +0 -6
  30. data/lib/puppet/pops/loader/static_loader.rb +2 -2
  31. data/lib/puppet/pops/lookup/module_data_provider.rb +9 -9
  32. data/lib/puppet/provider/aix_object.rb +1 -1
  33. data/lib/puppet/provider/file/posix.rb +16 -2
  34. data/lib/puppet/provider/group/groupadd.rb +30 -9
  35. data/lib/puppet/provider/package/gem.rb +1 -0
  36. data/lib/puppet/provider/package/pkgutil.rb +6 -5
  37. data/lib/puppet/provider/package/puppet_gem.rb +4 -15
  38. data/lib/puppet/provider/package/xbps.rb +127 -0
  39. data/lib/puppet/type/exec.rb +8 -0
  40. data/lib/puppet/type/file/selcontext.rb +7 -6
  41. data/lib/puppet/type/file/target.rb +9 -11
  42. data/lib/puppet/util/command_line/trollop.rb +20 -2
  43. data/lib/puppet/util/execution.rb +1 -1
  44. data/lib/puppet/util/reference.rb +1 -30
  45. data/lib/puppet/util/rpm_compare.rb +1 -1
  46. data/lib/puppet/util/run_mode.rb +40 -0
  47. data/lib/puppet/util/selinux.rb +14 -4
  48. data/lib/puppet/util/windows/com.rb +2 -2
  49. data/lib/puppet/util/windows/daemon.rb +15 -32
  50. data/lib/puppet/version.rb +1 -1
  51. data/locales/puppet.pot +648 -648
  52. data/man/man5/puppet.conf.5 +2 -2
  53. data/man/man8/puppet-agent.8 +1 -1
  54. data/man/man8/puppet-apply.8 +1 -1
  55. data/man/man8/puppet-catalog.8 +1 -1
  56. data/man/man8/puppet-config.8 +1 -1
  57. data/man/man8/puppet-describe.8 +1 -1
  58. data/man/man8/puppet-device.8 +1 -1
  59. data/man/man8/puppet-doc.8 +1 -1
  60. data/man/man8/puppet-epp.8 +1 -1
  61. data/man/man8/puppet-facts.8 +1 -1
  62. data/man/man8/puppet-filebucket.8 +1 -1
  63. data/man/man8/puppet-generate.8 +1 -1
  64. data/man/man8/puppet-help.8 +1 -1
  65. data/man/man8/puppet-lookup.8 +1 -1
  66. data/man/man8/puppet-module.8 +1 -1
  67. data/man/man8/puppet-node.8 +1 -1
  68. data/man/man8/puppet-parser.8 +1 -1
  69. data/man/man8/puppet-plugin.8 +1 -1
  70. data/man/man8/puppet-report.8 +1 -1
  71. data/man/man8/puppet-resource.8 +1 -1
  72. data/man/man8/puppet-script.8 +1 -1
  73. data/man/man8/puppet-ssl.8 +1 -1
  74. data/man/man8/puppet.8 +2 -2
  75. metadata +82 -53
  76. data/examples/hiera/etc/hiera.yaml +0 -15
  77. data/examples/hiera/etc/hieradb/common.yaml +0 -3
  78. data/examples/hiera/etc/hieradb/dc1.yaml +0 -6
  79. data/examples/hiera/etc/hieradb/development.yaml +0 -2
  80. data/examples/hiera/etc/puppet.conf +0 -3
  81. data/examples/hiera/modules/data/manifests/common.pp +0 -4
  82. data/examples/hiera/modules/ntp/manifests/data.pp +0 -4
  83. data/examples/hiera/modules/ntp/templates/ntp.conf.erb +0 -3
  84. data/examples/hiera/modules/users/manifests/development.pp +0 -4
  85. data/tasks/benchmark.rake +0 -180
  86. data/tasks/cfpropertylist.rake +0 -15
  87. data/tasks/ci.rake +0 -24
  88. data/tasks/generate_ast_model.rake +0 -90
  89. data/tasks/generate_cert_fixtures.rake +0 -199
  90. data/tasks/manpages.rake +0 -67
  91. data/tasks/memwalk.rake +0 -195
  92. data/tasks/parallel.rake +0 -410
  93. data/tasks/parser.rake +0 -22
  94. data/tasks/yard.rake +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c747dbaa69b82336d371f8b1ae39951b013c06cdbb2dce3e00f35c1dceb0b002
4
- data.tar.gz: 58ee771b93b07d954d4441d8aa4d2766754a3fb3bb2ef19959ca9c7b80b83c80
3
+ metadata.gz: 5ad018bb58b01b769766d087d7a3fab2a0ba3268068b31a39241e79d5ce40f70
4
+ data.tar.gz: cde01d0e47b9eae6cc26d907eaf613faec85ed18c8f4040bcb890aab7ac9789e
5
5
  SHA512:
6
- metadata.gz: 5b8aefe46eb702c506227ae6b8d7f47960109d7a360ae248aeadd40283cecf56eda5c320a7d86e06c0d096fd2ddc2006b7e27cf2ce01e19b599e45211d8e151f
7
- data.tar.gz: bcc63456d3ee6d2c356fd26b80c1ffb173cbb045d909e2bd7cc2f4ac0275ad5b20b2333485fe3cb0a5f9007db35abe71aa7d9bca68eeaf87b2e0c0c8bcddc958
6
+ metadata.gz: 7c3b345238ab4aede17a094e9fa484f271504d78dba7277ac8166841a088e83e651279938cf3867bf143e24a2ee46345e0b650938b87eb4848ffa772cf611fc3
7
+ data.tar.gz: 18319c8864ed5b075f672291404b753ea3331627db4e9700436449284d308862c0a27fb0d35b5a1993c8683f89e577b262fdc4fd6563949694c652ba33fda888
data/Gemfile CHANGED
@@ -12,7 +12,9 @@ def location_for(place, fake_version = nil)
12
12
  end
13
13
  end
14
14
 
15
- # Make sure these gem requirements are in sync with the gempspec and ext/project_data.yaml
15
+ # Make sure these gem requirements are in sync with the gempspec. Specifically,
16
+ # the runtime_dependencies in puppet.gemspec match the runtime dependencies here
17
+ # (like facter, semantic_puppet, and puppet-resource_api)
16
18
 
17
19
  gem "facter", *location_for(ENV['FACTER_LOCATION'] || ["~> 4.3"])
18
20
  gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"])
@@ -33,10 +35,13 @@ group(:features) do
33
35
  # requires native ldap headers/libs
34
36
  # gem 'ruby-ldap', '~> 0.9', require: false, platforms: [:ruby]
35
37
  gem 'puppetserver-ca', '~> 2.0', require: false
38
+ gem 'syslog', '~> 0.1.1', require: false, platforms: [:ruby]
39
+ gem 'CFPropertyList', ['>= 3.0.6', '< 4'], require: false
36
40
  end
37
41
 
38
42
  group(:test) do
39
- gem "ffi", '1.15.5', require: false
43
+ # 1.16.0 - 1.16.2 are broken on Windows
44
+ gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2', require: false
40
45
  gem "json-schema", "~> 2.0", require: false
41
46
  gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 13.0')
42
47
  gem "rspec", "~> 3.1", require: false
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (8.6.0)
5
- CFPropertyList (~> 2.2)
4
+ puppet (8.8.1)
6
5
  concurrent-ruby (~> 1.0)
7
6
  deep_merge (~> 1.0)
8
7
  facter (>= 4.3.0, < 5)
9
- fast_gettext (>= 2.1, < 3)
8
+ fast_gettext (>= 2.1, < 4)
9
+ getoptlong (~> 0.2.0)
10
10
  locale (~> 2.1)
11
11
  multi_json (~> 1.13)
12
12
  puppet-resource_api (~> 1.5)
@@ -16,17 +16,18 @@ PATH
16
16
  GEM
17
17
  remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
18
18
  specs:
19
- CFPropertyList (2.3.6)
20
- addressable (2.8.6)
21
- public_suffix (>= 2.0.2, < 6.0)
22
- apt_stage_artifacts (0.11.0)
23
- docopt
19
+ CFPropertyList (3.0.7)
20
+ base64
21
+ nkf
22
+ rexml
23
+ addressable (2.8.7)
24
+ public_suffix (>= 2.0.2, < 7.0)
24
25
  artifactory (3.0.17)
25
26
  ast (2.4.2)
26
27
  base64 (0.2.0)
27
- bigdecimal (3.1.7)
28
+ bigdecimal (3.1.8)
28
29
  coderay (1.1.3)
29
- concurrent-ruby (1.2.3)
30
+ concurrent-ruby (1.3.3)
30
31
  crack (1.0.0)
31
32
  bigdecimal
32
33
  rexml
@@ -37,17 +38,20 @@ GEM
37
38
  digest-crc (0.6.5)
38
39
  rake (>= 12.0.0, < 14.0.0)
39
40
  docopt (0.6.1)
40
- erubi (1.12.0)
41
- facter (4.6.1)
41
+ erubi (1.13.0)
42
+ facter (4.8.0)
42
43
  hocon (~> 1.3)
43
- thor (>= 1.0.1, < 2.0)
44
- faraday (2.9.0)
44
+ thor (>= 1.0.1, < 1.3)
45
+ faraday (2.10.0)
45
46
  faraday-net_http (>= 2.0, < 3.2)
47
+ logger
46
48
  faraday-net_http (3.1.0)
47
49
  net-http
48
- fast_gettext (2.3.0)
49
- ffi (1.15.5)
50
+ fast_gettext (2.4.0)
51
+ prime
52
+ ffi (1.16.3)
50
53
  forwardable (1.3.3)
54
+ getoptlong (0.2.1)
51
55
  gettext (3.4.9)
52
56
  erubi
53
57
  locale (>= 2.0.5)
@@ -58,7 +62,7 @@ GEM
58
62
  fast_gettext (~> 2.1)
59
63
  gettext (~> 3.4)
60
64
  locale
61
- google-apis-core (0.14.1)
65
+ google-apis-core (0.15.0)
62
66
  addressable (~> 2.5, >= 2.5.1)
63
67
  googleauth (~> 1.9)
64
68
  httpclient (>= 2.8.1, < 3.a)
@@ -66,22 +70,22 @@ GEM
66
70
  representable (~> 3.0)
67
71
  retriable (>= 2.0, < 4.a)
68
72
  rexml
69
- google-apis-iamcredentials_v1 (0.20.0)
70
- google-apis-core (>= 0.14.0, < 2.a)
71
- google-apis-storage_v1 (0.37.0)
72
- google-apis-core (>= 0.14.0, < 2.a)
73
+ google-apis-iamcredentials_v1 (0.21.0)
74
+ google-apis-core (>= 0.15.0, < 2.a)
75
+ google-apis-storage_v1 (0.40.0)
76
+ google-apis-core (>= 0.15.0, < 2.a)
73
77
  google-cloud-core (1.7.0)
74
78
  google-cloud-env (>= 1.0, < 3.a)
75
79
  google-cloud-errors (~> 1.0)
76
80
  google-cloud-env (2.1.1)
77
81
  faraday (>= 1.0, < 3.a)
78
82
  google-cloud-errors (1.4.0)
79
- google-cloud-storage (1.49.0)
83
+ google-cloud-storage (1.52.0)
80
84
  addressable (~> 2.8)
81
85
  digest-crc (~> 0.4)
82
86
  google-apis-core (~> 0.13)
83
87
  google-apis-iamcredentials_v1 (~> 0.18)
84
- google-apis-storage_v1 (~> 0.33)
88
+ google-apis-storage_v1 (~> 0.38)
85
89
  google-cloud-core (~> 1.6)
86
90
  googleauth (~> 1.9)
87
91
  mini_mime (~> 1.0)
@@ -93,22 +97,23 @@ GEM
93
97
  os (>= 0.9, < 2.0)
94
98
  signet (>= 0.16, < 2.a)
95
99
  hashdiff (1.1.0)
96
- hiera-eyaml (3.4.0)
97
- highline
98
- optimist
99
- highline (3.0.1)
100
+ hiera-eyaml (4.1.0)
101
+ highline (~> 2.1)
102
+ optimist (~> 3.1)
103
+ highline (2.1.0)
100
104
  hocon (1.4.0)
101
105
  hpricot (0.8.6)
102
106
  httpclient (2.8.3)
103
107
  json (2.7.2)
104
108
  json-schema (2.8.1)
105
109
  addressable (>= 2.4)
106
- jwt (2.8.1)
110
+ jwt (2.8.2)
107
111
  base64
108
112
  language_server-protocol (3.17.0.3)
109
113
  locale (2.1.4)
110
- memory_profiler (1.0.1)
111
- method_source (1.0.0)
114
+ logger (1.6.0)
115
+ memory_profiler (1.0.2)
116
+ method_source (1.1.0)
112
117
  mini_mime (1.1.5)
113
118
  minitar (0.9)
114
119
  msgpack (1.7.2)
@@ -116,18 +121,18 @@ GEM
116
121
  mustache (1.1.1)
117
122
  net-http (0.4.1)
118
123
  uri
124
+ nkf (0.2.0)
119
125
  optimist (3.1.0)
120
126
  os (1.1.4)
121
- packaging (0.118.0)
122
- apt_stage_artifacts
127
+ packaging (0.120.0)
123
128
  artifactory (~> 3)
124
129
  csv (>= 3.1.5)
125
130
  google-cloud-storage
126
131
  googleauth
127
132
  rake (>= 12.3)
128
133
  release-metrics
129
- parallel (1.24.0)
130
- parser (3.3.0.5)
134
+ parallel (1.25.1)
135
+ parser (3.3.4.0)
131
136
  ast (~> 2.4.1)
132
137
  racc
133
138
  prime (0.1.2)
@@ -136,7 +141,7 @@ GEM
136
141
  pry (0.14.2)
137
142
  coderay (~> 1.1)
138
143
  method_source (~> 1.0)
139
- public_suffix (5.0.5)
144
+ public_suffix (6.0.1)
140
145
  puppet-resource_api (1.9.0)
141
146
  hocon (>= 1.0)
142
147
  puppetserver-ca (2.7.0)
@@ -146,7 +151,7 @@ GEM
146
151
  rake (13.2.1)
147
152
  rdiscount (2.2.7.3)
148
153
  rdoc (6.3.4.1)
149
- regexp_parser (2.9.0)
154
+ regexp_parser (2.9.2)
150
155
  release-metrics (1.1.0)
151
156
  csv
152
157
  docopt
@@ -155,7 +160,8 @@ GEM
155
160
  trailblazer-option (>= 0.1.1, < 0.2.0)
156
161
  uber (< 0.2.0)
157
162
  retriable (3.1.2)
158
- rexml (3.2.6)
163
+ rexml (3.3.2)
164
+ strscan
159
165
  ronn (0.7.3)
160
166
  hpricot (>= 0.8.2)
161
167
  mustache (>= 0.7.0)
@@ -166,47 +172,47 @@ GEM
166
172
  rspec-mocks (~> 3.13.0)
167
173
  rspec-core (3.13.0)
168
174
  rspec-support (~> 3.13.0)
169
- rspec-expectations (3.13.0)
175
+ rspec-expectations (3.13.1)
170
176
  diff-lcs (>= 1.2.0, < 2.0)
171
177
  rspec-support (~> 3.13.0)
172
178
  rspec-its (1.3.0)
173
179
  rspec-core (>= 3.0.0)
174
180
  rspec-expectations (>= 3.0.0)
175
- rspec-mocks (3.13.0)
181
+ rspec-mocks (3.13.1)
176
182
  diff-lcs (>= 1.2.0, < 2.0)
177
183
  rspec-support (~> 3.13.0)
178
184
  rspec-support (3.13.1)
179
- rubocop (1.63.0)
185
+ rubocop (1.65.0)
180
186
  json (~> 2.3)
181
187
  language_server-protocol (>= 3.17.0)
182
188
  parallel (~> 1.10)
183
189
  parser (>= 3.3.0.2)
184
190
  rainbow (>= 2.2.2, < 4.0)
185
- regexp_parser (>= 1.8, < 3.0)
191
+ regexp_parser (>= 2.4, < 3.0)
186
192
  rexml (>= 3.2.5, < 4.0)
187
193
  rubocop-ast (>= 1.31.1, < 2.0)
188
194
  ruby-progressbar (~> 1.7)
189
195
  unicode-display_width (>= 2.4.0, < 3.0)
190
- rubocop-ast (1.31.2)
191
- parser (>= 3.3.0.4)
192
- rubocop-capybara (2.20.0)
193
- rubocop (~> 1.41)
194
- rubocop-factory_bot (2.25.1)
196
+ rubocop-ast (1.31.3)
197
+ parser (>= 3.3.1.0)
198
+ rubocop-capybara (2.21.0)
195
199
  rubocop (~> 1.41)
200
+ rubocop-factory_bot (2.26.1)
201
+ rubocop (~> 1.61)
196
202
  rubocop-i18n (3.0.0)
197
203
  rubocop (~> 1.0)
198
- rubocop-performance (1.21.0)
204
+ rubocop-performance (1.21.1)
199
205
  rubocop (>= 1.48.1, < 2.0)
200
206
  rubocop-ast (>= 1.31.1, < 2.0)
201
207
  rubocop-rake (0.6.0)
202
208
  rubocop (~> 1.0)
203
- rubocop-rspec (2.29.1)
209
+ rubocop-rspec (2.31.0)
204
210
  rubocop (~> 1.40)
205
211
  rubocop-capybara (~> 2.17)
206
212
  rubocop-factory_bot (~> 2.22)
207
213
  rubocop-rspec_rails (~> 2.28)
208
- rubocop-rspec_rails (2.28.2)
209
- rubocop (~> 1.40)
214
+ rubocop-rspec_rails (2.29.1)
215
+ rubocop (~> 1.61)
210
216
  ruby-prof (1.7.0)
211
217
  ruby-progressbar (1.13.0)
212
218
  scanf (1.0.0)
@@ -217,14 +223,16 @@ GEM
217
223
  jwt (>= 1.5, < 3.0)
218
224
  multi_json (~> 1.10)
219
225
  singleton (0.2.0)
226
+ strscan (3.1.0)
227
+ syslog (0.1.2)
220
228
  text (1.3.1)
221
- thor (1.3.1)
229
+ thor (1.2.2)
222
230
  trailblazer-option (0.1.2)
223
231
  uber (0.1.0)
224
232
  unicode-display_width (2.5.0)
225
233
  uri (0.13.0)
226
234
  vcr (6.2.0)
227
- webmock (3.23.0)
235
+ webmock (3.23.1)
228
236
  addressable (>= 2.8.0)
229
237
  crack (>= 0.3.2)
230
238
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -235,9 +243,10 @@ PLATFORMS
235
243
  x86_64-linux
236
244
 
237
245
  DEPENDENCIES
246
+ CFPropertyList (>= 3.0.6, < 4)
238
247
  diff-lcs (~> 1.3)
239
248
  facter (~> 4.3)
240
- ffi (= 1.15.5)
249
+ ffi (>= 1.15.5, < 1.17.0, != 1.16.2, != 1.16.1, != 1.16.0)
241
250
  gettext-setup (~> 1.0)
242
251
  hiera-eyaml
243
252
  hocon (~> 1.0)
@@ -264,6 +273,7 @@ DEPENDENCIES
264
273
  rubocop-rspec (~> 2.0)
265
274
  ruby-prof (>= 0.16.0)
266
275
  semantic_puppet (~> 1.0)
276
+ syslog (~> 0.1.1)
267
277
  vcr (~> 6.1)
268
278
  webmock (~> 3.0)
269
279
  webrick (~> 1.7)
data/Rakefile CHANGED
@@ -1,27 +1,9 @@
1
- # Rakefile for Puppet -*- ruby -*-
2
- RAKE_ROOT = File.dirname(__FILE__)
1
+ # frozen_string_literal: true
3
2
 
4
- # We need access to the Puppet.version method
5
- $LOAD_PATH.unshift(File.expand_path("lib"))
6
- require 'puppet/version'
7
-
8
- $LOAD_PATH << File.join(RAKE_ROOT, 'tasks')
9
-
10
- begin
11
- require 'rubygems'
12
- require 'rubygems/package_task'
13
- rescue LoadError
14
- # Users of older versions of Rake (0.8.7 for example) will not necessarily
15
- # have rubygems installed, or the newer rubygems package_task for that
16
- # matter.
17
- require 'rake/packagetask'
18
- require 'rake/gempackagetask'
19
- end
20
-
21
- require 'rake'
22
3
  require 'open3'
23
-
24
- Dir['tasks/**/*.rake'].each { |t| load t }
4
+ require 'rake'
5
+ require 'rubygems'
6
+ require 'rubygems/package_task'
25
7
 
26
8
  if Rake.application.top_level_tasks.grep(/^(pl:|package:)/).any?
27
9
  begin
@@ -45,6 +27,47 @@ task :default do
45
27
  sh %{rake -T}
46
28
  end
47
29
 
30
+ namespace :pl_ci do
31
+ desc 'Build puppet gems'
32
+ task :gem_build, [:gemspec] do |t, args|
33
+ args.with_defaults(gemspec: 'puppet.gemspec')
34
+ stdout, stderr, status = Open3.capture3(<<~END)
35
+ gem build #{args.gemspec} --platform x86-mingw32 && \
36
+ gem build #{args.gemspec} --platform x64-mingw32 && \
37
+ gem build #{args.gemspec} --platform universal-darwin && \
38
+ gem build #{args.gemspec}
39
+ END
40
+ if !status.exitstatus.zero?
41
+ puts "Error building #{args.gemspec}\n#{stdout} \n#{stderr}"
42
+ exit(1)
43
+ else
44
+ puts stdout
45
+ end
46
+ end
47
+
48
+ desc 'build the nightly puppet gems'
49
+ task :nightly_gem_build do
50
+ # this is taken from `rake package:nightly_gem`
51
+ extended_dot_version = %x{git describe --tags --dirty --abbrev=7}.chomp.tr('-', '.')
52
+
53
+ # we must create tempfile in the same directory as puppetg.gemspec, since
54
+ # it uses __dir__ to determine which files to include
55
+ require 'tempfile'
56
+ Tempfile.create('gemspec', __dir__) do |dst|
57
+ File.open('puppet.gemspec', 'r') do |src|
58
+ src.readlines.each do |line|
59
+ if line.match?(/version\s*=\s*['"][0-9.]+['"]/)
60
+ line = "spec.version = '#{extended_dot_version}'"
61
+ end
62
+ dst.puts line
63
+ end
64
+ end
65
+ dst.flush
66
+ Rake::Task['pl_ci:gem_build'].invoke(dst.path)
67
+ end
68
+ end
69
+ end
70
+
48
71
  task :spec do
49
72
  ENV["LOG_SPEC_ORDER"] = "true"
50
73
  sh %{rspec #{ENV['TEST'] || ENV['TESTS'] || 'spec'}}
@@ -1,91 +1,102 @@
1
- A working demo of Hiera with YAML and Puppet backends.
1
+ A working demo of Hiera with YAML backend.
2
2
  ======================================================
3
3
 
4
4
  This demo consists of:
5
5
 
6
- * A NTP module that has defaults for pool.ntp.org servers
7
- * A common data module where module users can create override data in pp files
8
- * A YAML data source in etc/hieradb where users can override data in yaml files
9
- * A couple of users modules that just notify the fact that they are being included
10
- * In Hiera data files a key called _classes_ that decides what to include on a node
6
+ - A **NTP** module that has defaults for *pool.ntp.org* servers
7
+ - A **YAML** data source in the *data/* directory where users can override data in yaml files
8
+ - A **Users** module that has a few manifests that simply notify that they are being included
9
+ - In Hiera data files a key called **classes** that decides what to include on a node
11
10
 
12
11
  Below various usage scenarios can be tested using this module.
13
12
 
14
- The examples below assume you have Hiera already installed and that you have
15
- hiera-puppet cloned from github and running these commands in _hiera-puppet/example_ as cwd.
13
+ The examples below assume you:
14
+ - Have the puppet-agent already installed
15
+ - You have this repository cloned from github
16
+ - Are running these commands from within the *examples/hiera* directory as cwd.
16
17
 
17
18
  Module from forge with module defaults
18
19
  --------------------------------------
19
20
 
20
- * Move the _modules/data_ directory to _modules/data.bak_ to avoid overrides
21
- used further in the example
22
- * Run puppet, creates _/etc/ntp.conf_ with ntp.org addresses
23
- * The _hiera\_include()_ function includes just _users::common_
24
-
25
- <pre>
26
- $ mv modules/data modules/data.bak
27
- $ puppet apply --config etc/puppet.conf site.pp
28
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/ensure: defined content as '{md5}7045121976147a932a66c7671939a9ad'
29
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
21
+ - Comment out lines 6-8 of [data/common.yaml](data/common.yaml#L6-8) to avoid overrides used further in the example
22
+ - Run a `puppet apply` to create a */tmp/ntp.conf* file containing the two *pool.ntp.org* addresses
23
+ - The *users::common* class should also be present in your catalog
24
+
25
+ ```shell
26
+ $ sed -i '6,8 s/^/#/' data/common.yaml
27
+ $ puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
28
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
29
+ Notice: Adding users::common
30
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
31
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/ensure: defined content as '{sha256}949c7247dbe0870258c921418cc8b270afcc57e1aa6f9d9933f306009ede60d0'
32
+ Notice: Applied catalog in 0.02 seconds
30
33
  $ cat /tmp/ntp.conf
31
34
  server 1.pool.ntp.org
32
35
  server 2.pool.ntp.org
33
- </pre>
36
+ ```
34
37
 
35
38
  Site wide override data in _data::common_
36
39
  -----------------------------------------
37
40
 
38
- * Restore the _modules/data_ directory that has a class _data::common_ that declares site wide overrides
39
- * The _hiera_include()_ function includes just _users::common_
40
-
41
- <pre>
42
- $ mv modules/data.bak modules/data
43
- $ puppet apply --config etc/puppet.conf site.pp
44
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}7045121976147a932a66c7671939a9addc2' to '{md5}8f9039fe1989a278a0a8e1836acb8d23'
45
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
41
+ - Remove the comments on lines 6-8 of [data/common.yaml](data/common.yaml#L6-8)
42
+ - Run a `puppet apply` to update */tmp/ntp.conf* to contain the two *ntp.example.com* addresses
43
+ - The *users::common* class should also be present in your catalog
44
+
45
+ ```shell
46
+ $ sed -i '6,8 s/^#//' data/common.yaml
47
+ $ puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
48
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
49
+ Notice: Adding users::common
50
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
51
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}949c7247dbe0870258c921418cc8b270afcc57e1aa6f9d9933f306009ede60d0' to '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0'
52
+ Notice: Applied catalog in 0.02 seconds
46
53
  $ cat /tmp/ntp.conf
47
54
  server ntp1.example.com
48
55
  server ntp2.example.com
49
- </pre>
56
+ ```
50
57
 
51
58
  Fact driven overrides for location=dc1
52
59
  --------------------------------------
53
60
 
54
- * Set a fact location=dc1 that uses the YAML data in _etc/hieradb/dc1.yaml_ to override
55
- * Show that machines in dc2 would use site-wide defaults
56
- * The _hiera_include()_ function includes _users::common_ and _users::dc1_ as the data file for dc1 adds that
57
-
58
- <pre>
59
- $ FACTER_location=dc1 puppet apply --config etc/puppet.conf site.pp
60
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}8f9039fe1989a278a0a8e1836acb8d23' to '{md5}074d0e2ac727f6cb9afe3345d574b578'
61
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
62
- notice: /Stage[main]/Users::Dc1/Notify[Adding users::dc1]/message: defined 'message' as 'Adding users::dc1'
61
+ - Override the location fact to `dc1` to demonstrate *data/dc1.yaml* overrides the *ntp::config::ntpservers* values in *data/common.yaml*
62
+ - `dc1` nodes will
63
+ - have the *users::common* and *users::dc1* in their catalogs
64
+ - */tmp/ntp.conf* will contain the two *ntp.dc1.example.com* addresses
65
+ - Show that the nodes in `dc2` would use the site-wide defaults
66
+
67
+ ```shell
68
+ $ FACTER_location=dc1 puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
69
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
70
+ Notice: Adding users::dc1
71
+ Notice: /Stage[main]/Users::Dc1/Notify[Adding users::dc1]/message: defined 'message' as 'Adding users::dc1'
72
+ Notice: Adding users::common
73
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
74
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0' to '{sha256}39227f1cf8d09623d2e66b6622af2e8db01ab26f77a5a2e6d6e058d0977f369b'
75
+ Notice: Applied catalog in 0.02 seconds
63
76
  $ cat /tmp/ntp.conf
64
77
  server ntp1.dc1.example.com
65
78
  server ntp2.dc1.example.com
66
- </pre>
67
-
68
- Now simulate a machine in _dc2_, because there is no data for dc2 it uses the site wide defaults and
69
- does not include the _users::dc1_ class anymore
70
-
71
- <pre>
72
- $ FACTER_location=dc2 puppet apply --config etc/puppet.conf site.pp
73
- warning: Could not find class data::dc2 for nephilim.ml.org
74
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}074d0e2ac727f6cb9afe3345d574b578' to '{md5}8f9039fe1989a278a0a8e1836acb8d23'
75
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
79
+ ```
80
+
81
+ Now simulate a machine in `dc2`, because there is no data for `dc2` it uses the site wide defaults and
82
+ does not include the *users::dc1* class anymore
83
+
84
+ ```shell
85
+ $ FACTER_location=dc2 puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
86
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
87
+ Notice: Adding users::common
88
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
89
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}39227f1cf8d09623d2e66b6622af2e8db01ab26f77a5a2e6d6e058d0977f369b' to '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0'
90
+ Notice: Applied catalog in 0.02 seconds
76
91
  $ cat /tmp/ntp.conf
77
92
  server ntp1.example.com
78
93
  server ntp2.example.com
79
- </pre>
94
+ ```
80
95
 
81
- You could create override data in the following places for a machine in _location=dc2_, they will be searched in this order and the first one with data will match.
96
+ You could create override data in the following places for a machine in *location=dc2*, they will be searched in this order and the first one with data will match.
82
97
 
83
- * file etc/hieradb/dc2.yaml
84
- * file etc/hieradb/common.yaml
85
- * class data::dc2
86
- * class data::production
87
- * class data::common
88
- * class ntp::config::data
89
- * class ntp::data
98
+ - file data/dc2.yaml
99
+ - file data/&lt;environment&gt;.yaml
100
+ - file data/common.yaml
90
101
 
91
- In this example due to the presence of _common.yaml_ that declares _ntpservers_ the classes will never be searched, it will have precedence.
102
+ In this example due to the presence of *common.yaml* that declares *ntpservers* the classes will never be searched, it will have precedence.
@@ -0,0 +1,12 @@
1
+ ---
2
+ classes:
3
+ - users::common
4
+ - ntp::config
5
+
6
+ ntp::config::ntpservers:
7
+ - 'ntp1.example.com'
8
+ - 'ntp2.example.com'
9
+
10
+ lookup_options:
11
+ classes:
12
+ merge: unique
@@ -0,0 +1,6 @@
1
+ ---
2
+ ntp::config::ntpservers:
3
+ - 'ntp1.dc1.example.com'
4
+ - 'ntp2.dc1.example.com'
5
+ classes:
6
+ - users::dc1
@@ -0,0 +1,15 @@
1
+ ---
2
+ version: 5
3
+ defaults:
4
+ datadir: data
5
+ data_hash: yaml_data
6
+
7
+ hierarchy:
8
+ - name: 'Per Location'
9
+ path: "%{facts.location}.yaml"
10
+
11
+ - name: 'Per Environment'
12
+ path: "%{facts.environment}.yaml"
13
+
14
+ - name: 'Common Data'
15
+ path: 'common.yaml'
@@ -0,0 +1,4 @@
1
+ ---
2
+ ntp::config::ntpservers:
3
+ - '1.pool.ntp.org'
4
+ - '2.pool.ntp.org'
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 5
3
+ defaults:
4
+ datadir: data
5
+ data_hash: yaml_data
6
+
7
+ hierarchy:
8
+ - name: 'Common Data'
9
+ path: 'common.yaml'
@@ -1,6 +1,18 @@
1
- # lookup ntpservers from hiera, or allow user of class to provide other value
2
- class ntp::config($ntpservers = hiera('ntpservers')) {
3
- file{'/tmp/ntp.conf':
4
- content => template('ntp/ntp.conf.erb')
1
+ # @summary Manage /tmp/ntp.conf file
2
+ #
3
+ # Given an array of ntpservers, manage the /tmp/ntp.conf file
4
+ #
5
+ # @example
6
+ # include ntp::config
7
+ #
8
+ # @param ntpservers
9
+ # An array of ntpserver(s) that should be present in the conf file
10
+ class ntp::config(
11
+ Array[String[1], 1] $ntpservers = undef,
12
+ ) {
13
+
14
+ file { '/tmp/ntp.conf':
15
+ content => epp('ntp/ntp.conf.epp')
5
16
  }
17
+
6
18
  }
@@ -0,0 +1,3 @@
1
+ <% $ntp::config::ntpservers.each |$server| { -%>
2
+ server <%= $server %>
3
+ <% } -%>
@@ -1,4 +1,9 @@
1
- # notifies
1
+ # @summary Notify to demonstrate users::common in catalog
2
+ #
3
+ # A common Class that all examples should include
4
+ #
5
+ # @example
6
+ # include users::common
2
7
  class users::common {
3
- notify{'Adding users::common': }
8
+ notify { 'Adding users::common': }
4
9
  }