puppet 6.22.1-x64-mingw32 → 6.23.0-x64-mingw32
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/ext/osx/puppet.plist +2 -0
- data/lib/puppet/application/agent.rb +12 -5
- data/lib/puppet/application/apply.rb +2 -1
- data/lib/puppet/application/device.rb +2 -1
- data/lib/puppet/application/resource.rb +2 -1
- data/lib/puppet/application/script.rb +2 -1
- data/lib/puppet/configurer/downloader.rb +2 -1
- data/lib/puppet/defaults.rb +5 -3
- data/lib/puppet/file_serving/fileset.rb +14 -2
- data/lib/puppet/functions/all.rb +1 -1
- data/lib/puppet/functions/camelcase.rb +1 -1
- data/lib/puppet/functions/capitalize.rb +2 -2
- data/lib/puppet/functions/downcase.rb +2 -2
- data/lib/puppet/functions/get.rb +5 -5
- data/lib/puppet/functions/group_by.rb +13 -5
- data/lib/puppet/functions/lest.rb +1 -1
- data/lib/puppet/functions/new.rb +100 -100
- data/lib/puppet/functions/partition.rb +4 -4
- data/lib/puppet/functions/require.rb +5 -5
- data/lib/puppet/functions/sort.rb +3 -3
- data/lib/puppet/functions/tree_each.rb +7 -9
- data/lib/puppet/functions/type.rb +4 -4
- data/lib/puppet/functions/upcase.rb +2 -2
- data/lib/puppet/http/resolver/server_list.rb +15 -4
- data/lib/puppet/http/service/compiler.rb +69 -0
- data/lib/puppet/http/service/file_server.rb +2 -1
- data/lib/puppet/indirector/catalog/compiler.rb +1 -0
- data/lib/puppet/indirector/file_metadata/rest.rb +1 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +14 -6
- data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
- data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
- data/lib/puppet/provider/package/nim.rb +11 -6
- data/lib/puppet/provider/service/systemd.rb +13 -3
- data/lib/puppet/provider/service/windows.rb +38 -0
- data/lib/puppet/provider/user/directoryservice.rb +25 -12
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
- data/lib/puppet/type/file.rb +19 -1
- data/lib/puppet/type/file/selcontext.rb +1 -1
- data/lib/puppet/type/service.rb +18 -38
- data/lib/puppet/type/tidy.rb +21 -2
- data/lib/puppet/type/user.rb +38 -20
- data/lib/puppet/util/selinux.rb +30 -4
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +109 -101
- data/man/man5/puppet.conf.5 +272 -252
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/ssl/127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/127.0.0.1.pem +52 -31
- data/spec/fixtures/ssl/bad-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/ca.pem +57 -35
- data/spec/fixtures/ssl/crl.pem +28 -18
- data/spec/fixtures/ssl/ec-key.pem +11 -11
- data/spec/fixtures/ssl/ec.pem +33 -24
- data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
- data/spec/fixtures/ssl/encrypted-key.pem +108 -58
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +28 -19
- data/spec/fixtures/ssl/intermediate-agent.pem +57 -36
- data/spec/fixtures/ssl/intermediate-crl.pem +31 -21
- data/spec/fixtures/ssl/intermediate.pem +57 -36
- data/spec/fixtures/ssl/pluto-key.pem +107 -57
- data/spec/fixtures/ssl/pluto.pem +52 -30
- data/spec/fixtures/ssl/request-key.pem +107 -57
- data/spec/fixtures/ssl/request.pem +47 -26
- data/spec/fixtures/ssl/revoked-key.pem +107 -57
- data/spec/fixtures/ssl/revoked.pem +52 -30
- data/spec/fixtures/ssl/signed-key.pem +107 -57
- data/spec/fixtures/ssl/signed.pem +52 -30
- data/spec/fixtures/ssl/tampered-cert.pem +52 -30
- data/spec/fixtures/ssl/tampered-csr.pem +47 -26
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +50 -29
- data/spec/fixtures/ssl/unknown-ca-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-ca.pem +55 -33
- data/spec/integration/application/resource_spec.rb +30 -0
- data/spec/lib/puppet/test_ca.rb +2 -2
- data/spec/unit/application/agent_spec.rb +7 -2
- data/spec/unit/configurer/downloader_spec.rb +6 -0
- data/spec/unit/configurer_spec.rb +23 -0
- data/spec/unit/file_serving/fileset_spec.rb +60 -0
- data/spec/unit/gettext/config_spec.rb +12 -0
- data/spec/unit/http/service/compiler_spec.rb +123 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +14 -10
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +15 -1
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
- data/spec/unit/provider/package/nim_spec.rb +42 -0
- data/spec/unit/provider/service/init_spec.rb +1 -0
- data/spec/unit/provider/service/openwrt_spec.rb +3 -1
- data/spec/unit/provider/service/systemd_spec.rb +42 -8
- data/spec/unit/provider/service/windows_spec.rb +202 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +67 -35
- data/spec/unit/ssl/state_machine_spec.rb +19 -5
- data/spec/unit/transaction/additional_resource_generator_spec.rb +0 -2
- data/spec/unit/transaction_spec.rb +18 -20
- data/spec/unit/type/file/selinux_spec.rb +3 -3
- data/spec/unit/type/service_spec.rb +59 -188
- data/spec/unit/type/tidy_spec.rb +17 -7
- data/spec/unit/type/user_spec.rb +45 -0
- data/spec/unit/util/selinux_spec.rb +87 -16
- data/tasks/generate_cert_fixtures.rake +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '039f51c72f429dd07abf7008f97a11344cd150d8070ecd3012c19368beb31569'
|
4
|
+
data.tar.gz: 26d8e4acf456f6e09a541359a5b24c449a39aa1db09b0c911aea2db05a861c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b045dd0cb388f971529bf5fe20d96b570c06ecfc5406a249f51c6030223548b00b19676a6b0d0aaa53259e2acebb67a9738dd95bac2a162ce869a1be14d26250
|
7
|
+
data.tar.gz: 6cb9a599d7ac5987eac8fd726418f9642a80e263aa491c1ee094c4a6177f9b897d6d1b82d64c27b5f497399a1f41900f7b33e09553f88c31acb07961098ae750
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GIT
|
2
|
-
remote: git://github.com/
|
3
|
-
revision:
|
4
|
-
branch:
|
2
|
+
remote: git://github.com/puppetlabs/packaging
|
3
|
+
revision: 9ddc3c730023911b5ef015dc55a4d2e9a55e4a6c
|
4
|
+
branch: 1.0.x
|
5
5
|
specs:
|
6
|
-
packaging (0.99.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
82
|
+
puppet-resource_api (1.8.14)
|
83
83
|
hocon (>= 1.0)
|
84
|
-
puppetserver-ca (1.9.
|
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.
|
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.
|
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.
|
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
@@ -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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
data/lib/puppet/defaults.rb
CHANGED
@@ -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
|
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)
|
data/lib/puppet/functions/all.rb
CHANGED
@@ -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
|
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
|
data/lib/puppet/functions/get.rb
CHANGED
@@ -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
|
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]
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
14
|
-
#
|
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
|
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:
|
data/lib/puppet/functions/new.rb
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
# The following sections show the arguments and conversion rules
|
52
52
|
# per data type built into the Puppet Type System.
|
53
53
|
#
|
54
|
-
# ### Conversion to Optional[T] and NotUndef[T]
|
54
|
+
# ### Conversion to `Optional[T]` and `NotUndef[T]`
|
55
55
|
#
|
56
56
|
# Conversion to these data types is the same as a conversion to the type argument `T`.
|
57
57
|
# In the case of `Optional[T]` it is accepted that the argument to convert may be `undef`.
|
@@ -85,13 +85,13 @@
|
|
85
85
|
# * `0` as radix 8.
|
86
86
|
# * All others are decimal.
|
87
87
|
# * Conversion from `String` accepts an optional sign in the string.
|
88
|
-
# * For hexadecimal (radix 16) conversion an optional leading "0x"
|
89
|
-
# * For octal (radix 8) an optional leading "0" is accepted.
|
90
|
-
# * For binary (radix 2) an optional leading "0b" or "0B" is accepted.
|
88
|
+
# * For hexadecimal (radix 16) conversion an optional leading `"0x"`, or `"0X"` is accepted.
|
89
|
+
# * For octal (radix 8) an optional leading `"0"` is accepted.
|
90
|
+
# * For binary (radix 2) an optional leading `"0b"` or `"0B"` is accepted.
|
91
91
|
# * When `radix` is set to `default`, the conversion is based on the leading.
|
92
|
-
# characters in the string. A leading "0" for radix 8, a leading "0x"
|
93
|
-
# radix 16, and leading "0b" or "0B" for binary.
|
94
|
-
# * Conversion from `Boolean` results in 0 for `false` and 1 for `true`.
|
92
|
+
# characters in the string. A leading `"0"` for radix 8, a leading `"0x"`, or `"0X"` for
|
93
|
+
# radix 16, and leading `"0b"` or `"0B"` for binary.
|
94
|
+
# * Conversion from `Boolean` results in `0` for `false` and `1` for `true`.
|
95
95
|
# * Conversion from `Integer`, `Float`, and `Boolean` ignores the radix.
|
96
96
|
# * `Float` value fractions are truncated (no rounding).
|
97
97
|
# * When `abs` is set to `true`, the result will be an absolute integer.
|
@@ -119,9 +119,9 @@
|
|
119
119
|
# ```
|
120
120
|
#
|
121
121
|
# * For an integer, the floating point fraction of `.0` is added to the value.
|
122
|
-
# * A `Boolean` `true` is converted to 1.0
|
122
|
+
# * A `Boolean` `true` is converted to `1.0`, and a `false` to `0.0`.
|
123
123
|
# * In `String` format, integer prefixes for hex and binary are understood (but not octal since
|
124
|
-
# floating point in string format may start with a '0').
|
124
|
+
# floating point in string format may start with a `'0'`).
|
125
125
|
# * When `abs` is set to `true`, the result will be an absolute floating point value.
|
126
126
|
#
|
127
127
|
# ### Conversion to Numeric
|
@@ -139,7 +139,7 @@
|
|
139
139
|
# * If the value has a decimal period, or if given in scientific notation
|
140
140
|
# (e/E), the result is a `Float`, otherwise the value is an `Integer`. The
|
141
141
|
# conversion from `String` always uses a radix based on the prefix of the string.
|
142
|
-
# * Conversion from `Boolean` results in 0 for `false` and 1 for `true`.
|
142
|
+
# * Conversion from `Boolean` results in `0` for `false` and `1` for `true`.
|
143
143
|
# * When `abs` is set to `true`, the result will be an absolute `Float`or `Integer` value.
|
144
144
|
#
|
145
145
|
# @example Converting to Numeric in different ways
|
@@ -225,7 +225,7 @@
|
|
225
225
|
# )
|
226
226
|
# ```
|
227
227
|
#
|
228
|
-
# The directive consists of a percent (
|
228
|
+
# The directive consists of a percent (`%`) character, zero or more flags, optional minimum field width and
|
229
229
|
# a conversion specifier as follows:
|
230
230
|
# ```
|
231
231
|
# %[Flags][Width]Conversion
|
@@ -291,7 +291,7 @@
|
|
291
291
|
# argument is omitted, an array of default formats will be used.
|
292
292
|
#
|
293
293
|
# A third optional timezone argument can be provided. The first argument will then be parsed as if it represents a local time in that
|
294
|
-
# timezone. The timezone can be any timezone that is recognized when using the '%z' or '%Z' formats, or the word 'current'
|
294
|
+
# timezone. The timezone can be any timezone that is recognized when using the `'%z'` or `'%Z'` formats, or the word `'current'`, in which
|
295
295
|
# case the current timezone of the evaluating process will be used. The timezone argument is case insensitive.
|
296
296
|
#
|
297
297
|
# The default timezone, when no argument is provided, or when using the keyword `default`, is 'UTC'.
|
@@ -336,7 +336,7 @@
|
|
336
336
|
# | 0 | Use zeros for padding
|
337
337
|
# | # | Change names to upper-case or change case of am/pm
|
338
338
|
# | ^ | Use uppercase
|
339
|
-
# | : | Use colons for
|
339
|
+
# | : | Use colons for `%z`
|
340
340
|
#
|
341
341
|
# ##### Format directives (names and padding can be altered using flags):
|
342
342
|
#
|
@@ -345,48 +345,48 @@
|
|
345
345
|
# | Format | Meaning |
|
346
346
|
# | ------ | ------- |
|
347
347
|
# | Y | Year with century, zero-padded to at least 4 digits |
|
348
|
-
# | C | year / 100 (rounded down such as 20 in 2009) |
|
349
|
-
# | y | year % 100 (00..99) |
|
350
|
-
# | m | Month of the year, zero-padded (01..12) |
|
351
|
-
# | B | The full month name ("January") |
|
352
|
-
# | b | The abbreviated month name ("Jan") |
|
353
|
-
# | h | Equivalent to
|
354
|
-
# | d | Day of the month, zero-padded (01..31) |
|
355
|
-
# | e | Day of the month, blank-padded (
|
356
|
-
# | j | Day of the year (001..366) |
|
348
|
+
# | C | year / 100 (rounded down such as `20` in `2009`) |
|
349
|
+
# | y | year % 100 (`00..99`) |
|
350
|
+
# | m | Month of the year, zero-padded (`01..12`) |
|
351
|
+
# | B | The full month name (`"January"`) |
|
352
|
+
# | b | The abbreviated month name (`"Jan"`) |
|
353
|
+
# | h | Equivalent to `%b` |
|
354
|
+
# | d | Day of the month, zero-padded (`01..31`) |
|
355
|
+
# | e | Day of the month, blank-padded (`1..31`) |
|
356
|
+
# | j | Day of the year (`001..366`) |
|
357
357
|
#
|
358
358
|
# **Time (Hour, Minute, Second, Subsecond):**
|
359
359
|
#
|
360
360
|
# | Format | Meaning |
|
361
361
|
# | ------ | ------- |
|
362
|
-
# | H | Hour of the day, 24-hour clock, zero-padded (00..23) |
|
363
|
-
# | k | Hour of the day, 24-hour clock, blank-padded (
|
364
|
-
# | I | Hour of the day, 12-hour clock, zero-padded (01..12) |
|
365
|
-
# | l | Hour of the day, 12-hour clock, blank-padded (
|
366
|
-
# | P | Meridian indicator, lowercase ("am" or "pm") |
|
367
|
-
# | p | Meridian indicator, uppercase ("AM" or "PM") |
|
368
|
-
# | M | Minute of the hour (00..59) |
|
369
|
-
# | S | Second of the minute (00..60) |
|
370
|
-
# | L | Millisecond of the second (000..999). Digits under millisecond are truncated to not produce 1000 |
|
362
|
+
# | H | Hour of the day, 24-hour clock, zero-padded (`00..23`) |
|
363
|
+
# | k | Hour of the day, 24-hour clock, blank-padded (`0..23`) |
|
364
|
+
# | I | Hour of the day, 12-hour clock, zero-padded (`01..12`) |
|
365
|
+
# | l | Hour of the day, 12-hour clock, blank-padded (`1..12`) |
|
366
|
+
# | P | Meridian indicator, lowercase (`"am"` or `"pm"`) |
|
367
|
+
# | p | Meridian indicator, uppercase (`"AM"` or `"PM"`) |
|
368
|
+
# | M | Minute of the hour (`00..59`) |
|
369
|
+
# | S | Second of the minute (`00..60`) |
|
370
|
+
# | L | Millisecond of the second (`000..999`). Digits under millisecond are truncated to not produce 1000 |
|
371
371
|
# | N | Fractional seconds digits, default is 9 digits (nanosecond). Digits under a specified width are truncated to avoid carry up |
|
372
372
|
#
|
373
373
|
# **Time (Hour, Minute, Second, Subsecond):**
|
374
374
|
#
|
375
375
|
# | Format | Meaning |
|
376
376
|
# | ------ | ------- |
|
377
|
-
# | z | Time zone as hour and minute offset from UTC (e.g.
|
378
|
-
# | :z | hour and minute offset from UTC with a colon (e.g.
|
379
|
-
# | ::z | hour, minute and second offset from UTC (e.g.
|
377
|
+
# | z | Time zone as hour and minute offset from UTC (e.g. `+0900`) |
|
378
|
+
# | :z | hour and minute offset from UTC with a colon (e.g. `+09:00`) |
|
379
|
+
# | ::z | hour, minute and second offset from UTC (e.g. `+09:00:00`) |
|
380
380
|
# | Z | Abbreviated time zone name or similar information. (OS dependent) |
|
381
381
|
#
|
382
382
|
# **Weekday:**
|
383
383
|
#
|
384
384
|
# | Format | Meaning |
|
385
385
|
# | ------ | ------- |
|
386
|
-
# | A | The full weekday name ("Sunday") |
|
387
|
-
# | a | The abbreviated name ("Sun") |
|
388
|
-
# | u | Day of the week (Monday is 1
|
389
|
-
# | w | Day of the week (Sunday is 0
|
386
|
+
# | A | The full weekday name (`"Sunday"`) |
|
387
|
+
# | a | The abbreviated name (`"Sun"`) |
|
388
|
+
# | u | Day of the week (Monday is `1`, `1..7`) |
|
389
|
+
# | w | Day of the week (Sunday is `0`, `0..6`) |
|
390
390
|
#
|
391
391
|
# **ISO 8601 week-based year and week number:**
|
392
392
|
#
|
@@ -397,8 +397,8 @@
|
|
397
397
|
# | Format | Meaning |
|
398
398
|
# | ------ | ------- |
|
399
399
|
# | G | The week-based year |
|
400
|
-
# | g | The last 2 digits of the week-based year (00..99) |
|
401
|
-
# | V | Week number of the week-based year (01..53) |
|
400
|
+
# | g | The last 2 digits of the week-based year (`00..99`) |
|
401
|
+
# | V | Week number of the week-based year (`01..53`) |
|
402
402
|
#
|
403
403
|
# **Week number:**
|
404
404
|
#
|
@@ -407,8 +407,8 @@
|
|
407
407
|
#
|
408
408
|
# | Format | Meaning |
|
409
409
|
# | ------ | ------- |
|
410
|
-
# | U | Week number of the year. The week starts with Sunday. (00..53) |
|
411
|
-
# | W | Week number of the year. The week starts with Monday. (00..53) |
|
410
|
+
# | U | Week number of the year. The week starts with Sunday. (`00..53`) |
|
411
|
+
# | W | Week number of the year. The week starts with Monday. (`00..53`) |
|
412
412
|
#
|
413
413
|
# **Seconds since the Epoch:**
|
414
414
|
#
|
@@ -419,23 +419,23 @@
|
|
419
419
|
#
|
420
420
|
# | Format | Meaning |
|
421
421
|
# | ------ | ------- |
|
422
|
-
# | n | Newline character (
|
423
|
-
# | t | Tab character (
|
424
|
-
# | % | Literal
|
422
|
+
# | n | Newline character (`\n`) |
|
423
|
+
# | t | Tab character (`\t`) |
|
424
|
+
# | % | Literal `%` character |
|
425
425
|
#
|
426
426
|
# **Combination:**
|
427
427
|
#
|
428
428
|
# | Format | Meaning |
|
429
429
|
# | ------ | ------- |
|
430
|
-
# | c | date and time (
|
431
|
-
# | D | Date (
|
432
|
-
# | F | The ISO 8601 date format (
|
433
|
-
# | v | VMS date (
|
434
|
-
# | x | Same as
|
435
|
-
# | X | Same as
|
436
|
-
# | r | 12-hour time (
|
437
|
-
# | R | 24-hour time (
|
438
|
-
# | T | 24-hour time (
|
430
|
+
# | c | date and time (`%a %b %e %T %Y`) |
|
431
|
+
# | D | Date (`%m/%d/%y`) |
|
432
|
+
# | F | The ISO 8601 date format (`%Y-%m-%d`) |
|
433
|
+
# | v | VMS date (`%e-%^b-%4Y`) |
|
434
|
+
# | x | Same as `%D` |
|
435
|
+
# | X | Same as `%T` |
|
436
|
+
# | r | 12-hour time (`%I:%M:%S %p`) |
|
437
|
+
# | R | 24-hour time (`%H:%M`) |
|
438
|
+
# | T | 24-hour time (`%H:%M:%S`) |
|
439
439
|
#
|
440
440
|
# The default array contains the following patterns:
|
441
441
|
#
|
@@ -489,7 +489,7 @@
|
|
489
489
|
# The mapping from data type to format is referred to as the *format map*. This map
|
490
490
|
# allows different formatting depending on type.
|
491
491
|
#
|
492
|
-
# @example Positive Integers in Hexadecimal prefixed with '0x'
|
492
|
+
# @example Positive Integers in Hexadecimal prefixed with `'0x'`, negative in Decimal
|
493
493
|
#
|
494
494
|
# ```puppet
|
495
495
|
# $format_map = {
|
@@ -578,13 +578,13 @@
|
|
578
578
|
#
|
579
579
|
# | Format | Integer Formats
|
580
580
|
# | ------ | ---------------
|
581
|
-
# | d | Decimal, negative values produces leading
|
582
|
-
# | x X | Hexadecimal in lower or upper case. Uses
|
583
|
-
# | o | Octal. Uses
|
584
|
-
# | b B | Binary with prefix
|
585
|
-
# | c | Numeric value representing a Unicode value, result is a one unicode character string, quoted if alternative flag
|
586
|
-
# | s | Same as d
|
587
|
-
# | p | Same as d
|
581
|
+
# | d | Decimal, negative values produces leading `-`.
|
582
|
+
# | x X | Hexadecimal in lower or upper case. Uses `..f/..F` for negative values unless `+` is also used. A `#` adds prefix `0x/0X`.
|
583
|
+
# | o | Octal. Uses `..0` for negative values unless `+` is also used. A `#` adds prefix `0`.
|
584
|
+
# | b B | Binary with prefix `b` or `B`. Uses `..1/..1` for negative values unless `+` is also used.
|
585
|
+
# | c | Numeric value representing a Unicode value, result is a one unicode character string, quoted if alternative flag `#` is used
|
586
|
+
# | s | Same as `d`, or `d` in quotes if alternative flag `#` is used.
|
587
|
+
# | p | Same as `d`.
|
588
588
|
# | eEfgGaA | Converts integer to float and formats using the floating point rules.
|
589
589
|
#
|
590
590
|
# Defaults to `d`.
|
@@ -594,11 +594,11 @@
|
|
594
594
|
# | Format | Float formats
|
595
595
|
# | ------ | -------------
|
596
596
|
# | f | Floating point in non exponential notation.
|
597
|
-
# | e E | Exponential notation with
|
598
|
-
# | g G | Conditional exponential with
|
599
|
-
# | a A | Hexadecimal exponential form, using
|
600
|
-
# | s | Converted to string using format p
|
601
|
-
# | p | Same as f format with minimum significant number of fractional digits, prec has no effect.
|
597
|
+
# | e E | Exponential notation with `e` or `E`.
|
598
|
+
# | g G | Conditional exponential with `e` or `E` if exponent `< -4` or `>=` the precision.
|
599
|
+
# | a A | Hexadecimal exponential form, using `x`/`X` as prefix and `p`/`P` before exponent.
|
600
|
+
# | s | Converted to string using format `p`, then applying string formatting rule, alternate form `#`` quotes result.
|
601
|
+
# | p | Same as `f` format with minimum significant number of fractional digits, prec has no effect.
|
602
602
|
# | dxXobBc | Converts float to integer and formats using the integer rules.
|
603
603
|
#
|
604
604
|
# Defaults to `p`.
|
@@ -621,12 +621,12 @@
|
|
621
621
|
#
|
622
622
|
# | Format | Boolean Formats
|
623
623
|
# | ---- | -------------------
|
624
|
-
# | t T | String 'true'/'false' or 'True'/'False'
|
625
|
-
# | y Y | String 'yes'/'no'
|
626
|
-
# | dxXobB | Numeric value 0/1 in accordance with the given format which must be valid integer format.
|
627
|
-
# | eEfgGaA | Numeric value 0.0/1.0 in accordance with the given float format and flags.
|
628
|
-
# | s | String 'true' / 'false'
|
629
|
-
# | p | String 'true' / 'false'
|
624
|
+
# | t T | String `'true'/'false'` or `'True'/'False'`, first char if alternate form is used (i.e. `'t'/'f'` or `'T'/'F'`).
|
625
|
+
# | y Y | String `'yes'/'no'`, `'Yes'/'No'`, `'y'/'n'` or `'Y'/'N'` if alternative flag `#` is used.
|
626
|
+
# | dxXobB | Numeric value `0/1` in accordance with the given format which must be valid integer format.
|
627
|
+
# | eEfgGaA | Numeric value `0.0/1.0` in accordance with the given float format and flags.
|
628
|
+
# | s | String `'true'` / `'false'`.
|
629
|
+
# | p | String `'true'` / `'false'`.
|
630
630
|
#
|
631
631
|
# **Regexp to String**
|
632
632
|
#
|
@@ -640,33 +640,33 @@
|
|
640
640
|
# | Format | Undef formats
|
641
641
|
# | ------ | -------------
|
642
642
|
# | s | Empty string, or quoted empty string if alternative flag `#` is used.
|
643
|
-
# | p | String 'undef'
|
644
|
-
# | n | String 'nil'
|
645
|
-
# | dxXobB | String 'NaN'
|
646
|
-
# | eEfgGaA | String 'NaN'
|
647
|
-
# | v | String 'n/a'
|
648
|
-
# | V | String 'N/A'
|
649
|
-
# | u | String 'undef'
|
643
|
+
# | p | String `'undef'`, or quoted `'"undef"'` if alternative flag `#` is used.
|
644
|
+
# | n | String `'nil'`, or `'null'` if alternative flag `#` is used.
|
645
|
+
# | dxXobB | String `'NaN'`.
|
646
|
+
# | eEfgGaA | String `'NaN'`.
|
647
|
+
# | v | String `'n/a'`.
|
648
|
+
# | V | String `'N/A'`.
|
649
|
+
# | u | String `'undef'`, or `'undefined'` if alternative `#` flag is used.
|
650
650
|
#
|
651
651
|
# **Default value to String**
|
652
652
|
#
|
653
653
|
# | Format | Default formats
|
654
654
|
# | ------ | ---------------
|
655
|
-
# | d D | String 'default' or 'Default'
|
656
|
-
# | s | Same as d
|
657
|
-
# | p | Same as d
|
655
|
+
# | d D | String `'default'` or `'Default'`, alternative form `#` causes value to be quoted.
|
656
|
+
# | s | Same as `d`.
|
657
|
+
# | p | Same as `d`.
|
658
658
|
#
|
659
659
|
# **Binary value to String**
|
660
660
|
#
|
661
661
|
# | Format | Default formats
|
662
662
|
# | ------ | ---------------
|
663
663
|
# | s | binary as unquoted UTF-8 characters (errors if byte sequence is invalid UTF-8). Alternate form escapes non ascii bytes.
|
664
|
-
# | p | 'Binary("<base64strict>")'
|
665
|
-
# | b | '<base64>' - base64 string with newlines inserted
|
666
|
-
# | B | '<base64strict>' - base64 strict string (without newlines inserted)
|
667
|
-
# | u | '<base64urlsafe>' - base64 urlsafe string
|
668
|
-
# | t | 'Binary' - outputs the name of the type only
|
669
|
-
# | T | 'BINARY' - output the name of the type in all caps only
|
664
|
+
# | p | `'Binary("<base64strict>")'`
|
665
|
+
# | b | `'<base64>'` - base64 string with newlines inserted
|
666
|
+
# | B | `'<base64strict>'` - base64 strict string (without newlines inserted)
|
667
|
+
# | u | `'<base64urlsafe>'` - base64 urlsafe string
|
668
|
+
# | t | `'Binary'` - outputs the name of the type only
|
669
|
+
# | T | `'BINARY'` - output the name of the type in all caps only
|
670
670
|
#
|
671
671
|
# * The alternate form flag `#` will quote the binary or base64 text output.
|
672
672
|
# * The format `%#s` allows invalid UTF-8 characters and outputs all non ascii bytes
|
@@ -678,8 +678,8 @@
|
|
678
678
|
# | Format | Array/Tuple Formats
|
679
679
|
# | ------ | -------------
|
680
680
|
# | a | Formats with `[ ]` delimiters and `,`, alternate form `#` indents nested arrays/hashes.
|
681
|
-
# | s | Same as a
|
682
|
-
# | p | Same as a
|
681
|
+
# | s | Same as `a`.
|
682
|
+
# | p | Same as `a`.
|
683
683
|
#
|
684
684
|
# See "Flags" `<[({\|` for formatting of delimiters, and "Additional parameters for containers; Array and Hash" for
|
685
685
|
# more information about options.
|
@@ -695,7 +695,7 @@
|
|
695
695
|
# | h | Formats with `{ }` delimiters, `,` element separator and ` => ` inner element separator unless overridden by flags.
|
696
696
|
# | s | Same as h.
|
697
697
|
# | p | Same as h.
|
698
|
-
# | a | Converts the hash to an array of [k,v] tuples and formats it using array rule(s).
|
698
|
+
# | a | Converts the hash to an array of `[k,v]` tuples and formats it using array rule(s).
|
699
699
|
#
|
700
700
|
# See "Flags" `<[({\|` for formatting of delimiters, and "Additional parameters for containers; Array and Hash" for
|
701
701
|
# more information about options.
|
@@ -714,18 +714,18 @@
|
|
714
714
|
# | Flag | Effect
|
715
715
|
# | ------ | ------
|
716
716
|
# | (space) | A space instead of `+` for numeric output (`-` is shown), for containers skips delimiters.
|
717
|
-
# | # | Alternate format; prefix 0x/0x
|
718
|
-
# | + | Show sign
|
717
|
+
# | # | Alternate format; prefix `0x/0x`, `0` (octal) and `0b/0B` for binary, Floats force decimal '.'. For g/G keep trailing `0`.
|
718
|
+
# | + | Show sign `+/-` depending on value's sign, changes `x`, `X`, `o`, `b`, `B` format to not use 2's complement form.
|
719
719
|
# | - | Left justify the value in the given width.
|
720
|
-
# | 0 | Pad with 0 instead of space for widths larger than value.
|
721
|
-
# | <[({\| | Defines an enclosing pair
|
720
|
+
# | 0 | Pad with `0` instead of space for widths larger than value.
|
721
|
+
# | <[({\| | Defines an enclosing pair `<> [] () {} or \| \|` when used with a container type.
|
722
722
|
#
|
723
723
|
# ### Conversion to Boolean
|
724
724
|
#
|
725
725
|
# Accepts a single value as argument:
|
726
726
|
#
|
727
|
-
# * Float 0.0 is `false`, all other float values are `true`
|
728
|
-
# * Integer 0 is `false`, all other integer values are `true`
|
727
|
+
# * Float `0.0` is `false`, all other float values are `true`
|
728
|
+
# * Integer `0` is `false`, all other integer values are `true`
|
729
729
|
# * Strings
|
730
730
|
# * `true` if 'true', 'yes', 'y' (case independent compare)
|
731
731
|
# * `false` if 'false', 'no', 'n' (case independent compare)
|
@@ -840,7 +840,7 @@
|
|
840
840
|
# function SemVer.new(SemVerHash $hash_args)
|
841
841
|
# ```
|
842
842
|
#
|
843
|
-
# @example SemVer and SemVerRange usage
|
843
|
+
# @example `SemVer` and `SemVerRange` usage
|
844
844
|
#
|
845
845
|
# ```puppet
|
846
846
|
# # As a type, SemVer can describe disjunct ranges which versions can be
|
@@ -856,7 +856,7 @@
|
|
856
856
|
# notice(SemVer('3.4.5') =~ $t) # true
|
857
857
|
# ```
|
858
858
|
#
|
859
|
-
# ### Creating a SemVerRange
|
859
|
+
# ### Creating a `SemVerRange`
|
860
860
|
#
|
861
861
|
# A `SemVerRange` object represents a range of `SemVer`. It can be created from
|
862
862
|
# a `String`, or from two `SemVer` instances, where either end can be given as
|