puppet 7.20.0-x86-mingw32 → 7.22.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +62 -48
- data/Guardfile.example +1 -1
- data/ext/project_data.yaml +1 -1
- data/ext/windows/service/daemon.rb +1 -1
- data/lib/puppet/application/lookup.rb +5 -5
- data/lib/puppet/defaults.rb +14 -0
- data/lib/puppet/indirector/facts/facter.rb +8 -1
- data/lib/puppet/info_service/task_information_service.rb +10 -2
- data/lib/puppet/transaction/report.rb +18 -1
- data/lib/puppet/type/resources.rb +1 -6
- data/lib/puppet/type/tidy.rb +3 -2
- data/lib/puppet/type/user.rb +1 -3
- data/lib/puppet/type.rb +10 -0
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +18 -2
- 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-lookup.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.8 +2 -2
- data/spec/integration/application/agent_spec.rb +100 -1
- data/spec/integration/application/lookup_spec.rb +55 -0
- data/spec/unit/agent_spec.rb +1 -1
- data/spec/unit/application/agent_spec.rb +1 -1
- data/spec/unit/application/device_spec.rb +1 -1
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/confiner_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/file_serving/fileset_spec.rb +14 -14
- data/spec/unit/file_system_spec.rb +3 -1
- data/spec/unit/graph/simple_graph_spec.rb +1 -1
- data/spec/unit/http/service/compiler_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +25 -0
- data/spec/unit/indirector/file_server_spec.rb +5 -5
- data/spec/unit/indirector/indirection_spec.rb +1 -1
- data/spec/unit/indirector/node/plain_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +21 -0
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/network/formats_spec.rb +1 -1
- data/spec/unit/provider/file/posix_spec.rb +4 -4
- data/spec/unit/provider/ldap_spec.rb +3 -3
- data/spec/unit/provider/nameservice_spec.rb +15 -15
- data/spec/unit/provider/package/aix_spec.rb +1 -1
- data/spec/unit/provider/package/dpkg_spec.rb +3 -3
- data/spec/unit/provider/package/nim_spec.rb +2 -2
- data/spec/unit/provider/package/pkgutil_spec.rb +4 -4
- data/spec/unit/provider/parsedfile_spec.rb +4 -4
- data/spec/unit/provider/service/bsd_spec.rb +4 -4
- data/spec/unit/provider/service/debian_spec.rb +2 -2
- data/spec/unit/provider/service/gentoo_spec.rb +20 -20
- data/spec/unit/provider/service/openbsd_spec.rb +18 -18
- data/spec/unit/provider/service/openrc_spec.rb +19 -19
- data/spec/unit/provider/service/systemd_spec.rb +22 -22
- data/spec/unit/provider/service/upstart_spec.rb +6 -6
- data/spec/unit/provider/user/aix_spec.rb +1 -1
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/openbsd_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/reports/store_spec.rb +5 -1
- data/spec/unit/resource/type_spec.rb +2 -2
- data/spec/unit/ssl/base_spec.rb +1 -1
- data/spec/unit/ssl/certificate_request_spec.rb +1 -1
- data/spec/unit/ssl/certificate_spec.rb +1 -1
- data/spec/unit/transaction/event_manager_spec.rb +4 -4
- data/spec/unit/transaction/report_spec.rb +38 -1
- data/spec/unit/transaction_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +4 -4
- data/spec/unit/type/filebucket_spec.rb +3 -3
- data/spec/unit/type/resources_spec.rb +14 -0
- data/spec/unit/type/tidy_spec.rb +27 -17
- data/spec/unit/util/backups_spec.rb +1 -1
- data/spec/unit/util/execution_spec.rb +6 -6
- data/spec/unit/util/filetype_spec.rb +3 -3
- data/spec/unit/util/network_device_spec.rb +1 -6
- data/spec/unit/util/resource_template_spec.rb +1 -1
- data/spec/unit/util/storage_spec.rb +1 -1
- data/spec/unit/x509/cert_provider_spec.rb +1 -1
- metadata +9 -3
@@ -37,13 +37,13 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
37
37
|
describe "#start" do
|
38
38
|
it "should use the supplied start command if specified" do
|
39
39
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
40
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
40
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
41
41
|
provider.start
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should start the service with rc-service start otherwise" do
|
45
45
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
46
|
-
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
46
|
+
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
47
47
|
provider.start
|
48
48
|
end
|
49
49
|
end
|
@@ -51,13 +51,13 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
51
51
|
describe "#stop" do
|
52
52
|
it "should use the supplied stop command if specified" do
|
53
53
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
54
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
54
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
55
55
|
provider.stop
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should stop the service with rc-service stop otherwise" do
|
59
59
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
60
|
-
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
60
|
+
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
61
61
|
provider.stop
|
62
62
|
end
|
63
63
|
end
|
@@ -147,25 +147,25 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
147
147
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
148
148
|
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
149
149
|
expect(provider).to receive(:execute)
|
150
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
150
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
151
151
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
152
152
|
provider.status
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should return :stopped when status command returns with a non-zero exitcode" do
|
156
156
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
157
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
157
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
158
158
|
expect(provider).to receive(:execute)
|
159
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
159
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
160
160
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
|
161
161
|
expect(provider.status).to eq(:stopped)
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should return :running when status command returns with a zero exitcode" do
|
165
165
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
166
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
166
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
167
167
|
expect(provider).to receive(:execute)
|
168
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
168
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
169
169
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
170
170
|
expect(provider.status).to eq(:running)
|
171
171
|
end
|
@@ -174,14 +174,14 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
174
174
|
describe "when hasstatus is false" do
|
175
175
|
it "should return running if a pid can be found" do
|
176
176
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
177
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
177
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
178
178
|
expect(provider).to receive(:getpid).and_return(1000)
|
179
179
|
expect(provider.status).to eq(:running)
|
180
180
|
end
|
181
181
|
|
182
182
|
it "should return stopped if no pid can be found" do
|
183
183
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
184
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
184
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
185
185
|
expect(provider).to receive(:getpid).and_return(nil)
|
186
186
|
expect(provider.status).to eq(:stopped)
|
187
187
|
end
|
@@ -191,7 +191,7 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
191
191
|
it "should return running if rc-service status exits with a zero exitcode" do
|
192
192
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
193
193
|
expect(provider).to receive(:execute)
|
194
|
-
.with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
194
|
+
.with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
195
195
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
196
196
|
expect(provider.status).to eq(:running)
|
197
197
|
end
|
@@ -199,7 +199,7 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
199
199
|
it "should return stopped if rc-service status exits with a non-zero exitcode" do
|
200
200
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
201
201
|
expect(provider).to receive(:execute)
|
202
|
-
.with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
202
|
+
.with(['/sbin/rc-service','sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
203
203
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
|
204
204
|
expect(provider.status).to eq(:stopped)
|
205
205
|
end
|
@@ -209,22 +209,22 @@ describe 'Puppet::Type::Service::Provider::Openrc',
|
|
209
209
|
describe "#restart" do
|
210
210
|
it "should use the supplied restart command if specified" do
|
211
211
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
212
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
213
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
212
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
213
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
214
214
|
provider.restart
|
215
215
|
end
|
216
216
|
|
217
217
|
it "should restart the service with rc-service restart if hasrestart is true" do
|
218
218
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
|
219
|
-
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
219
|
+
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
220
220
|
provider.restart
|
221
221
|
end
|
222
222
|
|
223
223
|
it "should restart the service with rc-service stop/start if hasrestart is false" do
|
224
224
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
|
225
|
-
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
226
|
-
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
227
|
-
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
225
|
+
expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
226
|
+
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
227
|
+
expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
228
228
|
provider.restart
|
229
229
|
end
|
230
230
|
end
|
@@ -217,7 +217,7 @@ describe 'Puppet::Type::Service::Provider::Systemd',
|
|
217
217
|
it "should use the supplied start command if specified" do
|
218
218
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :start => '/bin/foo'))
|
219
219
|
expect(provider).to receive(:daemon_reload?).and_return('no')
|
220
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
220
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
221
221
|
provider.start
|
222
222
|
end
|
223
223
|
|
@@ -249,13 +249,13 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
249
249
|
describe "#stop" do
|
250
250
|
it "should use the supplied stop command if specified" do
|
251
251
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :stop => '/bin/foo'))
|
252
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
252
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
253
253
|
provider.stop
|
254
254
|
end
|
255
255
|
|
256
256
|
it "should stop the service with systemctl stop otherwise" do
|
257
257
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
258
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','stop', '--', 'sshd.service'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
258
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','stop', '--', 'sshd.service'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
259
259
|
provider.stop
|
260
260
|
end
|
261
261
|
|
@@ -277,13 +277,13 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
277
277
|
describe "#daemon_reload?" do
|
278
278
|
it "should skip the systemctl daemon_reload if not required by the service" do
|
279
279
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
280
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl', 'show', '--property=NeedDaemonReload', '--', 'sshd.service'], :failonfail => false).and_return("no")
|
280
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl', 'show', '--property=NeedDaemonReload', '--', 'sshd.service'], {:failonfail => false}).and_return("no")
|
281
281
|
provider.daemon_reload?
|
282
282
|
end
|
283
283
|
it "should run a systemctl daemon_reload if the service has been modified" do
|
284
284
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
285
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl', 'show', '--property=NeedDaemonReload', '--', 'sshd.service'], :failonfail => false).and_return("yes")
|
286
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl', 'daemon-reload'], :failonfail => false)
|
285
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl', 'show', '--property=NeedDaemonReload', '--', 'sshd.service'], {:failonfail => false}).and_return("yes")
|
286
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl', 'daemon-reload'], {:failonfail => false})
|
287
287
|
provider.daemon_reload?
|
288
288
|
end
|
289
289
|
end
|
@@ -291,51 +291,51 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
291
291
|
describe "#enabled?" do
|
292
292
|
it "should return :true if the service is enabled" do
|
293
293
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
294
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], :failonfail => false).
|
294
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], {:failonfail => false}).
|
295
295
|
and_return(Puppet::Util::Execution::ProcessOutput.new("enabled\n", 0))
|
296
296
|
expect(provider.enabled?).to eq(:true)
|
297
297
|
end
|
298
298
|
|
299
299
|
it "should return :true if the service is static" do
|
300
300
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
301
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled','--', 'sshd.service'], :failonfail => false).
|
301
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled','--', 'sshd.service'], {:failonfail => false}).
|
302
302
|
and_return(Puppet::Util::Execution::ProcessOutput.new("static\n", 0))
|
303
303
|
expect(provider.enabled?).to eq(:true)
|
304
304
|
end
|
305
305
|
|
306
306
|
it "should return :false if the service is disabled" do
|
307
307
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
308
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], :failonfail => false).
|
308
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], {:failonfail => false}).
|
309
309
|
and_return(Puppet::Util::Execution::ProcessOutput.new("disabled\n", 1))
|
310
310
|
expect(provider.enabled?).to eq(:false)
|
311
311
|
end
|
312
312
|
|
313
313
|
it "should return :false if the service is indirect" do
|
314
314
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
315
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], :failonfail => false).
|
315
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], {:failonfail => false}).
|
316
316
|
and_return(Puppet::Util::Execution::ProcessOutput.new("indirect\n", 0))
|
317
317
|
expect(provider.enabled?).to eq(:false)
|
318
318
|
end
|
319
319
|
|
320
320
|
it "should return :false if the service is masked and the resource is attempting to be disabled" do
|
321
321
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :enable => false))
|
322
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], :failonfail => false).
|
322
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], {:failonfail => false}).
|
323
323
|
and_return(Puppet::Util::Execution::ProcessOutput.new("masked\n", 1))
|
324
324
|
expect(provider.enabled?).to eq(:false)
|
325
325
|
end
|
326
326
|
|
327
327
|
it "should return :mask if the service is masked and the resource is attempting to be masked" do
|
328
328
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :enable => 'mask'))
|
329
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], :failonfail => false).
|
329
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'sshd.service'], {:failonfail => false}).
|
330
330
|
and_return(Puppet::Util::Execution::ProcessOutput.new("masked\n", 1))
|
331
331
|
expect(provider.enabled?).to eq(:mask)
|
332
332
|
end
|
333
333
|
|
334
334
|
it "should consider nonexistent services to be disabled" do
|
335
335
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist'))
|
336
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'doesnotexist'], :failonfail => false)
|
336
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'doesnotexist'], {:failonfail => false})
|
337
337
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("", 1))
|
338
|
-
expect(provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], :failonfail => false)
|
338
|
+
expect(provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], {:failonfail => false})
|
339
339
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("", 1))
|
340
340
|
|
341
341
|
expect(provider.enabled?).to be(:false)
|
@@ -363,7 +363,7 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
363
363
|
it "should run systemctl to disable and mask a service" do
|
364
364
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
365
365
|
expect(provider).to receive(:execute).
|
366
|
-
with(['/bin/systemctl','cat', '--', 'sshd.service'], :failonfail => false).
|
366
|
+
with(['/bin/systemctl','cat', '--', 'sshd.service'], {:failonfail => false}).
|
367
367
|
and_return(Puppet::Util::Execution::ProcessOutput.new("# /lib/systemd/system/sshd.service\n...", 0))
|
368
368
|
# :disable is the only call in the provider that uses a symbol instead of
|
369
369
|
# a string.
|
@@ -376,7 +376,7 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
376
376
|
it "masks a service that doesn't exist" do
|
377
377
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist.service'))
|
378
378
|
expect(provider).to receive(:execute).
|
379
|
-
with(['/bin/systemctl','cat', '--', 'doesnotexist.service'], :failonfail => false).
|
379
|
+
with(['/bin/systemctl','cat', '--', 'doesnotexist.service'], {:failonfail => false}).
|
380
380
|
and_return(Puppet::Util::Execution::ProcessOutput.new("No files found for doesnotexist.service.\n", 1))
|
381
381
|
expect(provider).to receive(:systemctl).with(:mask, '--', 'doesnotexist.service')
|
382
382
|
provider.mask
|
@@ -389,7 +389,7 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
389
389
|
it "should return running if the command returns 0" do
|
390
390
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
391
391
|
expect(provider).to receive(:execute)
|
392
|
-
.with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
392
|
+
.with(['/bin/systemctl','is-active', '--', 'sshd.service'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
393
393
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("active\n", 0))
|
394
394
|
expect(provider.status).to eq(:running)
|
395
395
|
end
|
@@ -398,7 +398,7 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
398
398
|
it "should return stopped if the command returns something non-0" do
|
399
399
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
400
400
|
expect(provider).to receive(:execute)
|
401
|
-
.with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
401
|
+
.with(['/bin/systemctl','is-active', '--', 'sshd.service'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
402
402
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("inactive\n", ec))
|
403
403
|
expect(provider.status).to eq(:stopped)
|
404
404
|
end
|
@@ -407,7 +407,7 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
407
407
|
it "should use the supplied status command if specified" do
|
408
408
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :status => '/bin/foo'))
|
409
409
|
expect(provider).to receive(:execute)
|
410
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
410
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
411
411
|
.and_return(process_output)
|
412
412
|
provider.status
|
413
413
|
end
|
@@ -419,15 +419,15 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
|
|
419
419
|
it "should use the supplied restart command if specified" do
|
420
420
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
421
421
|
expect(provider).to receive(:daemon_reload?).and_return('no')
|
422
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','restart', '--', 'sshd.service'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true).never
|
423
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
422
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','restart', '--', 'sshd.service'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).never
|
423
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
424
424
|
provider.restart
|
425
425
|
end
|
426
426
|
|
427
427
|
it "should restart the service with systemctl restart" do
|
428
428
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
429
429
|
expect(provider).to receive(:daemon_reload?).and_return('no')
|
430
|
-
expect(provider).to receive(:execute).with(['/bin/systemctl','restart','--','sshd.service'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
430
|
+
expect(provider).to receive(:execute).with(['/bin/systemctl','restart','--','sshd.service'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
431
431
|
provider.restart
|
432
432
|
end
|
433
433
|
|
@@ -132,7 +132,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
132
132
|
|
133
133
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
134
134
|
expect(provider).to receive(:execute)
|
135
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
135
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
136
136
|
.and_return(process_output)
|
137
137
|
provider.status
|
138
138
|
end
|
@@ -144,7 +144,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
144
144
|
|
145
145
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
146
146
|
expect(provider).to receive(:execute)
|
147
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
147
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
148
148
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 1))
|
149
149
|
expect(provider.status).to eq(:stopped)
|
150
150
|
end
|
@@ -156,7 +156,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
156
156
|
|
157
157
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
158
158
|
expect(provider).to receive(:execute)
|
159
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
159
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
160
160
|
.and_return(process_output)
|
161
161
|
expect(provider.status).to eq(:running)
|
162
162
|
end
|
@@ -192,7 +192,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
192
192
|
|
193
193
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
194
194
|
expect(provider).to receive(:execute)
|
195
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
195
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
196
196
|
.and_return(process_output)
|
197
197
|
provider.status
|
198
198
|
end
|
@@ -204,7 +204,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
204
204
|
|
205
205
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
206
206
|
expect(provider).to receive(:execute)
|
207
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
207
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
208
208
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 1))
|
209
209
|
expect(provider.status).to eq(:stopped)
|
210
210
|
end
|
@@ -216,7 +216,7 @@ describe 'Puppet::Type::Service::Provider::Upstart',
|
|
216
216
|
|
217
217
|
expect(provider).not_to receive(:status_exec).with(['foo'])
|
218
218
|
expect(provider).to receive(:execute)
|
219
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
219
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
220
220
|
.and_return(process_output)
|
221
221
|
expect(provider.status).to eq(:running)
|
222
222
|
end
|
@@ -165,7 +165,7 @@ describe 'Puppet::Type::User::Provider::Aix' do
|
|
165
165
|
allow(mock_tempfile_obj).to receive(:path).and_return('tempfile_path')
|
166
166
|
|
167
167
|
allow(Tempfile).to receive(:new)
|
168
|
-
.with("puppet_#{provider.name}_pw", :encoding => Encoding::ASCII)
|
168
|
+
.with("puppet_#{provider.name}_pw", {:encoding => Encoding::ASCII})
|
169
169
|
.and_return(mock_tempfile_obj)
|
170
170
|
|
171
171
|
mock_tempfile_obj
|
@@ -22,7 +22,7 @@ describe Puppet::Type.type(:user).provider(:openbsd) do
|
|
22
22
|
|
23
23
|
let(:shadow_entry) {
|
24
24
|
return unless Puppet.features.libshadow?
|
25
|
-
entry =
|
25
|
+
entry = Etc::PasswdEntry.new
|
26
26
|
entry[:sp_namp] = 'myuser' # login name
|
27
27
|
entry[:sp_loginclass] = 'staff' # login class
|
28
28
|
entry
|
@@ -29,7 +29,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
|
|
29
29
|
|
30
30
|
let(:shadow_entry) {
|
31
31
|
return unless Puppet.features.libshadow?
|
32
|
-
entry =
|
32
|
+
entry = Etc::PasswdEntry.new
|
33
33
|
entry[:sp_namp] = 'myuser' # login name
|
34
34
|
entry[:sp_pwdp] = '$6$FvW8Ib8h$qQMI/CR9m.QzIicZKutLpBgCBBdrch1IX0rTnxuI32K1pD9.RXZrmeKQlaC.RzODNuoUtPPIyQDufunvLOQWF0' # encrypted password
|
35
35
|
entry[:sp_lstchg] = 15573 # date of last password change
|
@@ -15,7 +15,11 @@ describe Puppet::Reports.report(:store) do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
let(:report) do
|
18
|
-
|
18
|
+
if RUBY_VERSION < "3.0"
|
19
|
+
report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml'))
|
20
|
+
else
|
21
|
+
report = YAML.unsafe_load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml'))
|
22
|
+
end
|
19
23
|
report.extend(described_class)
|
20
24
|
report
|
21
25
|
end
|
@@ -521,7 +521,7 @@ describe Puppet::Resource::Type do
|
|
521
521
|
allow(@type).to receive(:code).and_return(code)
|
522
522
|
|
523
523
|
subscope = double('subscope', :compiler => @compiler)
|
524
|
-
expect(@scope).to receive(:newscope).with(:source => @type, :resource => @resource).and_return(subscope)
|
524
|
+
expect(@scope).to receive(:newscope).with({:source => @type, :resource => @resource}).and_return(subscope)
|
525
525
|
|
526
526
|
expect(subscope).to receive(:with_guarded_scope).and_yield
|
527
527
|
expect(subscope).to receive(:ephemeral_from).with(match, nil, nil).and_return(subscope)
|
@@ -546,7 +546,7 @@ describe Puppet::Resource::Type do
|
|
546
546
|
|
547
547
|
it "should set all of its parameters in a subscope" do
|
548
548
|
subscope = double('subscope', :compiler => @compiler)
|
549
|
-
expect(@scope).to receive(:newscope).with(:source => @type, :resource => @resource).and_return(subscope)
|
549
|
+
expect(@scope).to receive(:newscope).with({:source => @type, :resource => @resource}).and_return(subscope)
|
550
550
|
expect(@type).to receive(:set_resource_parameters).with(@resource, subscope)
|
551
551
|
|
552
552
|
@type.evaluate_code(@resource)
|
data/spec/unit/ssl/base_spec.rb
CHANGED
@@ -46,7 +46,7 @@ describe Puppet::SSL::Certificate do
|
|
46
46
|
describe "when initializing wrapped class from a file with #read" do
|
47
47
|
it "should open the file with ASCII encoding" do
|
48
48
|
path = '/foo/bar/cert'
|
49
|
-
expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("bar")
|
49
|
+
expect(Puppet::FileSystem).to receive(:read).with(path, {:encoding => Encoding::ASCII}).and_return("bar")
|
50
50
|
@base.read(path)
|
51
51
|
end
|
52
52
|
end
|
@@ -45,7 +45,7 @@ describe Puppet::SSL::CertificateRequest do
|
|
45
45
|
|
46
46
|
it "should be able to read requests from disk" do
|
47
47
|
path = "/my/path"
|
48
|
-
expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("my request")
|
48
|
+
expect(Puppet::FileSystem).to receive(:read).with(path, {:encoding => Encoding::ASCII}).and_return("my request")
|
49
49
|
my_req = double('request')
|
50
50
|
expect(OpenSSL::X509::Request).to receive(:new).with("my request").and_return(my_req)
|
51
51
|
expect(request.read(path)).to equal(my_req)
|
@@ -156,7 +156,7 @@ describe Puppet::SSL::Certificate do
|
|
156
156
|
|
157
157
|
it "should be able to read certificates from disk" do
|
158
158
|
path = "/my/path"
|
159
|
-
expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("my certificate")
|
159
|
+
expect(Puppet::FileSystem).to receive(:read).with(path, {:encoding => Encoding::ASCII}).and_return("my certificate")
|
160
160
|
certificate = double('certificate')
|
161
161
|
expect(OpenSSL::X509::Certificate).to receive(:new).with("my certificate").and_return(certificate)
|
162
162
|
expect(@certificate.read(path)).to equal(certificate)
|
@@ -191,8 +191,8 @@ describe Puppet::Transaction::EventManager do
|
|
191
191
|
|
192
192
|
allow(@resource).to receive(:callback1)
|
193
193
|
|
194
|
-
expect(@resource).to receive(:event).with(:message => "Triggered 'callback1' from 1 event", :status => 'success', :name => 'callback1')
|
195
|
-
expect(@resource).to receive(:event).with(:name => :restarted, :status => "success").and_return("myevent")
|
194
|
+
expect(@resource).to receive(:event).with({:message => "Triggered 'callback1' from 1 event", :status => 'success', :name => 'callback1'})
|
195
|
+
expect(@resource).to receive(:event).with({:name => :restarted, :status => "success"}).and_return("myevent")
|
196
196
|
expect(@manager).to receive(:queue_events).with(@resource, ["myevent"])
|
197
197
|
|
198
198
|
@manager.process_events(@resource)
|
@@ -247,7 +247,7 @@ describe Puppet::Transaction::EventManager do
|
|
247
247
|
|
248
248
|
it "should queue a new noop event generated from the resource" do
|
249
249
|
event = Puppet::Transaction::Event.new
|
250
|
-
expect(@resource).to receive(:event).with(:status => "noop", :name => :noop_restart).and_return(event)
|
250
|
+
expect(@resource).to receive(:event).with({:status => "noop", :name => :noop_restart}).and_return(event)
|
251
251
|
expect(@manager).to receive(:queue_events).with(@resource, [event])
|
252
252
|
|
253
253
|
@manager.process_events(@resource)
|
@@ -277,7 +277,7 @@ describe Puppet::Transaction::EventManager do
|
|
277
277
|
|
278
278
|
it "should queue a new noop event generated from the resource" do
|
279
279
|
event = Puppet::Transaction::Event.new
|
280
|
-
expect(@resource).to receive(:event).with(:status => "noop", :name => :noop_restart).and_return(event)
|
280
|
+
expect(@resource).to receive(:event).with({:status => "noop", :name => :noop_restart}).and_return(event)
|
281
281
|
expect(@manager).to receive(:queue_events).with(@resource, [event])
|
282
282
|
|
283
283
|
@manager.process_events(@resource)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
2
|
+
require 'puppet_spec/compiler'
|
3
3
|
require 'puppet'
|
4
4
|
require 'puppet/transaction/report'
|
5
5
|
require 'matchers/json'
|
@@ -7,6 +7,7 @@ require 'matchers/json'
|
|
7
7
|
describe Puppet::Transaction::Report do
|
8
8
|
include JSONMatchers
|
9
9
|
include PuppetSpec::Files
|
10
|
+
include PuppetSpec::Compiler
|
10
11
|
|
11
12
|
before do
|
12
13
|
allow(Puppet::Util::Storage).to receive(:store)
|
@@ -136,6 +137,42 @@ describe Puppet::Transaction::Report do
|
|
136
137
|
expect(report.metrics['time'].values.any? {|metric| metric.first =~ /whit/i}).to be_falsey
|
137
138
|
end
|
138
139
|
|
140
|
+
describe "when exclude_unchanged_resources is true" do
|
141
|
+
before do
|
142
|
+
Puppet[:exclude_unchanged_resources] = true
|
143
|
+
end
|
144
|
+
|
145
|
+
let(:test_dir) { tmpdir('unchanged_resources') }
|
146
|
+
let(:test_dir2) { tmpdir('unchanged_resources') }
|
147
|
+
let(:test_file) { tmpfile('some_path')}
|
148
|
+
it 'should still list "changed" resource statuses but remove "unchanged"' do
|
149
|
+
transaction = apply_compiled_manifest(<<-END)
|
150
|
+
notify { "hi": } ~>
|
151
|
+
exec { "/bin/this_command_does_not_exist":
|
152
|
+
command => "#{make_absolute('/bin/this_command_does_not_exist')}",
|
153
|
+
refreshonly => true,
|
154
|
+
}
|
155
|
+
file { '#{test_dir}':
|
156
|
+
ensure => directory
|
157
|
+
}
|
158
|
+
file { 'failing_file':
|
159
|
+
path => '#{test_dir2}',
|
160
|
+
ensure => file
|
161
|
+
}
|
162
|
+
file { 'skipped_file':
|
163
|
+
path => '#{test_file}',
|
164
|
+
require => File[failing_file]
|
165
|
+
}
|
166
|
+
END
|
167
|
+
rs = transaction.report.to_data_hash['resource_statuses']
|
168
|
+
expect(rs["Notify[hi]"]['out_of_sync']).to be true
|
169
|
+
expect(rs["Exec[/bin/this_command_does_not_exist]"]['failed_to_restart']).to be true
|
170
|
+
expect(rs["File[failing_file]"]['failed']).to be true
|
171
|
+
expect(rs["File[skipped_file]"]['skipped']).to be true
|
172
|
+
expect(rs).to_not have_key(["File[#{test_dir}]"])
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
139
176
|
describe "when accepting logs" do
|
140
177
|
before do
|
141
178
|
@report = Puppet::Transaction::Report.new
|
@@ -570,7 +570,7 @@ describe Puppet::Transaction do
|
|
570
570
|
end
|
571
571
|
|
572
572
|
it "should match resources by name, not title" do
|
573
|
-
expect(resource.provider.class).to receive(:prefetch).with("bar" => resource)
|
573
|
+
expect(resource.provider.class).to receive(:prefetch).with({"bar" => resource})
|
574
574
|
|
575
575
|
transaction.prefetch_if_necessary(resource)
|
576
576
|
end
|
@@ -598,7 +598,7 @@ describe Puppet::Transaction do
|
|
598
598
|
catalog.add_resource other
|
599
599
|
|
600
600
|
allow(resource.class).to receive(:defaultprovider).and_return(resource.provider.class)
|
601
|
-
expect(resource.provider.class).to receive(:prefetch).with('bar' => resource, 'other' => other)
|
601
|
+
expect(resource.provider.class).to receive(:prefetch).with({'bar' => resource, 'other' => other})
|
602
602
|
|
603
603
|
transaction.prefetch_if_necessary(resource)
|
604
604
|
end
|
data/spec/unit/type/exec_spec.rb
CHANGED
@@ -295,7 +295,7 @@ RSpec.describe Puppet::Type.type(:exec) do
|
|
295
295
|
|
296
296
|
it "accepts the current user" do
|
297
297
|
allow(Puppet.features).to receive(:root?).and_return(false)
|
298
|
-
allow(Etc).to receive(:getpwuid).and_return(
|
298
|
+
allow(Etc).to receive(:getpwuid).and_return(Etc::Passwd.new('input'))
|
299
299
|
|
300
300
|
type = Puppet::Type.type(:exec).new(:name => '/bin/true whatever', :user => 'input')
|
301
301
|
|
data/spec/unit/type/file_spec.rb
CHANGED
@@ -516,8 +516,8 @@ describe Puppet::Type.type(:file) do
|
|
516
516
|
it "should pass the already-discovered resources to recurse_remote" do
|
517
517
|
file[:source] = File.expand_path(__FILE__)
|
518
518
|
allow(child).to receive(:[]).with(:path).and_return(name)
|
519
|
-
allow(file).to receive(:recurse_local).and_return(name => child)
|
520
|
-
expect(file).to receive(:recurse_remote).with(name => child).and_return([])
|
519
|
+
allow(file).to receive(:recurse_local).and_return({name => child})
|
520
|
+
expect(file).to receive(:recurse_remote).with({name => child}).and_return([])
|
521
521
|
file.recurse
|
522
522
|
end
|
523
523
|
end
|
@@ -526,8 +526,8 @@ describe Puppet::Type.type(:file) do
|
|
526
526
|
it "should use recurse_link" do
|
527
527
|
file[:target] = File.expand_path(__FILE__)
|
528
528
|
allow(child).to receive(:[]).with(:path).and_return(name)
|
529
|
-
allow(file).to receive(:recurse_local).and_return(name => child)
|
530
|
-
expect(file).to receive(:recurse_link).with(name => child).and_return([])
|
529
|
+
allow(file).to receive(:recurse_local).and_return({name => child})
|
530
|
+
expect(file).to receive(:recurse_link).with({name => child}).and_return([])
|
531
531
|
file.recurse
|
532
532
|
end
|
533
533
|
end
|
@@ -82,20 +82,20 @@ describe Puppet::Type.type(:filebucket) do
|
|
82
82
|
it "should use any provided path" do
|
83
83
|
path = make_absolute("/foo/bar")
|
84
84
|
bucket = Puppet::Type.type(:filebucket).new :name => "main", :path => path
|
85
|
-
expect(Puppet::FileBucket::Dipper).to receive(:new).with(:Path => path).and_return(@bucket)
|
85
|
+
expect(Puppet::FileBucket::Dipper).to receive(:new).with({:Path => path}).and_return(@bucket)
|
86
86
|
bucket.bucket
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should use any provided server and port" do
|
90
90
|
bucket = Puppet::Type.type(:filebucket).new :name => "main", :server => "myserv", :port => "myport", :path => false
|
91
|
-
expect(Puppet::FileBucket::Dipper).to receive(:new).with(:Server => "myserv", :Port => "myport").and_return(@bucket)
|
91
|
+
expect(Puppet::FileBucket::Dipper).to receive(:new).with({:Server => "myserv", :Port => "myport"}).and_return(@bucket)
|
92
92
|
bucket.bucket
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should not try to guess server or port if the path is unset and no server is provided" do
|
96
96
|
Puppet.settings[:server] = "myserv"
|
97
97
|
Puppet.settings[:server_list] = ['server_list_0', 'server_list_1']
|
98
|
-
expect(Puppet::FileBucket::Dipper).to receive(:new).with(:Server => nil, :Port => nil).and_return(@bucket)
|
98
|
+
expect(Puppet::FileBucket::Dipper).to receive(:new).with({:Server => nil, :Port => nil}).and_return(@bucket)
|
99
99
|
|
100
100
|
bucket = Puppet::Type.type(:filebucket).new :name => "main", :path => false
|
101
101
|
bucket.bucket
|