puppet 5.5.6 → 5.5.7

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +12 -12
  4. data/Rakefile +9 -0
  5. data/lib/puppet/application.rb +5 -0
  6. data/lib/puppet/application/apply.rb +1 -0
  7. data/lib/puppet/application/master.rb +9 -7
  8. data/lib/puppet/application/script.rb +1 -1
  9. data/lib/puppet/defaults.rb +51 -31
  10. data/lib/puppet/etc.rb +20 -0
  11. data/lib/puppet/file_serving/fileset.rb +1 -1
  12. data/lib/puppet/functions.rb +123 -0
  13. data/lib/puppet/functions/new.rb +37 -53
  14. data/lib/puppet/functions/warning.rb +1 -1
  15. data/lib/puppet/loaders.rb +1 -0
  16. data/lib/puppet/parser/functions.rb +3 -1
  17. data/lib/puppet/parser/functions/sprintf.rb +12 -1
  18. data/lib/puppet/pops/evaluator/runtime3_converter.rb +16 -0
  19. data/lib/puppet/pops/evaluator/runtime3_support.rb +3 -4
  20. data/lib/puppet/pops/issues.rb +8 -0
  21. data/lib/puppet/pops/loader/loader.rb +2 -2
  22. data/lib/puppet/pops/loader/loader_paths.rb +3 -1
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +62 -0
  25. data/lib/puppet/pops/loaders.rb +5 -21
  26. data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
  27. data/lib/puppet/pops/parser/lexer2.rb +1 -1
  28. data/lib/puppet/pops/validation/checker4_0.rb +31 -6
  29. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
  30. data/lib/puppet/property/keyvalue.rb +70 -8
  31. data/lib/puppet/provider/aix_object.rb +483 -0
  32. data/lib/puppet/provider/exec.rb +54 -57
  33. data/lib/puppet/provider/group/aix.rb +40 -115
  34. data/lib/puppet/provider/group/pw.rb +4 -8
  35. data/lib/puppet/provider/group/windows_adsi.rb +7 -4
  36. data/lib/puppet/provider/nameservice.rb +1 -25
  37. data/lib/puppet/provider/nameservice/directoryservice.rb +5 -3
  38. data/lib/puppet/provider/package/portage.rb +2 -2
  39. data/lib/puppet/provider/package/windows.rb +2 -2
  40. data/lib/puppet/provider/package/windows/exe_package.rb +3 -10
  41. data/lib/puppet/provider/package/zypper.rb +1 -1
  42. data/lib/puppet/provider/service/launchd.rb +19 -3
  43. data/lib/puppet/provider/service/windows.rb +49 -40
  44. data/lib/puppet/provider/user/aix.rb +180 -246
  45. data/lib/puppet/provider/user/windows_adsi.rb +9 -1
  46. data/lib/puppet/resource/catalog.rb +1 -5
  47. data/lib/puppet/type/augeas.rb +1 -1
  48. data/lib/puppet/type/exec.rb +16 -14
  49. data/lib/puppet/type/file.rb +2 -2
  50. data/lib/puppet/type/file/source.rb +9 -5
  51. data/lib/puppet/type/group.rb +65 -23
  52. data/lib/puppet/type/k5login.rb +2 -2
  53. data/lib/puppet/type/notify.rb +1 -1
  54. data/lib/puppet/type/package.rb +3 -6
  55. data/lib/puppet/type/resources.rb +12 -2
  56. data/lib/puppet/type/schedule.rb +8 -1
  57. data/lib/puppet/type/selboolean.rb +2 -2
  58. data/lib/puppet/type/selmodule.rb +3 -4
  59. data/lib/puppet/type/service.rb +2 -5
  60. data/lib/puppet/type/tidy.rb +1 -1
  61. data/lib/puppet/type/user.rb +15 -20
  62. data/lib/puppet/type/yumrepo.rb +2 -2
  63. data/lib/puppet/type/zone.rb +2 -2
  64. data/lib/puppet/util.rb +7 -3
  65. data/lib/puppet/util/execution.rb +15 -1
  66. data/lib/puppet/util/posix.rb +15 -0
  67. data/lib/puppet/util/storage.rb +12 -0
  68. data/lib/puppet/util/windows.rb +4 -2
  69. data/lib/puppet/util/windows/adsi.rb +235 -205
  70. data/lib/puppet/util/windows/process.rb +23 -3
  71. data/lib/puppet/util/windows/security.rb +14 -0
  72. data/lib/puppet/util/windows/service.rb +977 -0
  73. data/lib/puppet/util/windows/user.rb +3 -5
  74. data/lib/puppet/version.rb +1 -1
  75. data/locales/ja/puppet.po +705 -374
  76. data/locales/puppet.pot +485 -261
  77. data/man/man5/puppet.conf.5 +36 -15
  78. data/man/man8/puppet-agent.8 +1 -1
  79. data/man/man8/puppet-apply.8 +1 -1
  80. data/man/man8/puppet-ca.8 +1 -1
  81. data/man/man8/puppet-catalog.8 +1 -1
  82. data/man/man8/puppet-cert.8 +1 -1
  83. data/man/man8/puppet-certificate.8 +1 -1
  84. data/man/man8/puppet-certificate_request.8 +1 -1
  85. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  86. data/man/man8/puppet-config.8 +1 -1
  87. data/man/man8/puppet-describe.8 +1 -1
  88. data/man/man8/puppet-device.8 +1 -1
  89. data/man/man8/puppet-doc.8 +1 -1
  90. data/man/man8/puppet-epp.8 +1 -1
  91. data/man/man8/puppet-facts.8 +1 -1
  92. data/man/man8/puppet-filebucket.8 +1 -1
  93. data/man/man8/puppet-generate.8 +1 -1
  94. data/man/man8/puppet-help.8 +1 -1
  95. data/man/man8/puppet-key.8 +1 -1
  96. data/man/man8/puppet-lookup.8 +1 -1
  97. data/man/man8/puppet-man.8 +1 -1
  98. data/man/man8/puppet-master.8 +1 -1
  99. data/man/man8/puppet-module.8 +1 -1
  100. data/man/man8/puppet-node.8 +1 -1
  101. data/man/man8/puppet-parser.8 +1 -1
  102. data/man/man8/puppet-plugin.8 +1 -1
  103. data/man/man8/puppet-report.8 +1 -1
  104. data/man/man8/puppet-resource.8 +1 -1
  105. data/man/man8/puppet-script.8 +1 -1
  106. data/man/man8/puppet-status.8 +1 -1
  107. data/man/man8/puppet.8 +2 -2
  108. data/spec/fixtures/unit/provider/aix_object/aix_colon_list_real_world_input.out +1 -0
  109. data/spec/fixtures/unit/provider/aix_object/aix_colon_list_real_world_output.out +1 -0
  110. data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +32 -0
  111. data/spec/integration/parser/collection_spec.rb +4 -8
  112. data/spec/integration/provider/service/windows_spec.rb +5 -5
  113. data/spec/integration/type/file_spec.rb +6 -6
  114. data/spec/integration/util/windows/adsi_spec.rb +6 -5
  115. data/spec/integration/util/windows/security_spec.rb +10 -7
  116. data/spec/integration/util/windows/user_spec.rb +37 -17
  117. data/spec/spec_helper.rb +0 -1
  118. data/spec/unit/application/apply_spec.rb +41 -2
  119. data/spec/unit/application/master_spec.rb +7 -0
  120. data/spec/unit/application_spec.rb +21 -3
  121. data/spec/unit/defaults_spec.rb +20 -0
  122. data/spec/unit/etc_spec.rb +25 -0
  123. data/spec/unit/file_serving/fileset_spec.rb +11 -11
  124. data/spec/unit/gettext/config_spec.rb +1 -1
  125. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +6 -6
  126. data/spec/unit/pops/loaders/loaders_spec.rb +40 -7
  127. data/spec/unit/pops/parser/parse_heredoc_spec.rb +16 -0
  128. data/spec/unit/pops/validator/validator_spec.rb +129 -10
  129. data/spec/unit/property/keyvalue_spec.rb +97 -6
  130. data/spec/unit/provider/aix_object_spec.rb +805 -0
  131. data/spec/unit/provider/group/aix_spec.rb +57 -0
  132. data/spec/unit/provider/group/pw_spec.rb +0 -6
  133. data/spec/unit/provider/group/windows_adsi_spec.rb +34 -35
  134. data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
  135. data/spec/unit/provider/package/windows/exe_package_spec.rb +3 -3
  136. data/spec/unit/provider/package/windows_spec.rb +4 -4
  137. data/spec/unit/provider/service/launchd_spec.rb +19 -0
  138. data/spec/unit/provider/service/windows_spec.rb +71 -78
  139. data/spec/unit/provider/user/aix_spec.rb +162 -116
  140. data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
  141. data/spec/unit/resource/catalog_spec.rb +2 -2
  142. data/spec/unit/ssl/certificate_authority_spec.rb +0 -1
  143. data/spec/unit/type/group_spec.rb +111 -13
  144. data/spec/unit/type/resources_spec.rb +18 -0
  145. data/spec/unit/util/execution_spec.rb +77 -0
  146. data/spec/unit/util/posix_spec.rb +28 -0
  147. data/spec/unit/util/storage_spec.rb +107 -0
  148. data/spec/unit/util/windows/adsi_spec.rb +108 -13
  149. data/spec/unit/util/windows/service_spec.rb +669 -0
  150. metadata +17 -5
  151. data/lib/puppet/provider/aixobject.rb +0 -392
  152. data/spec/unit/provider/aixobject_spec.rb +0 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5a7778617cb9cf5d0e6be73d57897e99c96a12505557b39f042b16f02b168bf
4
- data.tar.gz: 17f9b2b1f7318506ad5923a57c663d4d396cff2d9793110072dec9605cfa9499
3
+ metadata.gz: 0cceb57d43e4649d9d87857816df85b524c45d3004bb5a969d60d4de64b404e6
4
+ data.tar.gz: 280065891b1ef83fab160ab18b617bf8a887ccb57071279397f64c8078b4c5f9
5
5
  SHA512:
6
- metadata.gz: b653525202e2b80017a4fff320af1fa2b61000f313eed564174039329b775194cea7f0cd309185091ff8a9478fbd65bbbad98544bda766e907ef0e5721836956
7
- data.tar.gz: dac01b8c243998b1a03618bb8b8c3cf0978daeef463f94f307f86ed1b4be20bfaf743554eefe66a9ae5d6873a6474b8b6ab9fdeb4bb48f4f6ca073cf0e73f9eb
6
+ metadata.gz: e25e640aad21a48ba030c166014d555394ac225131d01c49817ca28c5534153d795ae2b58f53632a2e373742eaa13ca11c88ed0614787da6343fdb73dfa4c330
7
+ data.tar.gz: 4d3749159a0a3ce8db3913f269d3ad9d219f511e57d887c06a4a1dce4887697c0cb1184546958d9e1a4aed940c01cef73b193757ce3d5186d32aebc15111a7cc
data/Gemfile CHANGED
@@ -39,7 +39,9 @@ group(:development, :test) do
39
39
  # be removed here *yet* due to TravisCI / AppVeyor which call:
40
40
  # bundle install --without development
41
41
  # PUP-7433 describes work necessary to restructure this
42
- gem "rake", '~> 12.2.1', :require => false
42
+ gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 12.2.1') if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
43
+ gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 12.2') if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.0.0') # rubocop:disable Bundler/DuplicatedGem
44
+
43
45
  gem "rspec", "~> 3.1", :require => false
44
46
  gem "rspec-its", "~> 1.1", :require => false
45
47
  gem "rspec-collection_matchers", "~> 1.1", :require => false
@@ -33,28 +33,28 @@ GEM
33
33
  gettext (>= 3.0.2)
34
34
  locale
35
35
  hashdiff (0.3.7)
36
- hiera (3.4.3)
36
+ hiera (3.4.5.13)
37
37
  hiera-eyaml (2.1.0)
38
38
  highline (~> 1.6.19)
39
39
  trollop (~> 2.0)
40
40
  highline (1.6.21)
41
41
  hocon (1.2.5)
42
42
  hpricot (0.8.6)
43
- json-schema (2.8.0)
43
+ json-schema (2.8.1)
44
44
  addressable (>= 2.4)
45
45
  locale (2.1.2)
46
- memory_profiler (0.9.11)
46
+ memory_profiler (0.9.12)
47
47
  metaclass (0.0.4)
48
48
  method_source (0.9.0)
49
49
  mocha (0.10.5)
50
50
  metaclass (~> 0.0.1)
51
51
  msgpack (1.2.4)
52
52
  multi_json (1.13.1)
53
- mustache (1.0.5)
53
+ mustache (1.1.0)
54
54
  net-ssh (4.2.0)
55
- packaging (0.99.8)
55
+ packaging (0.99.14)
56
56
  artifactory
57
- rake (~> 12.2.1)
57
+ rake (~> 12.3)
58
58
  parallel (1.12.1)
59
59
  parser (2.5.1.2)
60
60
  ast (~> 2.4.0)
@@ -74,7 +74,7 @@ GEM
74
74
  racc (1.4.9)
75
75
  rack (1.6.10)
76
76
  rainbow (2.1.0)
77
- rake (12.2.1)
77
+ rake (12.3.1)
78
78
  rdiscount (2.2.0.1)
79
79
  rdoc (4.3.0)
80
80
  redcarpet (2.3.0)
@@ -90,7 +90,7 @@ GEM
90
90
  rspec-expectations (>= 2.99.0.beta1)
91
91
  rspec-core (3.8.0)
92
92
  rspec-support (~> 3.8.0)
93
- rspec-expectations (3.8.1)
93
+ rspec-expectations (3.8.2)
94
94
  diff-lcs (>= 1.2.0, < 2.0)
95
95
  rspec-support (~> 3.8.0)
96
96
  rspec-its (1.2.0)
@@ -101,7 +101,7 @@ GEM
101
101
  rspec-mocks (3.8.0)
102
102
  diff-lcs (>= 1.2.0, < 2.0)
103
103
  rspec-support (~> 3.8.0)
104
- rspec-puppet (2.6.15)
104
+ rspec-puppet (2.7.1)
105
105
  rspec
106
106
  rspec-support (3.8.0)
107
107
  rubocop (0.49.1)
@@ -117,7 +117,7 @@ GEM
117
117
  ruby-progressbar (1.10.0)
118
118
  safe_yaml (1.0.4)
119
119
  text (1.3.1)
120
- trollop (2.1.3)
120
+ trollop (2.9.9)
121
121
  unicode-display_width (1.4.0)
122
122
  vcr (2.9.3)
123
123
  webmock (1.24.6)
@@ -147,7 +147,7 @@ DEPENDENCIES
147
147
  racc (= 1.4.9)
148
148
  rack (~> 1.4)
149
149
  rainbow (< 2.2.1)
150
- rake (~> 12.2.1)
150
+ rake (~> 12.2)
151
151
  rdoc (~> 4.1)
152
152
  redcarpet (~> 2.0)
153
153
  ronn (~> 0.7.3)
@@ -164,4 +164,4 @@ DEPENDENCIES
164
164
  yarjuf (~> 2.0)
165
165
 
166
166
  BUNDLED WITH
167
- 1.16.2
167
+ 1.16.5
data/Rakefile CHANGED
@@ -30,6 +30,15 @@ rescue LoadError => e
30
30
  puts "Error loading packaging rake tasks: #{e}"
31
31
  end
32
32
 
33
+ namespace :package do
34
+ task :bootstrap do
35
+ puts 'Bootstrap is no longer needed, using packaging-as-a-gem'
36
+ end
37
+ task :implode do
38
+ puts 'Implode is no longer needed, using packaging-as-a-gem'
39
+ end
40
+ end
41
+
33
42
  task :default do
34
43
  sh %{rake -T}
35
44
  end
@@ -388,6 +388,8 @@ class Application
388
388
  end
389
389
 
390
390
  def setup_logs
391
+ handle_logdest_arg(Puppet[:logdest])
392
+
391
393
  unless options[:setdest]
392
394
  if options[:debug] || options[:verbose]
393
395
  Puppet::Util::Log.newdestination(:console)
@@ -409,7 +411,10 @@ class Application
409
411
  end
410
412
 
411
413
  def handle_logdest_arg(arg)
414
+ return if options[:setdest] || arg.nil?
415
+
412
416
  begin
417
+ Puppet[:logdest] = arg
413
418
  Puppet::Util::Log.newdestination(arg)
414
419
  options[:setdest] = true
415
420
  rescue => detail
@@ -312,6 +312,7 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
312
312
 
313
313
  exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
314
314
 
315
+ handle_logdest_arg(Puppet[:logdest])
315
316
  Puppet::Util::Log.newdestination(:console) unless options[:setdest]
316
317
 
317
318
  Signal.trap(:INT) do
@@ -211,20 +211,22 @@ Copyright (c) 2012 Puppet Inc., LLC Licensed under the Apache 2.0 License
211
211
 
212
212
  def setup_logs
213
213
  set_log_level
214
+ handle_logdest_arg(Puppet[:logdest])
214
215
 
215
- if !options[:setdest]
216
+ unless options[:setdest]
216
217
  if options[:node]
217
- # We are compiling a catalog for a single node with '--compile' and logging
218
- # has not already been configured via '--logdest' so log to the console.
218
+ # We are compiling a catalog for a single node with '--compile' and a
219
+ # logging destination has not already been explicitly specified.
219
220
  Puppet::Util::Log.newdestination(:console)
220
221
  elsif !(Puppet[:daemonize] or options[:rack])
221
222
  # We are running a webrick master which has been explicitly foregrounded
222
- # and '--logdest' has not been passed, assume users want to see logging
223
- # and log to the console.
223
+ # and a logging destination has not already been explicitly specified,
224
+ # assume users want to see logging and log to the console.
224
225
  Puppet::Util::Log.newdestination(:console)
225
226
  else
226
- # No explicit log destination has been given with '--logdest' and we're
227
- # either a daemonized webrick master or running under rack, log to syslog.
227
+ # No explicit log destination has been given with '--logdest', or via settings,
228
+ # and we're either a daemonized webrick master or running under rack, log to
229
+ # syslog.
228
230
  Puppet::Util::Log.newdestination(:syslog)
229
231
  end
230
232
  end
@@ -229,9 +229,9 @@ Copyright (c) 2017 Puppet Inc., LLC Licensed under the Apache 2.0 License
229
229
  end
230
230
 
231
231
  def setup
232
-
233
232
  exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
234
233
 
234
+ handle_logdest_arg(Puppet[:logdest])
235
235
  Puppet::Util::Log.newdestination(:console) unless options[:setdest]
236
236
 
237
237
  Signal.trap(:INT) do
@@ -974,6 +974,15 @@ EOT
974
974
  }
975
975
  end
976
976
  end
977
+ },
978
+ :logdest => {
979
+ :type => :string,
980
+ :desc => "Where to send log messages. Choose between 'syslog' (the POSIX syslog
981
+ service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
982
+ file."
983
+ # Sure would be nice to set the Puppet::Util::Log destination here in an :on_initialize_and_write hook,
984
+ # unfortunately we have a large number of tests that rely on the logging not resetting itself when the
985
+ # settings are initialized as they test what gets logged during settings initialization.
977
986
  }
978
987
  )
979
988
 
@@ -981,8 +990,7 @@ EOT
981
990
  :ca,
982
991
  :ca_name => {
983
992
  :default => "Puppet CA: $certname",
984
- :desc => "The name to use the Certificate Authority certificate. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
985
- :deprecated => :completely,
993
+ :desc => "The name to use the Certificate Authority certificate.",
986
994
  },
987
995
  :cadir => {
988
996
  :default => "$ssldir/ca",
@@ -990,8 +998,7 @@ EOT
990
998
  :owner => "service",
991
999
  :group => "service",
992
1000
  :mode => "0755",
993
- :desc => "The root directory for the certificate authority. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
994
- :deprecated => :completely,
1001
+ :desc => "The root directory for the certificate authority.",
995
1002
  },
996
1003
  :cacert => {
997
1004
  :default => "$cadir/ca_crt.pem",
@@ -999,8 +1006,7 @@ EOT
999
1006
  :owner => "service",
1000
1007
  :group => "service",
1001
1008
  :mode => "0644",
1002
- :desc => "The CA certificate. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1003
- :deprecated => :completely,
1009
+ :desc => "The CA certificate.",
1004
1010
  },
1005
1011
  :cakey => {
1006
1012
  :default => "$cadir/ca_key.pem",
@@ -1008,8 +1014,7 @@ EOT
1008
1014
  :owner => "service",
1009
1015
  :group => "service",
1010
1016
  :mode => "0640",
1011
- :desc => "The CA private key. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1012
- :deprecated => :completely,
1017
+ :desc => "The CA private key.",
1013
1018
  },
1014
1019
  :capub => {
1015
1020
  :default => "$cadir/ca_pub.pem",
@@ -1017,8 +1022,7 @@ EOT
1017
1022
  :owner => "service",
1018
1023
  :group => "service",
1019
1024
  :mode => "0644",
1020
- :desc => "The CA public key. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1021
- :deprecated => :completely,
1025
+ :desc => "The CA public key.",
1022
1026
  },
1023
1027
  :cacrl => {
1024
1028
  :default => "$cadir/ca_crl.pem",
@@ -1026,8 +1030,7 @@ EOT
1026
1030
  :owner => "service",
1027
1031
  :group => "service",
1028
1032
  :mode => "0644",
1029
- :desc => "The certificate revocation list (CRL) for the CA. Will be used if present but otherwise ignored. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1030
- :deprecated => :completely,
1033
+ :desc => "The certificate revocation list (CRL) for the CA. Will be used if present but otherwise ignored.",
1031
1034
  },
1032
1035
  :caprivatedir => {
1033
1036
  :default => "$cadir/private",
@@ -1036,7 +1039,9 @@ EOT
1036
1039
  :group => "service",
1037
1040
  :mode => "0750",
1038
1041
  :desc => "Where the CA stores private certificate information. This setting is deprecated and will be removed in Puppet 6.",
1039
- :deprecated => :completely,
1042
+ :hook => proc do |value|
1043
+ Puppet.deprecation_warning(_("The 'caprivatedir' setting is deprecated and will be removed in Puppet 6."))
1044
+ end,
1040
1045
  },
1041
1046
  :csrdir => {
1042
1047
  :default => "$cadir/requests",
@@ -1044,8 +1049,7 @@ EOT
1044
1049
  :owner => "service",
1045
1050
  :group => "service",
1046
1051
  :mode => "0755",
1047
- :desc => "Where the CA stores certificate requests. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1048
- :deprecated => :completely,
1052
+ :desc => "Where the CA stores certificate requests.",
1049
1053
  },
1050
1054
  :signeddir => {
1051
1055
  :default => "$cadir/signed",
@@ -1053,8 +1057,7 @@ EOT
1053
1057
  :owner => "service",
1054
1058
  :group => "service",
1055
1059
  :mode => "0755",
1056
- :desc => "Where the CA stores signed certificates. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1057
- :deprecated => :completely,
1060
+ :desc => "Where the CA stores signed certificates.",
1058
1061
  },
1059
1062
  :capass => {
1060
1063
  :default => "$caprivatedir/ca.pass",
@@ -1063,7 +1066,9 @@ EOT
1063
1066
  :group => "service",
1064
1067
  :mode => "0640",
1065
1068
  :desc => "Where the CA stores the password for the private key. This setting is deprecated and will be removed in Puppet 6.",
1066
- :deprecated => :completely,
1069
+ :hook => proc do |value|
1070
+ Puppet.deprecation_warning(_("The 'caprivatedir' setting is deprecated and will be removed in Puppet 6."))
1071
+ end,
1067
1072
  },
1068
1073
  :serial => {
1069
1074
  :default => "$cadir/serial",
@@ -1071,17 +1076,13 @@ EOT
1071
1076
  :owner => "service",
1072
1077
  :group => "service",
1073
1078
  :mode => "0644",
1074
- :desc => "Where the serial number for certificates is stored. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1075
- :deprecated => :completely,
1079
+ :desc => "Where the serial number for certificates is stored.",
1076
1080
  },
1077
1081
  :autosign => {
1078
1082
  :default => "$confdir/autosign.conf",
1079
1083
  :type => :autosign,
1080
- :deprecated => :completely,
1081
1084
  :desc => "Whether (and how) to autosign certificate requests. This setting
1082
1085
  is only relevant on a puppet master acting as a certificate authority (CA).
1083
- This setting is also deprecated and will be replaced by one in Puppet Server's
1084
- configs in Puppet 6.
1085
1086
 
1086
1087
  Valid values are true (autosigns all certificate requests; not recommended),
1087
1088
  false (disables autosigning certificates), or the absolute path to a file.
@@ -1108,15 +1109,13 @@ EOT
1108
1109
  :allow_duplicate_certs => {
1109
1110
  :default => false,
1110
1111
  :type => :boolean,
1111
- :desc => "Whether to allow a new certificate request to overwrite an existing certificate. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1112
- :deprecated => :completely,
1112
+ :desc => "Whether to allow a new certificate request to overwrite an existing certificate.",
1113
1113
  },
1114
1114
  :ca_ttl => {
1115
1115
  :default => "5y",
1116
1116
  :type => :duration,
1117
1117
  :desc => "The default TTL for new certificates.
1118
- #{AS_DURATION} This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1119
- :deprecated => :completely,
1118
+ #{AS_DURATION}",
1120
1119
  },
1121
1120
  :keylength => {
1122
1121
  :default => 4096,
@@ -1129,8 +1128,7 @@ EOT
1129
1128
  :owner => "service",
1130
1129
  :group => "service",
1131
1130
  :desc => "The inventory file. This is a text file to which the CA writes a
1132
- complete listing of all certificates. This setting is deprecated and will be replaced by one in Puppet Server's configs in Puppet 6.",
1133
- :deprecated => :completely,
1131
+ complete listing of all certificates.",
1134
1132
  }
1135
1133
  )
1136
1134
 
@@ -1464,7 +1462,20 @@ EOT
1464
1462
  with the running configuration. In the case of puppet master,
1465
1463
  this file reflects the state discovered through interacting
1466
1464
  with clients."
1467
- },
1465
+ },
1466
+ :statettl => {
1467
+ :default => "32d",
1468
+ :type => :ttl,
1469
+ :desc => "How long the Puppet agent should cache when a resource was last checked or synced.
1470
+ #{AS_DURATION}
1471
+ A value of `0` or `unlimited` will disable cache pruning.
1472
+
1473
+ This setting affects the usage of `schedule` resources, as the information
1474
+ about when a resource was last checked (and therefore when it needs to be
1475
+ checked again) is stored in the `statefile`. The `statettl` needs to be
1476
+ large enough to ensure that a resource will not trigger multiple times
1477
+ during a schedule due to its entry expiring from the cache."
1478
+ },
1468
1479
  :transactionstorefile => {
1469
1480
  :default => "$statedir/transactionstore.yaml",
1470
1481
  :type => :file,
@@ -1805,7 +1816,16 @@ EOT
1805
1816
  Regardless of this setting's value, Puppet will always obey explicit
1806
1817
  dependencies set with the before/require/notify/subscribe metaparameters
1807
1818
  and the `->`/`~>` chaining arrows; this setting only affects the relative
1808
- ordering of _unrelated_ resources."
1819
+ ordering of _unrelated_ resources.
1820
+
1821
+ This setting is deprecated, and will always have a value of `manifest` in
1822
+ 6.0 and up.",
1823
+ :call_hook => :on_initialize_and_write,
1824
+ :hook => proc { |value|
1825
+ if value != "manifest"
1826
+ Puppet.deprecation_warning(_('Setting %{name} is deprecated.') % { name: 'ordering' }, 'setting-ordering')
1827
+ end
1828
+ }
1809
1829
  }
1810
1830
  )
1811
1831
 
@@ -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
@@ -122,7 +122,7 @@ class Puppet::FileServing::Fileset
122
122
  def children
123
123
  return [] unless directory?
124
124
 
125
- Dir.entries(path).
125
+ Dir.entries(path, encoding: Encoding::UTF_8).
126
126
  reject { |child| ignore?(child) }.
127
127
  collect { |child| down_level(child) }
128
128
  end
@@ -385,6 +385,7 @@ module Puppet::Functions
385
385
  end
386
386
  end
387
387
 
388
+
388
389
  # Public api methods of the DispatcherBuilder are available within dispatch()
389
390
  # blocks declared in a Puppet::Function.create_function() call.
390
391
  #
@@ -679,6 +680,128 @@ module Puppet::Functions
679
680
  end
680
681
  end
681
682
 
683
+ class Function3x < InternalFunction
684
+
685
+ # Table of optimized parameter names - 0 to 5 parameters
686
+ PARAM_NAMES = [
687
+ [],
688
+ ['p0'.freeze].freeze,
689
+ ['p0'.freeze, 'p1'.freeze].freeze,
690
+ ['p0'.freeze, 'p1'.freeze, 'p2'.freeze].freeze,
691
+ ['p0'.freeze, 'p1'.freeze, 'p2'.freeze, 'p3'.freeze].freeze,
692
+ ['p0'.freeze, 'p1'.freeze, 'p2'.freeze, 'p3'.freeze, 'p4'.freeze].freeze,
693
+ ]
694
+
695
+ # Creates an anonymous Function3x class that wraps a 3x function
696
+ #
697
+ # @api private
698
+ def self.create_function(func_name, func_info, loader)
699
+ func_name = func_name.to_s
700
+
701
+ # Creates an anonymous class to represent the function
702
+ # The idea being that it is garbage collected when there are no more
703
+ # references to it.
704
+ #
705
+ # (Do not give the class the block here, as instance variables should be set first)
706
+ the_class = Class.new(Function3x)
707
+
708
+ unless loader.nil?
709
+ the_class.instance_variable_set(:'@loader', loader.private_loader)
710
+ end
711
+
712
+ the_class.instance_variable_set(:'@func_name', func_name)
713
+ the_class.instance_variable_set(:'@method3x', :"function_#{func_name}")
714
+
715
+ # Make the anonymous class appear to have the class-name <func_name>
716
+ # Even if this class is not bound to such a symbol in a global ruby scope and
717
+ # must be resolved via the loader.
718
+ # This also overrides any attempt to define a name method in the given block
719
+ # (Since it redefines it)
720
+ #
721
+ the_class.instance_eval do
722
+ def name
723
+ @func_name
724
+ end
725
+
726
+ def loader
727
+ @loader
728
+ end
729
+
730
+ def method3x
731
+ @method3x
732
+ end
733
+ end
734
+
735
+ # Add the method that is called - it simply delegates to
736
+ # the 3.x function by calling it via the calling scope using the @method3x symbol
737
+ # :"function_#{name}".
738
+ #
739
+ # When function is not an rvalue function, make sure it produces nil
740
+ #
741
+ the_class.class_eval do
742
+
743
+ # Bypasses making the call via the dispatcher to make sure errors
744
+ # are reported exactly the same way as in 3x. The dispatcher is still needed as it is
745
+ # used to support other features than calling.
746
+ #
747
+ def call(scope, *args, &block)
748
+ begin
749
+ result = catch(:return) do
750
+ mapped_args = Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter.map_args(args, scope, '')
751
+ # this is the scope.function_xxx(...) call
752
+ return scope.send(self.class.method3x, mapped_args)
753
+ end
754
+ return result.value
755
+ rescue Puppet::Pops::Evaluator::Next => jumper
756
+ begin
757
+ throw :next, jumper.value
758
+ rescue Puppet::Parser::Scope::UNCAUGHT_THROW_EXCEPTION
759
+ raise Puppet::ParseError.new("next() from context where this is illegal", jumper.file, jumper.line)
760
+ end
761
+ rescue Puppet::Pops::Evaluator::Return => jumper
762
+ begin
763
+ throw :return, jumper
764
+ rescue Puppet::Parser::Scope::UNCAUGHT_THROW_EXCEPTION
765
+ raise Puppet::ParseError.new("return() from context where this is illegal", jumper.file, jumper.line)
766
+ end
767
+ end
768
+ end
769
+ end
770
+
771
+ # Create a dispatcher based on func_info
772
+ type, names = Puppet::Functions.any_signature(*from_to_names(func_info))
773
+ last_captures_rest = (type.size_range[1] == Float::INFINITY)
774
+
775
+ # The method '3x_function' here is a dummy as the dispatcher is not used for calling, only for information.
776
+ the_class.dispatcher.add(Puppet::Pops::Functions::Dispatch.new(type, '3x_function', names, last_captures_rest))
777
+ # The function class is returned as the result of the create function method
778
+ the_class
779
+ end
780
+
781
+ # Compute min and max number of arguments and a list of constructed
782
+ # parameter names p0 - pn (since there are no parameter names in 3x functions).
783
+ #
784
+ # @api private
785
+ def self.from_to_names(func_info)
786
+ arity = func_info[:arity]
787
+ if arity.nil?
788
+ arity = -1
789
+ end
790
+ if arity < 0
791
+ from = -arity - 1 # arity -1 is 0 min param, -2 is min 1 param
792
+ to = :default # infinite range
793
+ count = -arity # the number of named parameters
794
+ else
795
+ count = from = to = arity
796
+ end
797
+ # Names of parameters, up to 5 are optimized and use frozen version
798
+ # Note that (0..count-1) produces expected empty array for count == 0, 0-n for count >= 1
799
+ names = count <= 5 ? PARAM_NAMES[count] : (0..count-1).map {|n| "p#{n}" }
800
+ [from, to, names]
801
+ end
802
+ end
803
+
804
+
682
805
  # Injection and Weaving of parameters
683
806
  # ---
684
807
  # It is possible to inject and weave a set of well known parameters into a call.