puppet 6.0.0-universal-darwin → 6.0.1-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/lib/puppet/application/apply.rb +99 -59
  4. data/lib/puppet/application/cert.rb +2 -112
  5. data/lib/puppet/configurer.rb +2 -3
  6. data/lib/puppet/defaults.rb +14 -1
  7. data/lib/puppet/etc.rb +20 -0
  8. data/lib/puppet/module/task.rb +29 -38
  9. data/lib/puppet/parser/catalog_compiler.rb +24 -0
  10. data/lib/puppet/parser/compiler.rb +3 -1
  11. data/lib/puppet/pops/evaluator/deferred_resolver.rb +3 -0
  12. data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
  13. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +18 -10
  14. data/lib/puppet/pops/loader/task_instantiator.rb +13 -70
  15. data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
  16. data/lib/puppet/pops/parser/lexer2.rb +1 -1
  17. data/lib/puppet/pops/pcore.rb +10 -33
  18. data/lib/puppet/pops/serialization.rb +1 -0
  19. data/lib/puppet/pops/serialization/to_data_converter.rb +9 -1
  20. data/lib/puppet/provider/exec.rb +57 -57
  21. data/lib/puppet/provider/group/aix.rb +1 -15
  22. data/lib/puppet/provider/group/pw.rb +4 -8
  23. data/lib/puppet/provider/group/windows_adsi.rb +7 -4
  24. data/lib/puppet/provider/nameservice.rb +1 -25
  25. data/lib/puppet/provider/nameservice/directoryservice.rb +5 -3
  26. data/lib/puppet/provider/package/portage.rb +2 -2
  27. data/lib/puppet/provider/service/launchd.rb +19 -3
  28. data/lib/puppet/provider/user/aix.rb +48 -2
  29. data/lib/puppet/type/group.rb +62 -18
  30. data/lib/puppet/type/schedule.rb +7 -0
  31. data/lib/puppet/util/execution.rb +14 -1
  32. data/lib/puppet/util/posix.rb +15 -0
  33. data/lib/puppet/util/storage.rb +12 -0
  34. data/lib/puppet/util/windows/adsi.rb +60 -1
  35. data/lib/puppet/util/windows/process.rb +16 -1
  36. data/lib/puppet/util/windows/service.rb +68 -26
  37. data/lib/puppet/version.rb +1 -1
  38. data/lib/puppet_pal.rb +36 -3
  39. data/locales/ja/puppet.po +598 -861
  40. data/locales/puppet.pot +197 -160
  41. data/man/man5/puppet.conf.5 +12 -1
  42. data/man/man8/puppet.8 +1 -1
  43. data/spec/integration/application/apply_spec.rb +4 -1
  44. data/spec/integration/util/windows/adsi_spec.rb +2 -1
  45. data/spec/unit/application/apply_spec.rb +14 -0
  46. data/spec/unit/configurer_spec.rb +11 -0
  47. data/spec/unit/etc_spec.rb +25 -0
  48. data/spec/unit/indirector/catalog/json_spec.rb +9 -3
  49. data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +22 -4
  50. data/spec/unit/pops/loaders/loader_spec.rb +3 -10
  51. data/spec/unit/pops/loaders/loaders_spec.rb +30 -0
  52. data/spec/unit/pops/loaders/module_loaders_spec.rb +7 -7
  53. data/spec/unit/pops/parser/parse_heredoc_spec.rb +16 -0
  54. data/spec/unit/pops/serialization/to_from_hr_spec.rb +9 -0
  55. data/spec/unit/pops/types/task_spec.rb +42 -116
  56. data/spec/unit/provider/group/aix_spec.rb +0 -19
  57. data/spec/unit/provider/group/pw_spec.rb +0 -6
  58. data/spec/unit/provider/group/windows_adsi_spec.rb +34 -35
  59. data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
  60. data/spec/unit/provider/service/launchd_spec.rb +19 -0
  61. data/spec/unit/provider/user/aix_spec.rb +43 -2
  62. data/spec/unit/provider/user/windows_adsi_spec.rb +1 -4
  63. data/spec/unit/puppet_pal_2pec.rb +6 -6
  64. data/spec/unit/puppet_pal_catalog_spec.rb +58 -0
  65. data/spec/unit/task_spec.rb +50 -5
  66. data/spec/unit/type/group_spec.rb +111 -13
  67. data/spec/unit/util/execution_spec.rb +59 -0
  68. data/spec/unit/util/posix_spec.rb +28 -0
  69. data/spec/unit/util/storage_spec.rb +107 -0
  70. data/spec/unit/util/windows/adsi_spec.rb +100 -5
  71. data/spec/unit/util/windows/service_spec.rb +100 -43
  72. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0991274fef10cdfe995d683d07da630726f376137fef5366a1c1b42fa75c913a'
