puppet 5.5.8-universal-darwin → 5.5.10-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.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/Rakefile +3 -1
- data/ext/solaris/smf/svc-puppetd +8 -1
- data/ext/solaris/smf/svc-puppetmasterd +8 -1
- data/lib/puppet/application/device.rb +45 -29
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/forge.rb +4 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/lib/puppet/pops/types/string_converter.rb +11 -2
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
- data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/parsedfile.rb +25 -4
- data/lib/puppet/provider/service/smf.rb +54 -0
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/event_manager.rb +13 -1
- data/lib/puppet/transaction/resource_harness.rb +3 -1
- data/lib/puppet/util/command_line.rb +2 -3
- data/lib/puppet/util/filetype.rb +36 -4
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/registry.rb +29 -5
- data/lib/puppet/util/windows/service.rb +106 -99
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +97 -69
- data/man/man5/puppet.conf.5 +2 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +2 -2
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +23 -19
- 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-master.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-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
- data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
- data/spec/integration/ssl/key_spec.rb +0 -4
- data/spec/integration/transaction_spec.rb +1 -1
- data/spec/integration/util/windows/registry_spec.rb +39 -0
- data/spec/unit/application/device_spec.rb +4 -1
- data/spec/unit/application/lookup_spec.rb +10 -9
- data/spec/unit/forge/forge_spec.rb +4 -2
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_spec.rb +6 -7
- data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
- data/spec/unit/pops/types/string_converter_spec.rb +20 -0
- data/spec/unit/provider/cron/parsed_spec.rb +4 -3
- data/spec/unit/provider/group/ldap_spec.rb +22 -25
- data/spec/unit/provider/group/pw_spec.rb +7 -10
- data/spec/unit/provider/host/parsed_spec.rb +3 -17
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
- data/spec/unit/provider/package/aix_spec.rb +5 -8
- data/spec/unit/provider/package/apt_spec.rb +3 -6
- data/spec/unit/provider/package/dnf_spec.rb +29 -31
- data/spec/unit/provider/package/dpkg_spec.rb +18 -21
- data/spec/unit/provider/package/freebsd_spec.rb +4 -7
- data/spec/unit/provider/package/gem_spec.rb +41 -41
- data/spec/unit/provider/package/hpux_spec.rb +7 -10
- data/spec/unit/provider/package/macports_spec.rb +13 -15
- data/spec/unit/provider/package/nim_spec.rb +3 -10
- data/spec/unit/provider/package/openbsd_spec.rb +14 -17
- data/spec/unit/provider/package/pip3_spec.rb +3 -6
- data/spec/unit/provider/package/pip_spec.rb +44 -72
- data/spec/unit/provider/package/pkgin_spec.rb +13 -18
- data/spec/unit/provider/package/pkgng_spec.rb +21 -24
- data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
- data/spec/unit/provider/package/tdnf_spec.rb +9 -12
- data/spec/unit/provider/package/yum_spec.rb +29 -15
- data/spec/unit/provider/package/zypper_spec.rb +17 -19
- data/spec/unit/provider/service/bsd_spec.rb +8 -12
- data/spec/unit/provider/service/daemontools_spec.rb +12 -20
- data/spec/unit/provider/service/debian_spec.rb +8 -16
- data/spec/unit/provider/service/freebsd_spec.rb +2 -5
- data/spec/unit/provider/service/openbsd_spec.rb +12 -18
- data/spec/unit/provider/service/rcng_spec.rb +3 -7
- data/spec/unit/provider/service/redhat_spec.rb +21 -23
- data/spec/unit/provider/service/runit_spec.rb +9 -19
- data/spec/unit/provider/service/smf_spec.rb +82 -21
- data/spec/unit/provider/service/src_spec.rb +14 -23
- data/spec/unit/provider/user/hpux_spec.rb +2 -5
- data/spec/unit/provider/user/ldap_spec.rb +29 -32
- data/spec/unit/provider/user/pw_spec.rb +10 -13
- data/spec/unit/ssl/key_spec.rb +2 -4
- data/spec/unit/transaction/event_manager_spec.rb +12 -1
- data/spec/unit/transaction/resource_harness_spec.rb +18 -0
- data/spec/unit/transaction_spec.rb +25 -0
- data/spec/unit/util/filetype_spec.rb +13 -5
- data/spec/unit/util/logging_spec.rb +0 -41
- data/spec/unit/util/monkey_patches_spec.rb +18 -5
- data/spec/unit/util/selinux_spec.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2597552b6f4dcea7866f5e8ab10114553527a4fa00b80929684e0d5e1f6c5a78
|
4
|
+
data.tar.gz: de4497b9c1f1ef3f88018902acc53bf2cc1b9f72af8ea04ab06af43053f6833d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3a4ea79273a43f7cf510e726b83d2d75c75ad5ab79b31661740c1b61afbf4faa5a74770d97da77ae444cf52f9bf78ff33cbc09df0f749dc891d75e0a89a4a32
|
7
|
+
data.tar.gz: cc01e6e468fb4ce970d9bab83b9506e8ca891c62728600a0df975ed1bd2acdb3458f7b294316deda801b5a63eb7d8d49f1804283fc5d395af6a376ec89c162f2
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puppet (5.5.
|
4
|
+
puppet (5.5.10)
|
5
5
|
CFPropertyList (~> 2.2)
|
6
|
-
facter (>= 2.0
|
6
|
+
facter (>= 2.4.0, < 4)
|
7
7
|
fast_gettext (~> 1.1.2)
|
8
8
|
hiera (>= 3.2.1, < 4)
|
9
9
|
hocon (~> 1.0)
|
@@ -32,8 +32,8 @@ GEM
|
|
32
32
|
fast_gettext (~> 1.1.0)
|
33
33
|
gettext (>= 3.0.2)
|
34
34
|
locale
|
35
|
-
hashdiff (0.3.
|
36
|
-
hiera (3.
|
35
|
+
hashdiff (0.3.8)
|
36
|
+
hiera (3.5.0)
|
37
37
|
hiera-eyaml (2.1.0)
|
38
38
|
highline (~> 1.6.19)
|
39
39
|
trollop (~> 2.0)
|
@@ -45,21 +45,21 @@ GEM
|
|
45
45
|
locale (2.1.2)
|
46
46
|
memory_profiler (0.9.12)
|
47
47
|
metaclass (0.0.4)
|
48
|
-
method_source (0.9.
|
48
|
+
method_source (0.9.2)
|
49
49
|
mocha (0.10.5)
|
50
50
|
metaclass (~> 0.0.1)
|
51
|
-
msgpack (1.2.
|
51
|
+
msgpack (1.2.6)
|
52
52
|
multi_json (1.13.1)
|
53
53
|
mustache (1.1.0)
|
54
54
|
net-ssh (4.2.0)
|
55
|
-
packaging (0.99.
|
56
|
-
artifactory
|
55
|
+
packaging (0.99.21)
|
56
|
+
artifactory (~> 2)
|
57
57
|
rake (~> 12.3)
|
58
58
|
parallel (1.12.1)
|
59
|
-
parser (2.5.
|
59
|
+
parser (2.5.3.0)
|
60
60
|
ast (~> 2.4.0)
|
61
61
|
powerpack (0.1.2)
|
62
|
-
pry (0.
|
62
|
+
pry (0.12.2)
|
63
63
|
coderay (~> 1.1.0)
|
64
64
|
method_source (~> 0.9.0)
|
65
65
|
puppet-lint (2.3.6)
|
@@ -72,9 +72,9 @@ GEM
|
|
72
72
|
rake
|
73
73
|
rspec-puppet
|
74
74
|
racc (1.4.9)
|
75
|
-
rack (1.6.
|
75
|
+
rack (1.6.11)
|
76
76
|
rainbow (2.1.0)
|
77
|
-
rake (12.3.
|
77
|
+
rake (12.3.2)
|
78
78
|
rdiscount (2.2.0.1)
|
79
79
|
rdoc (4.3.0)
|
80
80
|
redcarpet (2.3.0)
|
@@ -101,7 +101,7 @@ GEM
|
|
101
101
|
rspec-mocks (3.8.0)
|
102
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
103
103
|
rspec-support (~> 3.8.0)
|
104
|
-
rspec-puppet (2.7.
|
104
|
+
rspec-puppet (2.7.2)
|
105
105
|
rspec
|
106
106
|
rspec-support (3.8.0)
|
107
107
|
rubocop (0.49.1)
|
@@ -118,7 +118,7 @@ GEM
|
|
118
118
|
safe_yaml (1.0.4)
|
119
119
|
text (1.3.1)
|
120
120
|
trollop (2.9.9)
|
121
|
-
unicode-display_width (1.4.
|
121
|
+
unicode-display_width (1.4.1)
|
122
122
|
vcr (2.9.3)
|
123
123
|
webmock (1.24.6)
|
124
124
|
addressable (>= 2.3.6)
|
data/Rakefile
CHANGED
@@ -103,7 +103,9 @@ task(:warnings) do
|
|
103
103
|
puts "Checking modified files #{commit_range}"
|
104
104
|
%x{git diff --diff-filter=ACM --name-only #{commit_range}}.each_line do |modified_file|
|
105
105
|
modified_file.chomp!
|
106
|
-
|
106
|
+
# Skip racc generated file as it can have many warnings that cannot be manually fixed
|
107
|
+
next if modified_file.end_with?("pops/parser/eparser.rb")
|
108
|
+
next if modified_file.start_with?('spec/fixtures/', 'acceptance/fixtures/') || File.extname(modified_file) != '.rb'
|
107
109
|
puts modified_file
|
108
110
|
|
109
111
|
stdout, stderr, _ = Open3.capture3("ruby -wc \"#{modified_file}\"")
|
data/ext/solaris/smf/svc-puppetd
CHANGED
@@ -12,7 +12,13 @@ exec_prefix=/opt/csw
|
|
12
12
|
sysconfdir=/opt/csw/etc
|
13
13
|
sbindir=/opt/csw/sbin
|
14
14
|
|
15
|
-
|
15
|
+
if [ -z $SMF_SYSVOL_FS ]; then
|
16
|
+
piddir=/var/run/puppetlabs
|
17
|
+
else
|
18
|
+
piddir=$SMF_SYSVOL_FS/puppetlabs
|
19
|
+
fi;
|
20
|
+
|
21
|
+
pidfile=$piddir/agent.pid
|
16
22
|
|
17
23
|
case "$1" in
|
18
24
|
start)
|
@@ -20,6 +26,7 @@ start)
|
|
20
26
|
# Start daemons.
|
21
27
|
|
22
28
|
printf "Starting Puppet client services:"
|
29
|
+
mkdir -p $piddir
|
23
30
|
|
24
31
|
/opt/csw/sbin/puppetd
|
25
32
|
|
@@ -8,7 +8,13 @@ exec_prefix=/opt/csw
|
|
8
8
|
sysconfdir=/opt/csw/etc
|
9
9
|
sbindir=/opt/csw/sbin
|
10
10
|
|
11
|
-
|
11
|
+
if [ -z $SMF_SYSVOL_FS ]; then
|
12
|
+
piddir=/var/run/puppetlabs
|
13
|
+
else
|
14
|
+
piddir=$SMF_SYSVOL_FS/puppetlabs
|
15
|
+
fi;
|
16
|
+
|
17
|
+
pidfile=$piddir/master.pid
|
12
18
|
|
13
19
|
case "$1" in
|
14
20
|
start)
|
@@ -16,6 +22,7 @@ start)
|
|
16
22
|
# Start daemons.
|
17
23
|
|
18
24
|
printf "Starting Puppet server services:"
|
25
|
+
mkdir -p $piddir
|
19
26
|
|
20
27
|
/opt/csw/sbin/puppetmasterd
|
21
28
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'puppet/application'
|
2
|
+
require 'puppet/configurer'
|
2
3
|
require 'puppet/util/network_device'
|
3
4
|
|
4
5
|
class Puppet::Application::Device < Puppet::Application
|
@@ -53,6 +54,10 @@ class Puppet::Application::Device < Puppet::Application
|
|
53
54
|
options[:detailed_exitcodes] = true
|
54
55
|
end
|
55
56
|
|
57
|
+
option("--libdir LIBDIR") do |arg|
|
58
|
+
options[:libdir] = arg
|
59
|
+
end
|
60
|
+
|
56
61
|
option("--apply MANIFEST") do |arg|
|
57
62
|
options[:apply] = arg.to_s
|
58
63
|
end
|
@@ -93,10 +98,11 @@ a scheduled task, or a similar tool.
|
|
93
98
|
|
94
99
|
USAGE
|
95
100
|
-----
|
96
|
-
puppet device [-
|
97
|
-
[-
|
98
|
-
[
|
99
|
-
[
|
101
|
+
puppet device [-h|--help] [-v|--verbose] [-d|--debug]
|
102
|
+
[-l|--logdest syslog|<file>|console] [--detailed-exitcodes]
|
103
|
+
[--deviceconfig <file>] [-w|--waitforcert <seconds>]
|
104
|
+
[--libdir <directory>]
|
105
|
+
[-a|--apply <file>] [-f|--facts] [-r|--resource <type> [name]]
|
100
106
|
[-t|--target <device>] [--user=<user>] [-V|--version]
|
101
107
|
|
102
108
|
|
@@ -135,9 +141,25 @@ Note that any setting that's valid in the configuration file is also a valid
|
|
135
141
|
long argument. For example, 'server' is a valid configuration parameter, so
|
136
142
|
you can specify '--server <servername>' as an argument.
|
137
143
|
|
138
|
-
* --
|
144
|
+
* --help, -h:
|
145
|
+
Print this help message
|
146
|
+
|
147
|
+
* --verbose, -v:
|
148
|
+
Turn on verbose reporting.
|
149
|
+
|
150
|
+
* --debug, -d:
|
139
151
|
Enable full debugging.
|
140
152
|
|
153
|
+
* --logdest, -l:
|
154
|
+
Where to send log messages. Choose between 'syslog' (the POSIX syslog
|
155
|
+
service), 'console', or the path to a log file. If debugging or verbosity is
|
156
|
+
enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
|
157
|
+
|
158
|
+
A path ending with '.json' will receive structured output in JSON format. The
|
159
|
+
log file will not have an ending ']' automatically written to it due to the
|
160
|
+
appending nature of logging. It must be appended manually to make the content
|
161
|
+
valid JSON.
|
162
|
+
|
141
163
|
* --detailed-exitcodes:
|
142
164
|
Provide transaction information via exit codes. If this is enabled, an exit
|
143
165
|
code of '1' means at least one device had a compile failure, an exit code of
|
@@ -149,18 +171,16 @@ you can specify '--server <servername>' as an argument.
|
|
149
171
|
Path to the device config file for puppet device.
|
150
172
|
Default: $confdir/device.conf
|
151
173
|
|
152
|
-
* --
|
153
|
-
|
174
|
+
* --waitforcert, -w:
|
175
|
+
This option only matters for targets that do not yet have certificates
|
176
|
+
and it is enabled by default, with a value of 120 (seconds). This causes
|
177
|
+
+puppet device+ to poll the server every 2 minutes and ask it to sign a
|
178
|
+
certificate request. This is useful for the initial setup of a target.
|
179
|
+
You can turn off waiting for certificates by specifying a time of 0.
|
154
180
|
|
155
|
-
* --
|
156
|
-
|
157
|
-
|
158
|
-
enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
|
159
|
-
|
160
|
-
A path ending with '.json' will receive structured output in JSON format. The
|
161
|
-
log file will not have an ending ']' automatically written to it due to the
|
162
|
-
appending nature of logging. It must be appended manually to make the content
|
163
|
-
valid JSON.
|
181
|
+
* --libdir:
|
182
|
+
Override the per-device libdir with a local directory. Specifying a libdir also
|
183
|
+
disables pluginsync. This is useful for testing.
|
164
184
|
|
165
185
|
* --apply:
|
166
186
|
Apply a manifest against a remote target. Target must be specified.
|
@@ -183,16 +203,6 @@ you can specify '--server <servername>' as an argument.
|
|
183
203
|
* --user:
|
184
204
|
The user to run as.
|
185
205
|
|
186
|
-
* --verbose:
|
187
|
-
Turn on verbose reporting.
|
188
|
-
|
189
|
-
* --waitforcert:
|
190
|
-
This option only matters for daemons that do not yet have certificates
|
191
|
-
and it is enabled by default, with a value of 120 (seconds). This causes
|
192
|
-
+puppet agent+ to connect to the server every 2 minutes and ask it to sign a
|
193
|
-
certificate request. This is useful for the initial setup of a puppet
|
194
|
-
client. You can turn off waiting for certificates by specifying a time of 0.
|
195
|
-
|
196
206
|
|
197
207
|
EXAMPLE
|
198
208
|
-------
|
@@ -205,7 +215,7 @@ Brice Figureau
|
|
205
215
|
|
206
216
|
COPYRIGHT
|
207
217
|
---------
|
208
|
-
Copyright (c) 2011 Puppet Inc., LLC
|
218
|
+
Copyright (c) 2011-2018 Puppet Inc., LLC
|
209
219
|
Licensed under the Apache 2.0 License
|
210
220
|
HELP
|
211
221
|
end
|
@@ -222,11 +232,12 @@ Licensed under the Apache 2.0 License
|
|
222
232
|
raise _("missing argument: --target is required when using --apply") if options[:target].nil?
|
223
233
|
raise _("%{file} does not exist, cannot apply") % { file: options[:apply] } unless File.file?(options[:apply])
|
224
234
|
end
|
235
|
+
libdir = Puppet[:libdir]
|
225
236
|
vardir = Puppet[:vardir]
|
226
237
|
confdir = Puppet[:confdir]
|
227
238
|
certname = Puppet[:certname]
|
228
239
|
|
229
|
-
env = Puppet.
|
240
|
+
env = Puppet::Node::Environment.remote(Puppet[:environment])
|
230
241
|
returns = Puppet.override(:current_environment => env, :loaders => Puppet::Pops::Loaders.new(env)) do
|
231
242
|
# find device list
|
232
243
|
require 'puppet/util/network_device/config'
|
@@ -251,9 +262,13 @@ Licensed under the Apache 2.0 License
|
|
251
262
|
|
252
263
|
# override local $vardir and $certname
|
253
264
|
Puppet[:confdir] = ::File.join(Puppet[:devicedir], device.name)
|
265
|
+
Puppet[:libdir] = options[:libdir] || ::File.join(Puppet[:devicedir], device.name, 'lib')
|
254
266
|
Puppet[:vardir] = ::File.join(Puppet[:devicedir], device.name)
|
255
267
|
Puppet[:certname] = device.name
|
256
268
|
|
269
|
+
unless options[:resource] || options[:facts] || options[:apply] || options[:libdir]
|
270
|
+
Puppet::Configurer::PluginHandler.new.download_plugins(env)
|
271
|
+
end
|
257
272
|
# this init the device singleton, so that the facts terminus
|
258
273
|
# and the various network_device provider can use it
|
259
274
|
Puppet::Util::NetworkDevice.init(device)
|
@@ -309,13 +324,14 @@ Licensed under the Apache 2.0 License
|
|
309
324
|
|
310
325
|
require 'puppet/configurer'
|
311
326
|
configurer = Puppet::Configurer.new
|
312
|
-
configurer.run(:network_device => true, :pluginsync => Puppet::Configurer.should_pluginsync?)
|
327
|
+
configurer.run(:network_device => true, :pluginsync => Puppet::Configurer.should_pluginsync? && !options[:libdir])
|
313
328
|
end
|
314
329
|
rescue => detail
|
315
330
|
Puppet.log_exception(detail)
|
316
331
|
# If we rescued an error, then we return 1 as the exit code
|
317
332
|
1
|
318
333
|
ensure
|
334
|
+
Puppet[:libdir] = libdir
|
319
335
|
Puppet[:vardir] = vardir
|
320
336
|
Puppet[:confdir] = confdir
|
321
337
|
Puppet[:certname] = certname
|
data/lib/puppet/face/config.rb
CHANGED
@@ -35,7 +35,7 @@ Puppet::Face.define(:config, '0.0.1') do
|
|
35
35
|
|
36
36
|
action(:print) do
|
37
37
|
summary _("Examine Puppet's current settings.")
|
38
|
-
arguments _("
|
38
|
+
arguments _("all | <setting> [<setting> ...]")
|
39
39
|
description <<-'EOT'
|
40
40
|
Prints the value of a single setting or a list of settings.
|
41
41
|
|
data/lib/puppet/forge.rb
CHANGED
@@ -17,6 +17,9 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
17
17
|
|
18
18
|
USER_AGENT = "PMT/1.1.1 (v3; Net::HTTP)".freeze
|
19
19
|
|
20
|
+
# From https://forgeapi.puppet.com/#!/release/getReleases
|
21
|
+
MODULE_RELEASE_EXCLUSIONS=%w[readme changelog license uri module tags supported file_size downloads created_at updated_at deleted_at].join(',').freeze
|
22
|
+
|
20
23
|
attr_reader :host, :repository
|
21
24
|
|
22
25
|
def initialize(host = Puppet[:module_repository], strict_semver = true)
|
@@ -90,7 +93,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
90
93
|
# @see SemanticPuppet::Dependency::Source#fetch
|
91
94
|
def fetch(input)
|
92
95
|
name = input.tr('/', '-')
|
93
|
-
uri = "/v3/releases?module=#{name}&sort_by=version"
|
96
|
+
uri = "/v3/releases?module=#{name}&sort_by=version&exclude_fields=#{MODULE_RELEASE_EXCLUSIONS}"
|
94
97
|
if Puppet[:module_groups]
|
95
98
|
uri += "&module_groups=#{Puppet[:module_groups].gsub('+', ' ')}"
|
96
99
|
end
|
@@ -51,7 +51,9 @@ class Puppet::Pops::Evaluator::Collectors::AbstractCollector
|
|
51
51
|
|
52
52
|
objects.each do |res|
|
53
53
|
unless @collected.include?(res.ref)
|
54
|
-
|
54
|
+
t = res.type
|
55
|
+
t = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type(scope, t)
|
56
|
+
newres = Puppet::Parser::Resource.new(t, res.title, @overrides)
|
55
57
|
scope.compiler.add_override(newres)
|
56
58
|
end
|
57
59
|
end
|
@@ -65,9 +65,9 @@ module Types
|
|
65
65
|
when String
|
66
66
|
impl_class.parse(arg)
|
67
67
|
when Integer
|
68
|
-
|
68
|
+
impl_class.new(arg * Time::NSECS_PER_SEC)
|
69
69
|
when Float
|
70
|
-
|
70
|
+
impl_class.new(arg * Time::NSECS_PER_SEC)
|
71
71
|
else
|
72
72
|
raise ArgumentError, "Unable to create a #{impl_class.name} from a #{arg.class.name}" unless arg.nil? || arg == :default
|
73
73
|
nil
|
@@ -484,8 +484,17 @@ class StringConverter
|
|
484
484
|
|
485
485
|
value_type = TypeCalculator.infer_set(value)
|
486
486
|
if string_formats.is_a?(String)
|
487
|
-
#
|
488
|
-
|
487
|
+
# For Array and Hash, the format is given as a Hash where 'format' key is the format for the collection itself
|
488
|
+
if Puppet::Pops::Types::PArrayType::DEFAULT.assignable?(value_type)
|
489
|
+
# add the format given for the exact type
|
490
|
+
string_formats = { Puppet::Pops::Types::PArrayType::DEFAULT => {'format' => string_formats }}
|
491
|
+
elsif Puppet::Pops::Types::PHashType::DEFAULT.assignable?(value_type)
|
492
|
+
# add the format given for the exact type
|
493
|
+
string_formats = { Puppet::Pops::Types::PHashType::DEFAULT => {'format' => string_formats }}
|
494
|
+
else
|
495
|
+
# add the format given for the exact type
|
496
|
+
string_formats = { value_type => string_formats }
|
497
|
+
end
|
489
498
|
end
|
490
499
|
|
491
500
|
case string_formats
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'puppet/provider/parsedfile'
|
2
2
|
|
3
|
-
Puppet::Type.type(:cron).provide(:crontab, :parent => Puppet::Provider::ParsedFile, :default_target => ENV["USER"] || "root") do
|
3
|
+
Puppet::Type.type(:cron).provide(:crontab, :parent => Puppet::Provider::ParsedFile, :default_target => ENV["USER"] || "root", :raise_prefetch_errors => true) do
|
4
4
|
commands :crontab => "crontab"
|
5
5
|
|
6
6
|
text_line :comment, :match => %r{^\s*#}, :post_parse => proc { |record|
|
@@ -4,6 +4,19 @@ class Puppet::Provider::Package::Windows
|
|
4
4
|
class ExePackage < Puppet::Provider::Package::Windows::Package
|
5
5
|
attr_reader :uninstall_string
|
6
6
|
|
7
|
+
# registry values to load under each product entry in
|
8
|
+
# HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
|
9
|
+
# for this provider
|
10
|
+
REG_VALUE_NAMES = [
|
11
|
+
'DisplayVersion',
|
12
|
+
'UninstallString',
|
13
|
+
'ParentKeyName',
|
14
|
+
'Security Update',
|
15
|
+
'Update Rollup',
|
16
|
+
'Hotfix',
|
17
|
+
'WindowsInstaller',
|
18
|
+
]
|
19
|
+
|
7
20
|
# Return an instance of the package from the registry, or nil
|
8
21
|
def self.from_registry(name, values)
|
9
22
|
if valid?(name, values)
|
@@ -8,6 +8,14 @@ class Puppet::Provider::Package::Windows
|
|
8
8
|
INSTALLSTATE_DEFAULT = 5 # product is installed for the current user
|
9
9
|
INSTALLUILEVEL_NONE = 2 # completely silent installation
|
10
10
|
|
11
|
+
# registry values to load under each product entry in
|
12
|
+
# HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
|
13
|
+
# for this provider
|
14
|
+
REG_VALUE_NAMES = [
|
15
|
+
'DisplayVersion',
|
16
|
+
'WindowsInstaller'
|
17
|
+
]
|
18
|
+
|
11
19
|
# Get the COM installer object, it's in a separate method for testing
|
12
20
|
def self.installer
|
13
21
|
# REMIND: when does the COM release happen?
|
@@ -11,6 +11,14 @@ class Puppet::Provider::Package::Windows
|
|
11
11
|
|
12
12
|
attr_reader :name, :version
|
13
13
|
|
14
|
+
REG_DISPLAY_VALUE_NAMES = [ 'DisplayName', 'QuietDisplayName' ]
|
15
|
+
|
16
|
+
def self.reg_value_names_to_load
|
17
|
+
REG_DISPLAY_VALUE_NAMES |
|
18
|
+
MsiPackage::REG_VALUE_NAMES |
|
19
|
+
ExePackage::REG_VALUE_NAMES
|
20
|
+
end
|
21
|
+
|
14
22
|
# Enumerate each package. The appropriate package subclass
|
15
23
|
# will be yielded.
|
16
24
|
def self.each(&block)
|
@@ -37,7 +45,7 @@ class Puppet::Provider::Package::Windows
|
|
37
45
|
open(hive, 'Software\Microsoft\Windows\CurrentVersion\Uninstall', mode) do |uninstall|
|
38
46
|
each_key(uninstall) do |name, wtime|
|
39
47
|
open(hive, "#{uninstall.keyname}\\#{name}", mode) do |key|
|
40
|
-
yield key,
|
48
|
+
yield key, values_by_name(key, reg_value_names_to_load)
|
41
49
|
end
|
42
50
|
end
|
43
51
|
end
|
@@ -10,11 +10,17 @@ require 'puppet/util/fileparsing'
|
|
10
10
|
#
|
11
11
|
# Once the provider prefetches the data, it's the resource's job to copy
|
12
12
|
# that data over to the @is variables.
|
13
|
+
#
|
14
|
+
# NOTE: The prefetch method swallows FileReadErrors by treating the
|
15
|
+
# corresponding target as an empty file. If you would like to turn this
|
16
|
+
# behavior off, then set the raise_prefetch_errors class variable to
|
17
|
+
# true. Doing so will error all resources associated with the failed
|
18
|
+
# target.
|
13
19
|
class Puppet::Provider::ParsedFile < Puppet::Provider
|
14
20
|
extend Puppet::Util::FileParsing
|
15
21
|
|
16
22
|
class << self
|
17
|
-
attr_accessor :default_target, :target
|
23
|
+
attr_accessor :default_target, :target, :raise_prefetch_errors
|
18
24
|
end
|
19
25
|
|
20
26
|
attr_accessor :property_hash
|
@@ -89,6 +95,10 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
89
95
|
|
90
96
|
# Flush all of the records relating to a specific target.
|
91
97
|
def self.flush_target(target)
|
98
|
+
if @raise_prefetch_errors && @failed_prefetch_targets.key?(target)
|
99
|
+
raise Puppet::Error, _("Failed to read %{target}'s records when prefetching them. Reason: %{detail}") % { target: target, detail: @failed_prefetch_targets[target] }
|
100
|
+
end
|
101
|
+
|
92
102
|
backup_target(target)
|
93
103
|
|
94
104
|
records = target_records(target).reject { |r|
|
@@ -142,6 +152,10 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
142
152
|
@records = []
|
143
153
|
@target_objects = {}
|
144
154
|
|
155
|
+
# Hash of <target> => <failure reason>.
|
156
|
+
@failed_prefetch_targets = {}
|
157
|
+
@raise_prefetch_errors = false
|
158
|
+
|
145
159
|
@target = nil
|
146
160
|
|
147
161
|
# Default to flat files
|
@@ -260,12 +274,19 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
260
274
|
|
261
275
|
# Prefetch an individual target.
|
262
276
|
def self.prefetch_target(target)
|
263
|
-
|
264
277
|
begin
|
265
278
|
target_records = retrieve(target)
|
266
279
|
rescue Puppet::Util::FileType::FileReadError => detail
|
267
|
-
|
268
|
-
|
280
|
+
if @raise_prefetch_errors
|
281
|
+
# We will raise an error later in flush_target. This way,
|
282
|
+
# only the resources linked to our target will fail
|
283
|
+
# evaluation.
|
284
|
+
@failed_prefetch_targets[target] = detail.to_s
|
285
|
+
else
|
286
|
+
puts detail.backtrace if Puppet[:trace]
|
287
|
+
Puppet.err _("Could not prefetch %{resource} provider '%{name}' target '%{target}': %{detail}. Treating as empty") % { resource: self.resource_type.name, name: self.name, target: target, detail: detail }
|
288
|
+
end
|
289
|
+
|
269
290
|
target_records = []
|
270
291
|
end
|
271
292
|
|