puppet 6.22.1-universal-darwin → 6.23.0-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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +14 -14
  3. data/ext/osx/puppet.plist +2 -0
  4. data/lib/puppet/application/agent.rb +12 -5
  5. data/lib/puppet/application/apply.rb +2 -1
  6. data/lib/puppet/application/device.rb +2 -1
  7. data/lib/puppet/application/resource.rb +2 -1
  8. data/lib/puppet/application/script.rb +2 -1
  9. data/lib/puppet/configurer/downloader.rb +2 -1
  10. data/lib/puppet/defaults.rb +5 -3
  11. data/lib/puppet/file_serving/fileset.rb +14 -2
  12. data/lib/puppet/functions/all.rb +1 -1
  13. data/lib/puppet/functions/camelcase.rb +1 -1
  14. data/lib/puppet/functions/capitalize.rb +2 -2
  15. data/lib/puppet/functions/downcase.rb +2 -2
  16. data/lib/puppet/functions/get.rb +5 -5
  17. data/lib/puppet/functions/group_by.rb +13 -5
  18. data/lib/puppet/functions/lest.rb +1 -1
  19. data/lib/puppet/functions/new.rb +100 -100
  20. data/lib/puppet/functions/partition.rb +4 -4
  21. data/lib/puppet/functions/require.rb +5 -5
  22. data/lib/puppet/functions/sort.rb +3 -3
  23. data/lib/puppet/functions/tree_each.rb +7 -9
  24. data/lib/puppet/functions/type.rb +4 -4
  25. data/lib/puppet/functions/upcase.rb +2 -2
  26. data/lib/puppet/http/resolver/server_list.rb +15 -4
  27. data/lib/puppet/http/service/compiler.rb +69 -0
  28. data/lib/puppet/http/service/file_server.rb +2 -1
  29. data/lib/puppet/indirector/catalog/compiler.rb +1 -0
  30. data/lib/puppet/indirector/file_metadata/rest.rb +1 -0
  31. data/lib/puppet/parser/functions/fqdn_rand.rb +14 -6
  32. data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
  33. data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
  34. data/lib/puppet/provider/package/nim.rb +11 -6
  35. data/lib/puppet/provider/service/systemd.rb +13 -3
  36. data/lib/puppet/provider/service/windows.rb +38 -0
  37. data/lib/puppet/provider/user/directoryservice.rb +25 -12
  38. data/lib/puppet/reference/configuration.rb +1 -1
  39. data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
  40. data/lib/puppet/type/file/selcontext.rb +1 -1
  41. data/lib/puppet/type/file.rb +19 -1
  42. data/lib/puppet/type/service.rb +18 -38
  43. data/lib/puppet/type/tidy.rb +21 -2
  44. data/lib/puppet/type/user.rb +38 -20
  45. data/lib/puppet/util/selinux.rb +30 -4
  46. data/lib/puppet/version.rb +1 -1
  47. data/locales/puppet.pot +109 -101
  48. data/man/man5/puppet.conf.5 +272 -252
  49. data/man/man8/puppet-agent.8 +1 -1
  50. data/man/man8/puppet-apply.8 +1 -1
  51. data/man/man8/puppet-catalog.8 +1 -1
  52. data/man/man8/puppet-config.8 +1 -1
  53. data/man/man8/puppet-describe.8 +1 -1
  54. data/man/man8/puppet-device.8 +1 -1
  55. data/man/man8/puppet-doc.8 +1 -1
  56. data/man/man8/puppet-epp.8 +1 -1
  57. data/man/man8/puppet-facts.8 +1 -1
  58. data/man/man8/puppet-filebucket.8 +1 -1
  59. data/man/man8/puppet-generate.8 +1 -1
  60. data/man/man8/puppet-help.8 +1 -1
  61. data/man/man8/puppet-key.8 +1 -1
  62. data/man/man8/puppet-lookup.8 +1 -1
  63. data/man/man8/puppet-man.8 +1 -1
  64. data/man/man8/puppet-module.8 +1 -1
  65. data/man/man8/puppet-node.8 +1 -1
  66. data/man/man8/puppet-parser.8 +1 -1
  67. data/man/man8/puppet-plugin.8 +1 -1
  68. data/man/man8/puppet-report.8 +1 -1
  69. data/man/man8/puppet-resource.8 +1 -1
  70. data/man/man8/puppet-script.8 +1 -1
  71. data/man/man8/puppet-ssl.8 +1 -1
  72. data/man/man8/puppet-status.8 +1 -1
  73. data/man/man8/puppet.8 +2 -2
  74. data/spec/fixtures/ssl/127.0.0.1-key.pem +107 -57
  75. data/spec/fixtures/ssl/127.0.0.1.pem +52 -31
  76. data/spec/fixtures/ssl/bad-basic-constraints.pem +57 -35
  77. data/spec/fixtures/ssl/bad-int-basic-constraints.pem +57 -35
  78. data/spec/fixtures/ssl/ca.pem +57 -35
  79. data/spec/fixtures/ssl/crl.pem +28 -18
  80. data/spec/fixtures/ssl/ec-key.pem +11 -11
  81. data/spec/fixtures/ssl/ec.pem +33 -24
  82. data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
  83. data/spec/fixtures/ssl/encrypted-key.pem +108 -58
  84. data/spec/fixtures/ssl/intermediate-agent-crl.pem +28 -19
  85. data/spec/fixtures/ssl/intermediate-agent.pem +57 -36
  86. data/spec/fixtures/ssl/intermediate-crl.pem +31 -21
  87. data/spec/fixtures/ssl/intermediate.pem +57 -36
  88. data/spec/fixtures/ssl/pluto-key.pem +107 -57
  89. data/spec/fixtures/ssl/pluto.pem +52 -30
  90. data/spec/fixtures/ssl/request-key.pem +107 -57
  91. data/spec/fixtures/ssl/request.pem +47 -26
  92. data/spec/fixtures/ssl/revoked-key.pem +107 -57
  93. data/spec/fixtures/ssl/revoked.pem +52 -30
  94. data/spec/fixtures/ssl/signed-key.pem +107 -57
  95. data/spec/fixtures/ssl/signed.pem +52 -30
  96. data/spec/fixtures/ssl/tampered-cert.pem +52 -30
  97. data/spec/fixtures/ssl/tampered-csr.pem +47 -26
  98. data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +107 -57
  99. data/spec/fixtures/ssl/unknown-127.0.0.1.pem +50 -29
  100. data/spec/fixtures/ssl/unknown-ca-key.pem +107 -57
  101. data/spec/fixtures/ssl/unknown-ca.pem +55 -33
  102. data/spec/integration/application/resource_spec.rb +30 -0
  103. data/spec/lib/puppet/test_ca.rb +2 -2
  104. data/spec/unit/application/agent_spec.rb +7 -2
  105. data/spec/unit/configurer/downloader_spec.rb +6 -0
  106. data/spec/unit/configurer_spec.rb +23 -0
  107. data/spec/unit/file_serving/fileset_spec.rb +60 -0
  108. data/spec/unit/gettext/config_spec.rb +12 -0
  109. data/spec/unit/http/service/compiler_spec.rb +123 -0
  110. data/spec/unit/indirector/catalog/compiler_spec.rb +14 -10
  111. data/spec/unit/parser/functions/fqdn_rand_spec.rb +15 -1
  112. data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
  113. data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
  114. data/spec/unit/provider/package/nim_spec.rb +42 -0
  115. data/spec/unit/provider/service/init_spec.rb +1 -0
  116. data/spec/unit/provider/service/openwrt_spec.rb +3 -1
  117. data/spec/unit/provider/service/systemd_spec.rb +42 -8
  118. data/spec/unit/provider/service/windows_spec.rb +202 -0
  119. data/spec/unit/provider/user/directoryservice_spec.rb +67 -35
  120. data/spec/unit/ssl/state_machine_spec.rb +19 -5
  121. data/spec/unit/transaction/additional_resource_generator_spec.rb +0 -2
  122. data/spec/unit/transaction_spec.rb +18 -20
  123. data/spec/unit/type/file/selinux_spec.rb +3 -3
  124. data/spec/unit/type/service_spec.rb +59 -188
  125. data/spec/unit/type/tidy_spec.rb +17 -7
  126. data/spec/unit/type/user_spec.rb +45 -0
  127. data/spec/unit/util/selinux_spec.rb +87 -16
  128. data/tasks/generate_cert_fixtures.rake +2 -2
  129. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f6df2839f6418cacbd0b1efbe293838b2e454e6eada1da7214bd64f85c2ab0b