4
- data.tar.gz: 6174a136dbc4d8e42278df142e81f20a13bb8e84eaca148f0af615c94f751c49
3
+ metadata.gz: be99f88ff0b755ce5c710b5f9de4dc1b235f1c964ab08a901c272e79643e32eb
4
+ data.tar.gz: b9848402ab82dba8b0d947384a42fc3dcc1a1ea3548bc397f6c3dbb100d8b674
5
5
  SHA512:
6
- metadata.gz: a979792c136a74d474785751a531cbdda246ba7aec7081a01d68565734e8d3b96a6604fa3ee767de55c90c2a7056134ce782bd48271ca5f73a3109c97abcd538
7
- data.tar.gz: 511c2a81ed85a3e3709520a1f938f5a4f534b1686049cf29002b4dad14df62302892080b3369570c4b80e39109348062dbd08efefc65b7613acef5c1cc323714
6
+ metadata.gz: f853d1ad481fc187d0c4112339381b3e5f6769563881fcaae4730952d54bc122c8b8a488b5e60eebe7fdc2b9d6631f289570e32a2dd1bba3830e0384d0bb117d
7
+ data.tar.gz: 8853306a43e26096d01a8ba5b47918fca570256b62e2dade6360710f41c46814c5cecf676e139a404f956b571ad51fdb33e5e5c30961311a8d82d03a0d2f321c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.0.0)
4
+ puppet (6.0.1)
5
5
  CFPropertyList (~> 2.2)
6
6
  facter (>= 2.0.1, < 4)
7
7
  fast_gettext (~> 1.1.2)
@@ -33,7 +33,7 @@ GEM
33
33
  gettext (>= 3.0.2)
34
34
  locale
35
35
  hashdiff (0.3.7)
36
- hiera (3.4.4)
36
+ hiera (3.4.5.13)
37
37
  hiera-eyaml (2.1.0)
38
38
  highline (~> 1.6.19)
39
39
  trollop (~> 2.0)
@@ -64,7 +64,7 @@ GEM
64
64
  coderay (~> 1.1.0)
65
65
  method_source (~> 0.9.0)
66
66
  public_suffix (3.0.3)
67
- puppet-resource_api (1.5.0)
67
+ puppet-resource_api (1.6.0)
68
68
  hocon (>= 1.0)
69
69
  puppetserver-ca (0.7.0)
70
70
  facter (>= 2.0.1, < 4)
@@ -153,4 +153,4 @@ DEPENDENCIES
153
153
  yard
154
154
 
155
155
  BUNDLED WITH
156
- 1.16.2
156
+ 1.16.5
@@ -173,6 +173,11 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
173
173
  else
174
174
  main
175
175
  end
176
+ ensure
177
+ if @profiler
178
+ Puppet::Util::Profiler.remove_profiler(@profiler)
179
+ @profiler.shutdown
180
+ end
176
181
  end
177
182
 
178
183
  def apply
@@ -189,53 +194,15 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
189
194
  end
190
195
 
191
196
  def main
192
- # Set our code or file to use.
193
- if options[:code] or command_line.args.length == 0
194
- Puppet[:code] = options[:code] || STDIN.read
195
- else
196
- manifest = command_line.args.shift
197
- raise _("Could not find file %{manifest}") % { manifest: manifest } unless Puppet::FileSystem.exist?(manifest)
198
- Puppet.warning(_("Only one file can be applied per run. Skipping %{files}") % { files: command_line.args.join(', ') }) if command_line.args.size > 0
199
- end
200
-
201
- # splay if needed
202
- splay
197
+ manifest = get_manifest() # Get either a manifest or nil if apply should use content of Puppet[:code]
198
+ splay # splay if needed
199
+ facts = get_facts() # facts or nil
200
+ node = get_node() # node or error
201
+ apply_environment = get_configured_environment(node, manifest)
203
202
 
204
- unless Puppet[:node_name_fact].empty?
205
- # Collect our facts.
206
- unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
207
- raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] }
208
- end
209
-
210
- Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
211
- facts.name = Puppet[:node_name_value]
212
- end
213
-
214
- # Find our Node
215
- unless node = Puppet::Node.indirection.find(Puppet[:node_name_value])
216
- raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] }
217
- end
218
-
219
- configured_environment = node.environment || Puppet.lookup(:current_environment)
220
-
221
- apply_environment = manifest ?
222
- configured_environment.override_with(:manifest => manifest) :
223
- configured_environment
224
-
225
- # Modify the node descriptor to use the special apply_environment.
226
- # It is based on the actual environment from the node, or the locally
227
- # configured environment if the node does not specify one.
228
- # If a manifest file is passed on the command line, it overrides
229
- # the :manifest setting of the apply_environment.
230
- node.environment = apply_environment
231
-
232
- #TRANSLATORS "puppet apply" is a program command and should not be translated
203
+ # TRANSLATORS "puppet apply" is a program command and should not be translated
233
204
  Puppet.override({:current_environment => apply_environment}, _("For puppet apply")) do
234
- # Merge in the facts.
235
- node.merge(facts.values) if facts
236
-
237
- # Add server facts so $server_facts[environment] exists when doing a puppet apply
238
- node.add_server_facts({})
205
+ configure_node_facts(node, facts)
239
206
 
240
207
  # Allow users to load the classes that puppet agent creates.
241
208
  if options[:loadclasses]
@@ -287,7 +254,6 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
287
254
  catalog.write_resource_file
288
255
  end
289
256
 
290
- #exit_status = Puppet.override(:loaders => Puppet::Pops::Loaders.new(apply_environment)) { apply_catalog(catalog) }
291
257
  apply_catalog(catalog)
292
258
  end
293
259
  if not exit_status
@@ -302,12 +268,6 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
302
268
  exit(1)
303
269
  end
304
270
  end
305
-
306
- ensure
307
- if @profiler
308
- Puppet::Util::Profiler.remove_profiler(@profiler)
309
- @profiler.shutdown
310
- end
311
271
  end
312
272
 
313
273
  # Enable all of the most common test options.
@@ -350,18 +310,98 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
350
310
  private
351
311
 
352
312
  def read_catalog(text)
353
- format = Puppet::Resource::Catalog.default_format
354
- begin
355
- catalog = Puppet::Resource::Catalog.convert_from(format, text)
356
- rescue => detail
357
- raise Puppet::Error, _("Could not deserialize catalog from %{format}: %{detail}") % { format: format, detail: detail }, detail.backtrace
358
- end
313
+ facts = get_facts()
314
+ node = get_node()
315
+ configured_environment = get_configured_environment(node)
316
+
317
+ # TRANSLATORS "puppet apply" is a program command and should not be translated
318
+ Puppet.override({:current_environment => configured_environment}, _("For puppet apply")) do
319
+ configure_node_facts(node, facts)
320
+
321
+ # NOTE: Does not set rich_data = true automatically (which would ensure always reading catalog with rich data
322
+ # on (seemingly the right thing to do)), but that would remove the ability to test what happens when a
323
+ # rich catalog is processed without rich_data being turned on.
324
+ format = Puppet::Resource::Catalog.default_format
325
+ begin
326
+ catalog = Puppet::Resource::Catalog.convert_from(format, text)
327
+ rescue => detail
328
+ raise Puppet::Error, _("Could not deserialize catalog from %{format}: %{detail}") % { format: format, detail: detail }, detail.backtrace
329
+ end
330
+ # Resolve all deferred values and replace them / mutate the catalog
331
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog)
359
332
 
360
- catalog.to_ral
333
+ catalog.to_ral
334
+ end
361
335
  end
362
336
 
363
337
  def apply_catalog(catalog)
364
338
  configurer = Puppet::Configurer.new
365
339
  configurer.run(:catalog => catalog, :pluginsync => false)
366
340
  end
341
+
342
+ # Returns facts or nil
343
+ #
344
+ def get_facts()
345
+ facts = nil
346
+ unless Puppet[:node_name_fact].empty?
347
+ # Collect our facts.
348
+ unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
349
+ raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] }
350
+ end
351
+
352
+ Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
353
+ facts.name = Puppet[:node_name_value]
354
+ end
355
+ facts
356
+ end
357
+
358
+ # Returns the node or raises and error if node not found.
359
+ #
360
+ def get_node()
361
+ node = Puppet::Node.indirection.find(Puppet[:node_name_value])
362
+ raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] } unless node
363
+ node
364
+ end
365
+
366
+ # Returns either a manifest (filename) or nil if apply should use content of Puppet[:code]
367
+ #
368
+ def get_manifest()
369
+ manifest = nil
370
+ # Set our code or file to use.
371
+ if options[:code] or command_line.args.length == 0
372
+ Puppet[:code] = options[:code] || STDIN.read
373
+ else
374
+ manifest = command_line.args.shift
375
+ raise _("Could not find file %{manifest}") % { manifest: manifest } unless Puppet::FileSystem.exist?(manifest)
376
+ Puppet.warning(_("Only one file can be applied per run. Skipping %{files}") % { files: command_line.args.join(', ') }) if command_line.args.size > 0
377
+ end
378
+ manifest
379
+ end
380
+
381
+ # Returns a configured environment, if a manifest is given it overrides what is configured for the environment
382
+ # specified by the node (or the current_environment found in the Puppet context).
383
+ # The node's resolved environment is modified if needed.
384
+ #
385
+ def get_configured_environment(node, manifest = nil)
386
+ configured_environment = node.environment || Puppet.lookup(:current_environment)
387
+
388
+ apply_environment = manifest ?
389
+ configured_environment.override_with(:manifest => manifest) :
390
+ configured_environment
391
+
392
+ # Modify the node descriptor to use the special apply_environment.
393
+ # It is based on the actual environment from the node, or the locally
394
+ # configured environment if the node does not specify one.
395
+ # If a manifest file is passed on the command line, it overrides
396
+ # the :manifest setting of the apply_environment.
397
+ node.environment = apply_environment
398
+ apply_environment
399
+ end
400
+
401
+ # Mixes the facts into the node, and mixes in server facts
402
+ def configure_node_facts(node, facts)
403
+ node.merge(facts.values) if facts
404
+ # Add server facts so $server_facts[environment] exists when doing a puppet apply
405
+ node.add_server_facts({})
406
+ end
367
407
  end
@@ -2,102 +2,6 @@ require 'puppet/application'
2
2
 
3
3
  class Puppet::Application::Cert < Puppet::Application
4
4
 
5
- run_mode :master
6
-
7
- attr_accessor :all, :ca, :digest, :signed
8
-
9
- def subcommand
10
- @subcommand
11
- end
12
-
13
- def subcommand=(name)
14
- # Handle the nasty, legacy mapping of "clean" to "destroy".
15
- sub = name.to_sym
16
- @subcommand = (sub == :clean ? :destroy : sub)
17
- end
18
-
19
- option("--clean", "-c") do |arg|
20
- self.subcommand = "destroy"
21
- end
22
-
23
- option("--all", "-a") do |arg|
24
- @all = true
25
- end
26
-
27
- option("--digest DIGEST") do |arg|
28
- @digest = arg
29
- end
30
-
31
- option("--signed", "-s") do |arg|
32
- @signed = true
33
- end
34
-
35
- option("--debug", "-d") do |arg|
36
- options[:debug] = true
37
- set_log_level
38
- end
39
-
40
- option("--list", "-l") do |arg|
41
- self.subcommand = :list
42
- end
43
-
44
- option("--revoke", "-r") do |arg|
45
- self.subcommand = :revoke
46
- end
47
-
48
- option("--generate", "-g") do |arg|
49
- self.subcommand = :generate
50
- end
51
-
52
- option("--sign", "-s") do |arg|
53
- self.subcommand = :sign
54
- end
55
-
56
- option("--print", "-p") do |arg|
57
- self.subcommand = :print
58
- end
59
-
60
- option("--verify", "-v") do |arg|
61
- self.subcommand = :verify
62
- end
63
-
64
- option("--fingerprint", "-f") do |arg|
65
- self.subcommand = :fingerprint
66
- end
67
-
68
- option("--reinventory") do |arg|
69
- self.subcommand = :reinventory
70
- end
71
-
72
- option("--[no-]allow-dns-alt-names") do |value|
73
- options[:allow_dns_alt_names] = value
74
- end
75
-
76
- option("--[no-]allow-authorization-extensions") do |value|
77
- options[:allow_authorization_extensions] = value
78
- end
79
-
80
- option("--verbose", "-v") do |arg|
81
- options[:verbose] = true
82
- set_log_level
83
- end
84
-
85
- option("--human-readable", "-H") do |arg|
86
- options[:format] = :human
87
- end
88
-
89
- option("--machine-readable", "-m") do |arg|
90
- options[:format] = :machine
91
- end
92
-
93
- option("--interactive", "-i") do |arg|
94
- options[:interactive] = true
95
- end
96
-
97
- option("--assume-yes", "-y") do |arg|
98
- options[:yes] = true
99
- end
100
-
101
5
  def summary
102
6
  _("Manage certificates and requests (Disabled)")
103
7
  end
@@ -161,26 +65,12 @@ There are a couple important notes about previously-supported options.
161
65
  HELP
162
66
  end
163
67
 
164
- def main
165
- help
166
- end
167
-
168
68
  def setup
169
69
  deprecate
170
70
  end
171
71
 
172
72
  def parse_options
173
- # handle the bareword subcommand pattern.
174
- result = super
175
- unless self.subcommand then
176
- if sub = self.command_line.args.shift then
177
- self.subcommand = sub
178
- else
179
- puts help
180
- exit
181
- end
182
- end
183
-
184
- result
73
+ puts help
74
+ exit 1
185
75
  end
186
76
  end
@@ -16,7 +16,7 @@ class Puppet::Configurer
16
16
  # For benchmarking
17
17
  include Puppet::Util
18
18
 
19
- attr_reader :compile_time, :environment
19
+ attr_reader :environment
20
20
 
21
21
  # Provide more helpful strings to the logging that the Agent does
22
22
  def self.to_s
@@ -42,7 +42,6 @@ class Puppet::Configurer
42
42
  # Initialize and load storage
43
43
  def init_storage
44
44
  Puppet::Util::Storage.load
45
- @compile_time ||= Puppet::Util::Storage.cache(:configuration)[:compile_time]
46
45
  rescue => detail
47
46
  Puppet.log_exception(detail, _("Removing corrupt state file %{file}: %{detail}") % { file: Puppet[:statefile], detail: detail })
48
47
  begin
@@ -397,7 +396,7 @@ class Puppet::Configurer
397
396
  port = server[1] || Puppet[:masterport]
398
397
  begin
399
398
  http = Puppet::Network::HttpPool.http_ssl_instance(host, port)
400
- response = http.get('/status/v1/simple')
399
+ response = http.get('/status/v1/simple/master')
401
400
  return [host, port] if response.is_a?(Net::HTTPOK)
402
401
 
403
402
  Puppet.debug(_("Puppet server %{host}:%{port} is unavailable: %{code} %{reason}") %
@@ -1410,7 +1410,20 @@ EOT
1410
1410
  with the running configuration. In the case of puppet master,
1411
1411
  this file reflects the state discovered through interacting
1412
1412
  with clients."
1413
- },
1413
+ },
1414
+ :statettl => {
1415
+ :default => "32d",
1416
+ :type => :ttl,
1417
+ :desc => "How long the Puppet agent should cache when a resource was last checked or synced.
1418
+ #{AS_DURATION}
1419
+ A value of `0` or `unlimited` will disable cache pruning.
1420
+
1421
+ This setting affects the usage of `schedule` resources, as the information
1422
+ about when a resource was last checked (and therefore when it needs to be
1423
+ checked again) is stored in the `statefile`. The `statettl` needs to be
1424
+ large enough to ensure that a resource will not trigger multiple times
1425
+ during a schedule due to its entry expiring from the cache."
1426
+ },
1414
1427
  :transactionstorefile => {
1415
1428
  :default => "$statedir/transactionstore.yaml",
1416
1429
  :type => :file,
data/lib/puppet/etc.rb CHANGED
@@ -103,6 +103,26 @@ module Puppet::Etc
103
103
  override_field_values_to_utf8(::Etc.getpwuid(id))
104
104
  end
105
105
 
106
+ # Etc::group returns a Ruby iterator that executes a block for
107
+ # each entry in the /etc/group file. The code-block is passed
108
+ # a Group struct. See getgrent above for more details.
109
+ def group
110
+ # The implementation here duplicates the logic in https://github.com/ruby/etc/blob/master/ext/etc/etc.c#L523-L537
111
+ # Note that we do not call ::Etc.group directly, because we
112
+ # want to use our wrappers for methods like getgrent, setgrent,
113
+ # endgrent, etc.
114
+ return getgrent unless block_given?
115
+
116
+ setgrent
117
+ begin
118
+ while cur_group = getgrent
119
+ yield cur_group
120
+ end
121
+ ensure
122
+ endgrent
123
+ end
124
+ end
125
+
106
126
  private
107
127
 
108
128
  # @api private