puppet 8.8.1-x64-mingw32 → 8.10.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +49 -39
  4. data/README.md +1 -1
  5. data/ext/project_data.yaml +12 -0
  6. data/ext/windows/service/daemon.rb +1 -1
  7. data/install.rb +3 -74
  8. data/lib/puppet/application/apply.rb +1 -0
  9. data/lib/puppet/application/filebucket.rb +6 -4
  10. data/lib/puppet/application/resource.rb +5 -1
  11. data/lib/puppet/application/ssl.rb +4 -4
  12. data/lib/puppet/configurer.rb +1 -1
  13. data/lib/puppet/daemon.rb +13 -1
  14. data/lib/puppet/defaults.rb +66 -54
  15. data/lib/puppet/face/catalog.rb +24 -8
  16. data/lib/puppet/face/help.rb +43 -23
  17. data/lib/puppet/feature/telnet.rb +1 -5
  18. data/lib/puppet/functions/capitalize.rb +1 -1
  19. data/lib/puppet/functions/find_file.rb +4 -0
  20. data/lib/puppet/functions/hiera.rb +1 -0
  21. data/lib/puppet/functions/index.rb +2 -2
  22. data/lib/puppet/functions/lookup.rb +1 -1
  23. data/lib/puppet/functions/new.rb +1 -1
  24. data/lib/puppet/functions/regsubst.rb +1 -1
  25. data/lib/puppet/functions/unique.rb +3 -2
  26. data/lib/puppet/functions/yaml_data.rb +1 -0
  27. data/lib/puppet/interface/action_manager.rb +1 -1
  28. data/lib/puppet/provider/package/pacman.rb +9 -10
  29. data/lib/puppet/provider/package/pip.rb +1 -1
  30. data/lib/puppet/provider/service/systemd.rb +1 -0
  31. data/lib/puppet/reference/configuration.rb +6 -1
  32. data/lib/puppet/resource/type.rb +15 -1
  33. data/lib/puppet/resource.rb +1 -1
  34. data/lib/puppet/scheduler/splay_job.rb +14 -3
  35. data/lib/puppet/settings.rb +2 -2
  36. data/lib/puppet/ssl/state_machine.rb +2 -2
  37. data/lib/puppet/transaction/resource_harness.rb +7 -3
  38. data/lib/puppet/type/exec.rb +3 -4
  39. data/lib/puppet/type/file/checksum.rb +4 -2
  40. data/lib/puppet/type/file/ctime.rb +2 -2
  41. data/lib/puppet/type/file/mtime.rb +2 -2
  42. data/lib/puppet/type/file/selcontext.rb +6 -6
  43. data/lib/puppet/type/package.rb +4 -3
  44. data/lib/puppet/type/tidy.rb +3 -1
  45. data/lib/puppet/type/user.rb +1 -1
  46. data/lib/puppet/util/checksums.rb +1 -0
  47. data/lib/puppet/util/profiler/aggregate.rb +2 -2
  48. data/lib/puppet/util/profiler/wall_clock.rb +2 -2
  49. data/lib/puppet/util/reference.rb +0 -1
  50. data/lib/puppet/util/selinux.rb +26 -14
  51. data/lib/puppet/version.rb +1 -1
  52. data/lib/puppet.rb +5 -1
  53. data/locales/puppet.pot +75 -75
  54. data/man/man5/puppet.conf.5 +20 -20
  55. data/man/man8/puppet-agent.8 +1 -1
  56. data/man/man8/puppet-apply.8 +2 -1
  57. data/man/man8/puppet-catalog.8 +5 -2
  58. data/man/man8/puppet-config.8 +1 -1
  59. data/man/man8/puppet-describe.8 +1 -1
  60. data/man/man8/puppet-device.8 +1 -1
  61. data/man/man8/puppet-doc.8 +1 -1
  62. data/man/man8/puppet-epp.8 +1 -1
  63. data/man/man8/puppet-facts.8 +1 -1
  64. data/man/man8/puppet-filebucket.8 +10 -1
  65. data/man/man8/puppet-generate.8 +1 -1
  66. data/man/man8/puppet-help.8 +1 -1
  67. data/man/man8/puppet-lookup.8 +1 -1
  68. data/man/man8/puppet-module.8 +1 -1
  69. data/man/man8/puppet-node.8 +1 -1
  70. data/man/man8/puppet-parser.8 +1 -1
  71. data/man/man8/puppet-plugin.8 +1 -1
  72. data/man/man8/puppet-report.8 +1 -1
  73. data/man/man8/puppet-resource.8 +1 -1
  74. data/man/man8/puppet-script.8 +1 -1
  75. data/man/man8/puppet-ssl.8 +3 -3
  76. data/man/man8/puppet.8 +128 -9
  77. metadata +2 -2
@@ -7,6 +7,7 @@ module Puppet
7
7
  '-u'
8
8
  end
9
9
 
10
+ # If you modify this, update puppet/type/file/checksum.rb too
10
11
  def self.default_digest_algorithm
11
12
  'sha256'
12
13
  end
@@ -161,8 +162,8 @@ module Puppet
161
162
  :skip_logging_catalog_request_destination => {
162
163
  :default => false,
163
164
  :type => :boolean,
164
- :desc => "If you wish to suppress the notice of which compiler supplied the
165
- catalog",
165
+ :desc => "Specifies whether to suppress the notice of which compiler
166
+ supplied the catalog. A value of `true` suppresses the notice.",
166
167
  },
167
168
  :merge_dependency_warnings => {
168
169
  :default => false,
@@ -417,13 +418,15 @@ module Puppet
417
418
  :type => :boolean,
418
419
  :default => true,
419
420
  :desc => <<-'EOT'
420
- When versioned_environment_dirs is `true` Puppet will readlink the environmentpath
421
- when constructing the environment's modulepath. The full readlinked path is referred
422
- to as the "resolved path" and the configured path potentially containing symlinks is
423
- the "configured path". When reporting where resources come from users may choose
424
- between the configured or resolved path.
425
-
426
- When set to false, the resolved paths are reported instead of the configured paths.
421
+ Specifies how environment paths are reported. When the value of
422
+ `versioned_environment_dirs` is `true`, Puppet applies the readlink function to
423
+ the `environmentpath` setting when constructing the environment's modulepath. The
424
+ full readlinked path is referred to as the "resolved path," and the configured
425
+ path potentially containing symlinks is the "configured path." When reporting
426
+ where resources come from, users may choose between the configured and resolved
427
+ path.
428
+
429
+ When set to `false`, the resolved paths are reported instead of the configured paths.
427
430
  EOT
428
431
  },
429
432
  :use_last_environment => {
@@ -1204,17 +1207,18 @@ EOT
1204
1207
  :ca_refresh_interval => {
1205
1208
  :default => "1d",
1206
1209
  :type => :duration,
1207
- :desc => "How often the Puppet agent refreshes its local CA certs. By
1208
- default the CA certs are refreshed once every 24 hours. If a different
1209
- duration is specified, then the agent will refresh its CA certs whenever
1210
- it next runs and the elapsed time since the certs were last refreshed
1211
- exceeds the duration.
1212
-
1213
- In general, the duration should be greater than the `runinterval`.
1214
- Setting it to 0 or an equal or lesser value than `runinterval`,
1215
- will cause the CA certs to be refreshed on every run.
1216
-
1217
- If the agent downloads new CA certs, the agent will use it for subsequent
1210
+ :desc => "How often the Puppet agent refreshes its local CA
1211
+ certificates. By default, CA certificates are refreshed every 24 hours. If a
1212
+ different interval is specified, the agent refreshes its CA certificates during
1213
+ the next agent run if the elapsed time since the certificates were last
1214
+ refreshed exceeds the specified duration.
1215
+
1216
+ In general, the interval should be greater than the `runinterval`
1217
+ value. Setting the `ca_refresh_interval` value to 0 or an equal or
1218
+ lesser value than `runinterval` causes the CA certificates to be
1219
+ refreshed on every run.
1220
+
1221
+ If the agent downloads new CA certs, the agent uses those for subsequent
1218
1222
  network requests. If the refresh request fails or if the CA certs are
1219
1223
  unchanged on the server, then the agent run will continue using the
1220
1224
  local CA certs it already has. #{AS_DURATION}",
@@ -1222,15 +1226,15 @@ EOT
1222
1226
  :crl_refresh_interval => {
1223
1227
  :default => "1d",
1224
1228
  :type => :duration,
1225
- :desc => "How often the Puppet agent refreshes its local CRL. By
1226
- default the CRL is refreshed once every 24 hours. If a different
1227
- duration is specified, then the agent will refresh its CRL whenever
1228
- it next runs and the elapsed time since the CRL was last refreshed
1229
- exceeds the duration.
1229
+ :desc => "How often the Puppet agent refreshes its local Certificate
1230
+ Revocation List (CRL). By default, the CRL is refreshed every 24 hours. If
1231
+ a different interval is specified, the agent refreshes its CRL on the next
1232
+ Puppet agent run if the elapsed time since the CRL was last refreshed
1233
+ exceeds the specified interval.
1230
1234
 
1231
- In general, the duration should be greater than the `runinterval`.
1232
- Setting it to 0 or an equal or lesser value than `runinterval`,
1233
- will cause the CRL to be refreshed on every run.
1235
+ In general, the interval should be greater than the `runinterval` value.
1236
+ Setting the `crl_refresh_interval` value to 0 or an equal or lesser value
1237
+ than `runinterval` causes the CRL to be refreshed on every run.
1234
1238
 
1235
1239
  If the agent downloads a new CRL, the agent will use it for subsequent
1236
1240
  network requests. If the refresh request fails or if the CRL is
@@ -1240,18 +1244,19 @@ EOT
1240
1244
  :hostcert_renewal_interval => {
1241
1245
  :default => "30d",
1242
1246
  :type => :duration,
1243
- :desc => "When the Puppet agent refreshes its client certificate.
1244
- By default the client certificate will refresh 30 days before the certificate
1245
- expires. If a different duration is specified, then the agent will refresh its
1246
- client certificate whenever it next runs and if the client certificate expires
1247
- within the duration specified.
1247
+ :desc => "How often the Puppet agent renews its client certificate. By
1248
+ default, the client certificate is renewed 30 days before the certificate
1249
+ expires. If a different interval is specified, the agent renews its client
1250
+ certificate during the next agent run, assuming that the client certificate has
1251
+ expired within the specified duration.
1248
1252
 
1249
- In general, the duration should be greater than the `runinterval`.
1250
- Setting it to 0 will disable automatic renewal.
1253
+ In general, the `hostcert_renewal_interval` value should be greater than the
1254
+ `runinterval` value. Setting the `hostcert_renewal_interval` value to 0 disables
1255
+ automatic renewal.
1251
1256
 
1252
- If the agent downloads a new certificate, the agent will use it for subsequent
1253
- network requests. If the refresh request fails, then the agent run will continue using the
1254
- certificate it already has. #{AS_DURATION}",
1257
+ If the agent downloads a new certificate, the agent will use it
1258
+ for subsequent network requests. If the refresh request fails, the agent run
1259
+ continues to use its existing certificate. #{AS_DURATION}",
1255
1260
  },
1256
1261
  :keylength => {
1257
1262
  :default => 4096,
@@ -1492,8 +1497,10 @@ EOT
1492
1497
  :exclude_unchanged_resources => {
1493
1498
  :default => true,
1494
1499
  :type => :boolean,
1495
- :desc => 'When set to true, resources that have had no changes after catalog application
1496
- will not have corresponding unchanged resource status updates listed in the report.'
1500
+ :desc => "Specifies how unchanged resources are listed in reports. When
1501
+ set to `true`, resources that have had no changes after catalog application
1502
+ will not have corresponding unchanged resource status updates listed in a
1503
+ report."
1497
1504
  },
1498
1505
  :reportdir => {
1499
1506
  :default => "$vardir/reports",
@@ -1745,11 +1752,12 @@ EOT
1745
1752
  :allow_pson_serialization => {
1746
1753
  :default => false,
1747
1754
  :type => :boolean,
1748
- :desc => "Whether when unable to serialize to JSON or other formats,
1749
- Puppet falls back to PSON. This option affects both puppetserver's
1750
- configuration management service responses and when the agent saves its
1751
- cached catalog. This option is useful in preventing the loss of data because
1752
- rich data cannot be serialized via PSON.",
1755
+ :desc => "Whether to allow PSON serialization. When unable to serialize to
1756
+ JSON or other formats, Puppet falls back to PSON. This option affects the
1757
+ configuration management service responses of Puppet Server and the process by
1758
+ which the agent saves its cached catalog. With a default value of `false`, this
1759
+ option is useful in preventing the loss of data because rich data cannot be
1760
+ serialized via PSON.",
1753
1761
  },
1754
1762
  :agent_catalog_run_lockfile => {
1755
1763
  :default => "$statedir/agent_catalog_run.lock",
@@ -1775,7 +1783,7 @@ EOT
1775
1783
  :type => :boolean,
1776
1784
  :default => false,
1777
1785
  :desc => "Whether to include legacy facts when requesting a catalog. This
1778
- option can be set to false provided all puppet manifests, hiera.yaml and hiera
1786
+ option can be set to `false` if all puppet manifests, hiera.yaml, and hiera
1779
1787
  configuration layers no longer access legacy facts, such as `$osfamily`, and
1780
1788
  instead access structured facts, such as `$facts['os']['family']`."
1781
1789
  },
@@ -1795,9 +1803,11 @@ EOT
1795
1803
  :desc => "The soft limit for the number of top level facts.",
1796
1804
  },
1797
1805
  :number_of_facts_soft_limit => {
1798
- :default => 2048,
1806
+ :default => 10_240,
1799
1807
  :type => :integer,
1800
- :desc => "The soft limit for the total number of facts.",
1808
+ :desc => "The soft limit for the total number of fact values. This counts the
1809
+ child elements of all facts (e.g. all items of an array or a hash), not just top
1810
+ level facts.",
1801
1811
  },
1802
1812
  :payload_soft_limit => {
1803
1813
  :default => 16 * 1024 * 1024,
@@ -2091,12 +2101,12 @@ EOT
2091
2101
  :preprocess_deferred => {
2092
2102
  :default => false,
2093
2103
  :type => :boolean,
2094
- :desc => "Whether puppet should call deferred functions before applying
2095
- the catalog. If set to `true`, then all prerequisites needed for the
2096
- deferred function must be satisfied prior to puppet running. If set to
2097
- `false`, then deferred functions will follow puppet relationships and
2098
- ordering. This allows puppet to install prerequisites needed for a
2099
- deferred function and call the deferred function in the same run."
2104
+ :desc => "Whether Puppet should call deferred functions before applying
2105
+ the catalog. If set to `true`, all prerequisites required for the
2106
+ deferred function must be satisfied before the Puppet run. If set to
2107
+ `false`, deferred functions follow Puppet relationships and
2108
+ ordering. In this way, Puppet can install the prerequisites required for a
2109
+ deferred function and call the deferred function in the same run.",
2100
2110
  },
2101
2111
  :summarize => {
2102
2112
  :default => false,
@@ -2118,10 +2128,12 @@ EOT
2118
2128
  can produce node information. The command must:
2119
2129
 
2120
2130
  * Take the name of a node as a command-line argument.
2131
+
2121
2132
  * Return a YAML hash with up to three keys:
2122
2133
  * `classes` --- A list of classes, as an array or hash.
2123
2134
  * `environment` --- A string.
2124
2135
  * `parameters` --- A list of top-scope variables to set, as a hash.
2136
+
2125
2137
  * For unknown nodes, exit with a non-zero exit code.
2126
2138
 
2127
2139
  Generally, an ENC script makes requests to an external data source.
@@ -25,13 +25,27 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
25
25
 
26
26
  deactivate_action(:destroy)
27
27
  deactivate_action(:search)
28
- find = get_action(:find)
29
- find.summary "Retrieve the catalog for the node from which the command is run."
30
- find.arguments "<certname>"
31
- find.returns <<-'EOT'
32
- A serialized catalog. When used from the Ruby API, returns a
33
- Puppet::Resource::Catalog object.
34
- EOT
28
+ action(:find) do
29
+ summary _("Retrieve the catalog for the node from which the command is run.")
30
+ arguments "<certname>, <facts>"
31
+ option("--facts_for_catalog") do
32
+ summary _("Not implemented for the CLI; facts are collected internally.")
33
+ end
34
+ returns <<-'EOT'
35
+ A serialized catalog. When used from the Ruby API, returns a
36
+ Puppet::Resource::Catalog object.
37
+ EOT
38
+
39
+ when_invoked do |*args|
40
+ # Default the key to Puppet[:certname] if none is supplied
41
+ if args.length == 1
42
+ key = Puppet[:certname]
43
+ else
44
+ key = args.shift
45
+ end
46
+ call_indirection_method :find, key, args.first
47
+ end
48
+ end
35
49
 
36
50
  action(:apply) do
37
51
  summary "Find and apply a catalog."
@@ -135,9 +149,11 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
135
149
  when_invoked do |_options|
136
150
  Puppet::Resource::Catalog.indirection.terminus_class = :rest
137
151
  Puppet::Resource::Catalog.indirection.cache_class = nil
152
+ facts = Puppet::Face[:facts, '0.0.1'].find(Puppet[:certname])
138
153
  catalog = nil
139
154
  retrieval_duration = thinmark do
140
- catalog = Puppet::Face[:catalog, '0.0.1'].find(Puppet[:certname])
155
+ catalog = Puppet::Face[:catalog, '0.0.1'].find(Puppet[:certname],
156
+ { facts_for_catalog: facts })
141
157
  end
142
158
  catalog.retrieval_duration = retrieval_duration
143
159
  catalog.write_class_file
@@ -151,6 +151,33 @@ Puppet::Face.define(:help, '0.0.1') do
151
151
  end.sort
152
152
  end
153
153
 
154
+ def generate_summary(appname)
155
+ if is_face_app?(appname)
156
+ begin
157
+ face = Puppet::Face[appname, :current]
158
+ # Add deprecation message to summary if the face is deprecated
159
+ summary = face.deprecated? ? face.summary + ' ' + _("(Deprecated)") : face.summary
160
+ [appname, summary, ' ']
161
+ rescue StandardError, LoadError
162
+ error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
163
+ error_message += ' ' + _("Check error logs.")
164
+ [error_message, '', ' ']
165
+ end
166
+ else
167
+ begin
168
+ summary = Puppet::Application[appname].summary
169
+ if summary.empty?
170
+ summary = horribly_extract_summary_from(appname)
171
+ end
172
+ [appname, summary, ' ']
173
+ rescue StandardError, LoadError
174
+ error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
175
+ error_message += ' ' + _("Check error logs.")
176
+ [error_message, '', ' ']
177
+ end
178
+ end
179
+ end
180
+
154
181
  # Return a list of all applications (both legacy and Face applications), along with a summary
155
182
  # of their functionality.
156
183
  # @return [Array] An Array of Arrays. The outer array contains one entry per application; each
@@ -162,29 +189,8 @@ Puppet::Face.define(:help, '0.0.1') do
162
189
 
163
190
  if appname == COMMON || appname == SPECIALIZED || appname == BLANK
164
191
  result << appname
165
- elsif is_face_app?(appname)
166
- begin
167
- face = Puppet::Face[appname, :current]
168
- # Add deprecation message to summary if the face is deprecated
169
- summary = face.deprecated? ? face.summary + ' ' + _("(Deprecated)") : face.summary
170
- result << [appname, summary, ' ']
171
- rescue StandardError, LoadError
172
- error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
173
- error_message += ' ' + _("Check error logs.")
174
- result << [error_message, '', ' ']
175
- end
176
192
  else
177
- begin
178
- summary = Puppet::Application[appname].summary
179
- if summary.empty?
180
- summary = horribly_extract_summary_from(appname)
181
- end
182
- result << [appname, summary, ' ']
183
- rescue StandardError, LoadError
184
- error_message = _("!%{sub_command}! Subcommand unavailable due to error.") % { sub_command: appname }
185
- error_message += ' ' + _("Check error logs.")
186
- result << [error_message, '', ' ']
187
- end
193
+ result << generate_summary(appname)
188
194
  end
189
195
  end
190
196
  end
@@ -192,15 +198,29 @@ Puppet::Face.define(:help, '0.0.1') do
192
198
  COMMON = 'Common:'
193
199
  SPECIALIZED = 'Specialized:'
194
200
  BLANK = "\n"
201
+ COMMON_APPS = %w[apply agent config help lookup module resource]
195
202
  def available_application_names_special_sort
196
203
  full_list = Puppet::Application.available_application_names
197
- a_list = full_list & %w[apply agent config help lookup module resource]
204
+ a_list = full_list & COMMON_APPS
198
205
  a_list = a_list.sort
199
206
  also_ran = full_list - a_list
200
207
  also_ran = also_ran.sort
201
208
  [[COMMON], a_list, [BLANK], [SPECIALIZED], also_ran].flatten(1)
202
209
  end
203
210
 
211
+ def common_app_summaries
212
+ COMMON_APPS.map do |appname|
213
+ generate_summary(appname)
214
+ end
215
+ end
216
+
217
+ def specialized_app_summaries
218
+ specialized_apps = Puppet::Application.available_application_names - COMMON_APPS
219
+ specialized_apps.filter_map do |appname|
220
+ generate_summary(appname) unless exclude_from_docs?(appname)
221
+ end
222
+ end
223
+
204
224
  def horribly_extract_summary_from(appname)
205
225
  help = Puppet::Application[appname].help.split("\n")
206
226
  # Now we find the line with our summary, extract it, and return it. This
@@ -2,8 +2,4 @@
2
2
 
3
3
  require_relative '../../puppet/util/feature'
4
4
 
5
- Puppet.features.add :telnet do
6
- require 'net/telnet'
7
- rescue LoadError
8
- false
9
- end
5
+ Puppet.features.add(:telnet, :libs => %(net/telnet))
@@ -5,7 +5,7 @@
5
5
  # This function is compatible with the stdlib function with the same name.
6
6
  #
7
7
  # The function does the following:
8
- # * For a `String`, a string with its first character in upper case version is returned.
8
+ # * For a `String`, a string is returned in which the first character is uppercase.
9
9
  # This is done using Ruby system locale which handles some, but not all
10
10
  # special international up-casing rules (for example German double-s ß is capitalized to "Ss").
11
11
  # * For an `Iterable[Variant[String, Numeric]]` (for example an `Array`) each value is capitalized and the conversion is not recursive.
@@ -7,6 +7,10 @@
7
7
  # directory. (For example, the reference `mysql/mysqltuner.pl` will search for the
8
8
  # file `<MODULES DIRECTORY>/mysql/files/mysqltuner.pl`.)
9
9
  #
10
+ # If this function is run via puppet agent, it checks for file existence on the
11
+ # Puppet Primary server. If run via puppet apply, it checks on the local host.
12
+ # In both cases, the check is performed before any resources are changed.
13
+ #
10
14
  # This function can also accept:
11
15
  #
12
16
  # * An absolute String path, which checks for the existence of a file from anywhere on disk.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'hiera/puppet_function'
4
+
4
5
  # Performs a standard priority lookup of the hierarchy and returns the most specific value
5
6
  # for a given key. The returned value can be any type of data.
6
7
  #
@@ -40,8 +40,8 @@
40
40
  # Note that the lambda gets the value and not an array with `[key, value]` as in other
41
41
  # iterative functions.
42
42
  #
43
- # Using a lambda that accepts two values works the same way, it simply gets the index/key
44
- # as the first parameter, and the value as the second.
43
+ # Using a lambda that accepts two values works the same way. The lambda gets the index/key
44
+ # as the first parameter and the value as the second parameter.
45
45
  #
46
46
  # @example Using the `index` function with an Array and a two-parameter lambda
47
47
  #
@@ -97,7 +97,7 @@
97
97
  # or `{'strategy' => 'hash'}` --- Same as the string versions of these merge behaviors.
98
98
  # * `{'strategy' => 'deep', <DEEP OPTION> => <VALUE>, ...}` --- Same as `'deep'`,
99
99
  # but can adjust the merge with additional options. The available options are:
100
- # * `'knockout_prefix'` (string or undef) --- A string prefix to indicate a
100
+ # * `'knockout_prefix'` (string) --- A string prefix to indicate a
101
101
  # value should be _removed_ from the final result. If a value is exactly equal
102
102
  # to the prefix, it will knockout the entire element. Defaults to `undef`, which
103
103
  # disables this feature.
@@ -557,7 +557,7 @@
557
557
  # @example Simple Conversion to String specifying the format for the given value directly
558
558
  #
559
559
  # ```puppet
560
- # $str = String(10, "%#x") # produces '0x10'
560
+ # $str = String(10, "%#x") # produces '0xa'
561
561
  # $str = String([10], "%(a") # produces '("10")'
562
562
  # ```
563
563
  #
@@ -20,7 +20,7 @@ Puppet::Functions.create_function(:regsubst) do
20
20
  # - *M* Multiline regexps
21
21
  # - *G* Global replacement; all occurrences of the regexp in each target string will be replaced. Without this, only the first occurrence will be replaced.
22
22
  # @param encoding [Enum['N','E','S','U']]
23
- # Deprecated and ignored parameter, only here for compatibility.
23
+ # Deprecated and ignored parameter, included only for compatibility.
24
24
  # @return [Array[String], String] The result of the substitution. Result type is the same as for the target parameter.
25
25
  # @deprecated
26
26
  # This method has the optional encoding parameter, which is ignored.
@@ -65,8 +65,9 @@
65
65
  # *first-found* unique value, but for `Hash` it contains associations from a set of keys to the set of values clustered by the
66
66
  # equality lambda (or the default value equality if no lambda was given). This makes the `unique` function more versatile for hashes
67
67
  # in general, while requiring that the simple computation of "hash's unique set of values" is performed as `$hsh.map |$k, $v| { $v }.unique`.
68
- # (A unique set of hash keys is in general meaningless (since they are unique by definition) - although if processed with a different
69
- # lambda for equality that would be different. First map the hash to an array of its keys if such a unique computation is wanted).
68
+ # (Generally, it's meaningless to compute the unique set of hash keys because they are unique by definition. However, the
69
+ # situation can change if the hash keys are processed with a different lambda for equality. For this unique computation,
70
+ # first map the hash to an array of its keys.)
70
71
  # If the more advanced clustering is wanted for one of the other data types, simply transform it into a `Hash` as shown in the
71
72
  # following example.
72
73
  #
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
+
4
5
  # The `yaml_data` is a hiera 5 `data_hash` data provider function.
5
6
  # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
6
7
  # how to use this function.
@@ -19,7 +19,7 @@ module Puppet::Interface::ActionManager
19
19
  # @dsl Faces
20
20
  def action(name, &block)
21
21
  @actions ||= {}
22
- Puppet.warning _("Redefining action %{name} for %{self}") % { name: name, self: self } if action?(name)
22
+ Puppet.debug _("Redefining action %{name} for %{self}") % { name: name, self: self } if action?(name)
23
23
 
24
24
  action = Puppet::Interface::ActionBuilder.build(self, name, &block)
25
25
 
@@ -29,7 +29,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
29
29
 
30
30
  # Checks if a given name is a group
31
31
  def self.group?(name)
32
- !pacman("-Sg", name).empty?
32
+ !pacman('--sync', '--groups', name).empty?
33
33
  rescue Puppet::ExecutionFailure
34
34
  # pacman returns an expected non-zero exit code when the name is not a group
35
35
  false
@@ -74,7 +74,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
74
74
  # returns a hash package => version of installed packages
75
75
  def self.get_installed_packages
76
76
  packages = {}
77
- execpipe([command(:pacman), "-Q"]) do |pipe|
77
+ execpipe([command(:pacman), "--query"]) do |pipe|
78
78
  # pacman -Q output is 'packagename version-rel'
79
79
  regex = /^(\S+)\s(\S+)/
80
80
  pipe.each_line do |line|
@@ -96,7 +96,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
96
96
  groups = {}
97
97
  begin
98
98
  # Build a hash of group name => list of packages
99
- command = [command(:pacman), "-Sgg"]
99
+ command = [command(:pacman), '--sync', '-gg']
100
100
  command << filter if filter
101
101
  execpipe(command) do |pipe|
102
102
  pipe.each_line do |line|
@@ -134,14 +134,14 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
134
134
  resource_name = @resource[:name]
135
135
 
136
136
  # If target is a group, construct the group version
137
- return pacman("-Sp", "--print-format", "%n %v", resource_name).lines.map(&:chomp).sort.join(', ') if self.class.group?(resource_name)
137
+ return pacman("--sync", "--print", "--print-format", "%n %v", resource_name).lines.map(&:chomp).sort.join(', ') if self.class.group?(resource_name)
138
138
 
139
139
  # Start by querying with pacman first
140
140
  # If that fails, retry using yaourt against the AUR
141
141
  pacman_check = true
142
142
  begin
143
143
  if pacman_check
144
- output = pacman "-Sp", "--print-format", "%v", resource_name
144
+ output = pacman "--sync", "--print", "--print-format", "%v", resource_name
145
145
  output.chomp
146
146
  else
147
147
  output = yaourt "-Qma", resource_name
@@ -210,8 +210,8 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
210
210
 
211
211
  cmd = %w[--noconfirm --noprogressbar]
212
212
  cmd += uninstall_options if @resource[:uninstall_options]
213
- cmd << "-R"
214
- cmd << '-s' if is_group
213
+ cmd << "--remove"
214
+ cmd << '--recursive' if is_group
215
215
  cmd << '--nosave' if purge_configs
216
216
  cmd << resource_name
217
217
 
@@ -248,8 +248,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
248
248
  else
249
249
  fail _("Source %{source} is not supported by pacman") % { source: source }
250
250
  end
251
- pacman "--noconfirm", "--noprogressbar", "-S"
252
- pacman "--noconfirm", "--noprogressbar", "-U", source
251
+ pacman "--noconfirm", "--noprogressbar", "--update", source
253
252
  end
254
253
 
255
254
  def install_from_repo
@@ -260,7 +259,7 @@ Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Packag
260
259
 
261
260
  cmd = %w[--noconfirm --needed --noprogressbar]
262
261
  cmd += install_options if @resource[:install_options]
263
- cmd << "-S" << resource_name
262
+ cmd << "--sync" << resource_name
264
263
 
265
264
  if self.class.yaourt?
266
265
  yaourt(*cmd)
@@ -160,7 +160,7 @@ Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package
160
160
  command = resource_or_provider_command
161
161
  self.class.validate_command(command)
162
162
 
163
- command_and_options = [self.class.quote(command), 'install', "#{@resource[:name]}==versionplease"]
163
+ command_and_options = [self.class.quote(command), 'install', "#{@resource[:name]}==9!0dev0+x"]
164
164
  extra_arg = list_extra_flags(command_version)
165
165
  command_and_options << extra_arg if extra_arg
166
166
  command_and_options << install_options if @resource[:install_options]
@@ -31,6 +31,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
31
31
  defaultfor 'os.name' => :ubuntu
32
32
  notdefaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"] # These are using upstart
33
33
  defaultfor 'os.name' => :cumuluslinux, 'os.release.major' => %w[3 4]
34
+ defaultfor 'os.name' => :raspbian, 'os.release.major' => %w[12]
34
35
 
35
36
  def self.instances
36
37
  i = []
@@ -41,8 +41,14 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
41
41
  val = '$confdir/hiera.yaml. However, for backwards compatibility, if a file exists at $codedir/hiera.yaml, Puppet uses that instead.'
42
42
  when 'certname'
43
43
  val = "the Host's fully qualified domain name, as determined by Facter"
44
+ when 'hostname'
45
+ val = "(the system's fully qualified hostname)"
46
+ when 'domain'
47
+ val = "(the system's own domain)"
44
48
  when 'srv_domain'
45
49
  val = 'example.com'
50
+ when 'http_user_agent'
51
+ val = 'Puppet/<version> Ruby/<version> (<architecture>)'
46
52
  end
47
53
 
48
54
  # Leave out the section information; it was apparently confusing people.
@@ -95,6 +101,5 @@ config.header = <<~EOT
95
101
 
96
102
  [confguide]: https://puppet.com/docs/puppet/latest/config_about_settings.html
97
103
 
98
- * * *
99
104
 
100
105
  EOT
@@ -33,6 +33,16 @@ class Puppet::Resource::Type
33
33
  DOUBLE_COLON = '::'
34
34
  EMPTY_ARRAY = [].freeze
35
35
 
36
+ LOOKAROUND_OPERATORS = {
37
+ "(" => 'LP',
38
+ "?" => "QU",
39
+ "<" => "LT",
40
+ ">" => "GT",
41
+ "!" => "EX",
42
+ "=" => "EQ",
43
+ ")" => 'RP'
44
+ }.freeze
45
+
36
46
  attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection, :override
37
47
  attr_reader :namespace, :arguments, :behaves_like, :module_name
38
48
 
@@ -196,7 +206,11 @@ class Puppet::Resource::Type
196
206
 
197
207
  def name
198
208
  if type == :node && name_is_regex?
199
- "__node_regexp__#{@name.source.downcase.gsub(/[^-\w:.]/, '').sub(/^\.+/, '')}"
209
+ # Normalize lookarround regex patthern
210
+ internal_name = @name.source.downcase.gsub(/\(\?[^)]*\)/) do |str|
211
+ str.gsub(/./) { |ch| LOOKAROUND_OPERATORS[ch] || ch }
212
+ end
213
+ "__node_regexp__#{internal_name.gsub(/[^-\w:.]/, '').sub(/^\.+/, '')}"
200
214
  else
201
215
  @name
202
216
  end
@@ -112,7 +112,7 @@ class Puppet::Resource
112
112
  # To get stringified parameter values the flag :stringify_rich can be set
113
113
  # in the puppet context.
114
114
  #
115
- stringify = Puppet.lookup(:stringify_rich) { false }
115
+ stringify = Puppet.lookup(:stringify_rich)
116
116
  converter = stringify ? Puppet::Pops::Serialization::ToStringifiedConverter.new : nil
117
117
 
118
118
  params = {}