4
- data.tar.gz: b3377b7ebc62ef72c380d7419c63bed98cf1195368d6bfb8cdf973da2f1ab84d
3
+ metadata.gz: 24dd689f664e60e622d2fbbda9d4b461428e6478c917e325eef0c83967f25a4c
4
+ data.tar.gz: 858fc1cc963b92ed1bb79f75285565020bd114d5c6eed9fdabecd697fcae23b2
5
5
  SHA512:
6
- metadata.gz: 86fb2036780d5e04bcc9f8279415ffd77e37fe1e9b5d10f0521c63ec6229ad9e08d5b1186e158142c1d6aa1934ba108c6de75ce59bd94256b371f18950cc9017
7
- data.tar.gz: 97f58ebbeb1b32fd437b9b7108bccc50b879adb120708a80080f109161f171bd7ba6fd8acec9c0c5879e210f297d13b24bea0e3759c957f29dedda2fe2dc609f
6
+ metadata.gz: daebd0e8b02ad1345b567dbc145d7c968f69af1131dec93a18344fec41ef34314eaac36f55d1013f48e77f64e954fe7077b72df999a226a399a40d8fbce09d10
7
+ data.tar.gz: 74a993b2c402b3cb31706af8d3c6931cc3f208b61121f28901cde795b977082dfc2ff9fc30718ea5c0db5161ea128978a3465202b3c1b24f56744e447d0dc0cf
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GIT
2
- remote: git://github.com/ciprianbadescu/packaging
3
- revision: 5f8d2bda941abfeeb8fb1731c9b1dd4d108f5d33
4
- branch: maint/windows-signing
2
+ remote: git://github.com/puppetlabs/packaging
3
+ revision: 9ddc3c730023911b5ef015dc55a4d2e9a55e4a6c
4
+ branch: 1.0.x
5
5
  specs:
6
- packaging (0.99.49.171.g5f8d2bd)
6
+ packaging (0.99.77)
7
7
  artifactory (~> 2)
8
8
  csv (= 3.1.5)
9
9
  rake (>= 12.3)
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- puppet (6.22.1)
15
+ puppet (6.23.0)
16
16
  CFPropertyList (~> 2.2)
17
17
  concurrent-ruby (~> 1.0)
18
18
  deep_merge (~> 1.0)
@@ -33,18 +33,18 @@ GEM
33
33
  artifactory (2.8.2)
34
34
  ast (2.4.2)
35
35
  coderay (1.1.3)
36
- concurrent-ruby (1.1.8)
36
+ concurrent-ruby (1.1.9)
37
37
  crack (0.4.5)
38
38
  rexml
39
39
  csv (3.1.5)
40
40
  deep_merge (1.2.1)
41
41
  diff-lcs (1.4.4)
42
42
  docopt (0.6.1)
43
- facter (4.1.1)
43
+ facter (4.2.1)
44
44
  hocon (~> 1.3)
45
45
  thor (>= 1.0.1, < 2.0)
46
46
  fast_gettext (1.1.2)
47
- ffi (1.15.0)
47
+ ffi (1.15.1)
48
48
  gettext (3.2.9)
49
49
  locale (>= 2.0.5)
50
50
  text (>= 1.3.0)
@@ -54,7 +54,7 @@ GEM
54
54
  locale
55
55
  hashdiff (1.0.1)
56
56
  hiera (3.7.0)
57
- hiera-eyaml (3.2.1)
57
+ hiera-eyaml (3.2.2)
58
58
  highline
59
59
  optimist
60
60
  highline (2.0.3)
@@ -79,16 +79,16 @@ GEM
79
79
  coderay (~> 1.1)
80
80
  method_source (~> 1.0)
81
81
  public_suffix (4.0.6)
82
- puppet-resource_api (1.8.13)
82
+ puppet-resource_api (1.8.14)
83
83
  hocon (>= 1.0)
84
- puppetserver-ca (1.9.4)
84
+ puppetserver-ca (1.9.5)
85
85
  facter (>= 2.0.1, < 5)
86
86
  racc (1.4.9)
87
87
  rainbow (2.2.2)
88
88
  rake
89
89
  rake (12.3.3)
90
90
  rdiscount (2.2.0.2)
91
- rdoc (6.3.0)
91
+ rdoc (6.3.1)
92
92
  release-metrics (1.1.0)
93
93
  csv
94
94
  docopt
@@ -124,12 +124,12 @@ GEM
124
124
  rubocop (~> 0.49.0)
125
125
  ruby-prof (1.4.3)
126
126
  ruby-progressbar (1.11.0)
127
- semantic_puppet (1.0.3)
127
+ semantic_puppet (1.0.4)
128
128
  text (1.3.1)
129
129
  thor (1.1.0)
130
130
  unicode-display_width (1.7.0)
131
131
  vcr (5.1.0)
132
- webmock (3.12.2)
132
+ webmock (3.13.0)
133
133
  addressable (>= 2.3.6)
134
134
  crack (>= 0.3.2)
135
135
  hashdiff (>= 0.4.0, < 2.0.0)
data/ext/osx/puppet.plist CHANGED
@@ -26,5 +26,7 @@
26
26
  <string>/var/log/puppetlabs/puppet/puppet.log</string>
27
27
  <key>StandardOutPath</key>
28
28
  <string>/var/log/puppetlabs/puppet/puppet.log</string>
29
+ <key>SessionCreate</key>
30
+ <true />
29
31
  </dict>
30
32
  </plist>
@@ -133,9 +133,12 @@ Some flags are meant specifically for interactive use --- in particular,
133
133
  'test', 'tags' and 'fingerprint' are useful.
134
134
 
135
135
  '--test' runs once in the foreground with verbose logging, then exits.
136
- It also exits if it can't get a valid catalog. `--test` includes the '--detailed-exitcodes' option by default and exits with one of the following exit codes:
136
+ It also exits if it can't get a valid catalog. `--test` includes the
137
+ '--detailed-exitcodes' option by default and exits with one of the following
138
+ exit codes:
137
139
 
138
- * 0: The run succeeded with no changes or failures; the system was already in the desired state.
140
+ * 0: The run succeeded with no changes or failures; the system was already in
141
+ the desired state.
139
142
  * 1: The run failed, or wasn't attempted due to another run already in progress.
140
143
  * 2: The run succeeded, and some resources were changed.
141
144
  * 4: The run succeeded, and some resources failed.
@@ -246,7 +249,9 @@ generated by running puppet agent with '--genconfig'.
246
249
  'puppet agent' exits after executing this.
247
250
 
248
251
  * --evaltrace:
249
- Logs each resource as it is being evaluated. This allows you to interactively see exactly what is being done. (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
252
+ Logs each resource as it is being evaluated. This allows you to interactively
253
+ see exactly what is being done. (This is a Puppet setting, and can go in
254
+ puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
250
255
 
251
256
  * --fingerprint:
252
257
  Display the current certificate or certificate signing request
@@ -267,7 +272,8 @@ generated by running puppet agent with '--genconfig'.
267
272
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
268
273
  file. If debugging or verbosity is enabled, this defaults to 'console'.
269
274
  Otherwise, it defaults to 'syslog' on POSIX systems and 'eventlog' on Windows.
270
- Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
275
+ Multiple destinations can be set using a comma separated list
276
+ (eg: `/path/file1,console,/path/file2`)"
271
277
 
272
278
  A path ending with '.json' will receive structured output in JSON format. The
273
279
  log file will not have an ending ']' automatically written to it due to the
@@ -310,7 +316,8 @@ generated by running puppet agent with '--genconfig'.
310
316
  'no-splay', and 'show_diff'.
311
317
 
312
318
  * --trace
313
- Prints stack traces on some errors. (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
319
+ Prints stack traces on some errors. (This is a Puppet setting, and can go in
320
+ puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
314
321
 
315
322
  * --verbose:
316
323
  Turn on verbose reporting.
@@ -113,7 +113,8 @@ configuration options by running puppet with
113
113
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
114
114
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
115
115
  file. Defaults to 'console'.
116
- Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
116
+ Multiple destinations can be set using a comma separated list
117
+ (eg: `/path/file1,console,/path/file2`)"
117
118
 
118
119
  A path ending with '.json' will receive structured output in JSON format. The
119
120
  log file will not have an ending ']' automatically written to it due to the
@@ -155,7 +155,8 @@ you can specify '--server <servername>' as an argument.
155
155
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
156
156
  service), 'console', or the path to a log file. If debugging or verbosity is
157
157
  enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
158
- Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
158
+ Multiple destinations can be set using a comma separated list
159
+ (eg: `/path/file1,console,/path/file2`)"
159
160
 
160
161
  A path ending with '.json' will receive structured output in JSON format. The
161
162
  log file will not have an ending ']' automatically written to it due to the
@@ -101,7 +101,8 @@ configuration options can also be generated by running puppet with
101
101
  Print extra information.
102
102
 
103
103
  * --to_yaml:
104
- Output found resources in yaml format, suitable to use with Hiera and create_resources.
104
+ Output found resources in yaml format, suitable to use with Hiera and
105
+ create_resources.
105
106
 
106
107
  EXAMPLE
107
108
  -------
@@ -71,7 +71,8 @@ configuration options can also be generated by running puppet with
71
71
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
72
72
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
73
73
  file. Defaults to 'console'.
74
- Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
74
+ Multiple destinations can be set using a comma separated list
75
+ (eg: `/path/file1,console,/path/file2`)"
75
76
 
76
77
  A path ending with '.json' will receive structured output in JSON format. The
77
78
  log file will not have an ending ']' automatically written to it due to the
@@ -73,7 +73,8 @@ class Puppet::Configurer::Downloader
73
73
  :purge => true,
74
74
  :force => true,
75
75
  :backup => false,
76
- :noop => false
76
+ :noop => false,
77
+ :max_files => -1
77
78
  }
78
79
  if !Puppet::Util::Platform.windows?
79
80
  defargs[:owner] = Process.uid
@@ -878,8 +878,8 @@ names.
878
878
  **Note:** The list of alternate names is locked in when the server's
879
879
  certificate is signed. If you need to change the list later, you can't just
880
880
  change this setting; you also need to regenerate the certificate. For more
881
- information on that process, see the [cert regen docs]
882
- (https://puppet.com/docs/puppet/latest/ssl_regenerate_certificates.html).
881
+ information on that process, see the
882
+ [cert regen docs](https://puppet.com/docs/puppet/latest/ssl_regenerate_certificates.html).
883
883
 
884
884
  To see all the alternate names your servers are using, log into your CA server
885
885
  and run `puppetserver ca list --all`, then check the output for `(alt names: ...)`.
@@ -1517,7 +1517,9 @@ EOT
1517
1517
  See the report reference for information on the built-in report
1518
1518
  handlers; custom report handlers can also be loaded from modules.
1519
1519
  (Report handlers are loaded from the lib directory, at
1520
- `puppet/reports/NAME.rb`.)",
1520
+ `puppet/reports/NAME.rb`.)
1521
+
1522
+ To turn off reports entirely, set this to `none`",
1521
1523
  },
1522
1524
  :reportdir => {
1523
1525
  :default => "$vardir/reports",
@@ -5,7 +5,7 @@ require 'puppet/file_serving/metadata'
5
5
  # Operate recursively on a path, returning a set of file paths.
6
6
  class Puppet::FileServing::Fileset
7
7
  attr_reader :path, :ignore, :links
8
- attr_accessor :recurse, :recurselimit, :checksum_type
8
+ attr_accessor :recurse, :recurselimit, :max_files, :checksum_type
9
9
 
10
10
  # Produce a hash of files, with merged so that earlier files
11
11
  # with the same postfix win. E.g., /dir1/subfile beats /dir2/subfile.
@@ -40,6 +40,7 @@ class Puppet::FileServing::Fileset
40
40
  self.links = :manage
41
41
  @recurse = false
42
42
  @recurselimit = :infinite
43
+ @max_files = 0
43
44
 
44
45
  if options.is_a?(Puppet::Indirector::Request)
45
46
  initialize_from_request(options)
@@ -58,6 +59,17 @@ class Puppet::FileServing::Fileset
58
59
  # level deep, which Find doesn't do.
59
60
  def files
60
61
  files = perform_recursion
62
+ soft_max_files = 1000
63
+
64
+ # munged_max_files is needed since puppet http handler is keeping negative numbers as strings
65
+ # https://github.com/puppetlabs/puppet/blob/main/lib/puppet/network/http/handler.rb#L196-L197
66
+ munged_max_files = max_files == '-1' ? -1 : max_files
67
+
68
+ if munged_max_files > 0 && files.size > munged_max_files
69
+ raise Puppet::Error.new _("The directory '%{path}' contains %{entries} entries, which exceeds the limit of %{munged_max_files} specified by the max_files parameter for this resource. The limit may be increased, but be aware that large number of file resources can result in excessive resource consumption and degraded performance. Consider using an alternate method to manage large directory trees") % { path: path, entries: files.size, munged_max_files: munged_max_files }
70
+ elsif munged_max_files == 0 && files.size > soft_max_files
71
+ Puppet.warning _("The directory '%{path}' contains %{entries} entries, which exceeds the default soft limit %{soft_max_files} and may cause excessive resource consumption and degraded performance. To remove this warning set a value for `max_files` parameter or consider using an alternate method to manage large directory trees") % { path: path, entries: files.size, soft_max_files: soft_max_files }
72
+ end
61
73
 
62
74
  # Now strip off the leading path, so each file becomes relative, and remove
63
75
  # any slashes that might end up at the beginning of the path.
@@ -96,7 +108,7 @@ class Puppet::FileServing::Fileset
96
108
  end
97
109
 
98
110
  def initialize_from_request(request)
99
- [:links, :ignore, :recurse, :recurselimit, :checksum_type].each do |param|
111
+ [:links, :ignore, :recurse, :recurselimit, :max_files, :checksum_type].each do |param|
100
112
  if request.options.include?(param) # use 'include?' so the values can be false
101
113
  value = request.options[param]
102
114
  elsif request.options.include?(param.to_s)
@@ -51,7 +51,7 @@
51
51
  # notice $data.all |$key, $value| { $value % 10 == 0 and $key =~ /^abc/ }
52
52
  # ```
53
53
  #
54
- # Would notice true.
54
+ # Would notice `true`.
55
55
  #
56
56
  # For an general examples that demonstrates iteration, see the Puppet
57
57
  # [iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
@@ -3,7 +3,7 @@
3
3
  # This function is compatible with the stdlib function with the same name.
4
4
  #
5
5
  # The function does the following:
6
- # * For a `String` the conversion replaces all combinations of *_<char>* with an upcased version of the
6
+ # * For a `String` the conversion replaces all combinations of `*_<char>*` with an upcased version of the
7
7
  # character following the _. This is done using Ruby system locale which handles some, but not all
8
8
  # special international up-casing rules (for example German double-s ß is upcased to "Ss").
9
9
  # * For an `Iterable[Variant[String, Numeric]]` (for example an `Array`) each value is capitalized and the conversion is not recursive.
@@ -18,14 +18,14 @@
18
18
  # 'hello'.capitalize()
19
19
  # upcase('hello')
20
20
  # ```
21
- # Would both result in "Hello"
21
+ # Would both result in `"Hello"`
22
22
  #
23
23
  # @example Capitalizing strings in an Array
24
24
  # ```puppet
25
25
  # ['abc', 'bcd'].capitalize()
26
26
  # capitalize(['abc', 'bcd'])
27
27
  # ```
28
- # Would both result in ['Abc', 'Bcd']
28
+ # Would both result in `['Abc', 'Bcd']`
29
29
  #
30
30
  Puppet::Functions.create_function(:capitalize) do
31
31
 
@@ -22,14 +22,14 @@
22
22
  # 'HELLO'.downcase()
23
23
  # downcase('HEllO')
24
24
  # ```
25
- # Would both result in "hello"
25
+ # Would both result in `"hello"`
26
26
  #
27
27
  # @example Converting an Array to lower case
28
28
  # ```puppet
29
29
  # ['A', 'B'].downcase()
30
30
  # downcase(['A', 'B'])
31
31
  # ```
32
- # Would both result in ['a', 'b']
32
+ # Would both result in `['a', 'b']`
33
33
  #
34
34
  # @example Converting a Hash to lower case
35
35
  # ```puppet
@@ -23,20 +23,20 @@
23
23
  # #get($facts, 'os.family')
24
24
  # $facts.get('os.family')
25
25
  # ```
26
- # Would both result in the value of $facts['os']['family']
26
+ # Would both result in the value of `$facts['os']['family']`
27
27
  #
28
28
  # @example Getting the value from an expression
29
29
  # ```puppet
30
30
  # get([1,2,[{'name' =>'waldo'}]], '2.0.name')
31
31
  # ```
32
- # Would result in 'waldo'
32
+ # Would result in `'waldo'`
33
33
  #
34
34
  # @example Using a default value
35
35
  # ```puppet
36
36
  # get([1,2,[{'name' =>'waldo'}]], '2.1.name', 'not waldo')
37
37
  #
38
38
  # ```
39
- # Would result in 'not waldo'
39
+ # Would result in `'not waldo'`
40
40
  #
41
41
  # @example Quoting a key with period
42
42
  # ```puppet
@@ -128,8 +128,8 @@ Puppet::Functions.create_function(:get, Puppet::Functions::InternalFunction) do
128
128
 
129
129
  # Note: split_key always processes the initial segment as a string even if it could be an integer.
130
130
  # This since it is designed for lookup keys. For a numeric first segment
131
- # like '0.1' the wanted result is [0,1], not ["0", 1]. The workaround here is to
132
- # prefix the navigation with "x." thus giving split_key a first segment that is a string.
131
+ # like '0.1' the wanted result is `[0,1]`, not `["0", 1]`. The workaround here is to
132
+ # prefix the navigation with `"x."` thus giving split_key a first segment that is a string.
133
133
  # The fake segment is then dropped.
134
134
  segments = split_key("x." + navigation) {|err| _("Syntax error in dotted-navigation string")}
135
135
  segments.shift
@@ -4,14 +4,22 @@
4
4
  # and the values are arrays of elements in the collection that correspond to the key.
5
5
  Puppet::Functions.create_function(:group_by) do
6
6
  # @param collection A collection of things to group.
7
- # @example Group array of strings by length, results in e.g. { 1 => [a, b], 2 => [ab] }
7
+ # @example Group array of strings by length, results in e.g. `{ 1 => [a, b], 2 => [ab] }`
8
+ # ```puppet
8
9
  # [a, b, ab].group_by |$s| { $s.length }
9
- # @example Group array of strings by length and index, results in e.g. {1 => ['a'], 2 => ['b', 'ab']}
10
+ # ```
11
+ # @example Group array of strings by length and index, results in e.g. `{1 => ['a'], 2 => ['b', 'ab']}`
12
+ # ```puppet
10
13
  # [a, b, ab].group_by |$i, $s| { $i%2 + $s.length }
11
- # @example Group hash iterating by key-value pair, results in e.g. { 2 => [['a', [1, 2]]], 1 => [['b', [1]]] }
14
+ # ```
15
+ # @example Group hash iterating by key-value pair, results in e.g. `{ 2 => [['a', [1, 2]]], 1 => [['b', [1]]] }`
16
+ # ```puppet
12
17
  # { a => [1, 2], b => [1] }.group_by |$kv| { $kv[1].length }
13
- # @example Group hash iterating by key and value, results in e.g. { 2 => [['a', [1, 2]]], 1 => [['b', [1]]] }
14
- # { a => [1, 2], b => [1] }.group_by |$k, $v| { $v.length }
18
+ # ```
19
+ # @example Group hash iterating by key and value, results in e.g. `{ 2 => [['a', [1, 2]]], 1 => [['b', [1]]] }`
20
+ # ```puppet
21
+ # { a => [1, 2], b => [1] }.group_by |$k, $v| { $v.length }
22
+ # ```
15
23
  dispatch :group_by_1 do
16
24
  required_param 'Collection', :collection
17
25
  block_param 'Callable[1,1]', :block
@@ -23,7 +23,7 @@
23
23
  # .lest || { fail("no value for $data[a][b][c]" }
24
24
  # ```
25
25
  #
26
- # Would fail the operation because $data[a][b][c] results in `undef`
26
+ # Would fail the operation because `$data[a][b][c]` results in `undef`
27
27
  # (there is no `b` key in `a`).
28
28
  #
29
29
  # In contrast - this example: