puppet 7.21.0 → 7.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/Guardfile.example +1 -1
- data/ext/project_data.yaml +1 -1
- data/ext/windows/service/daemon.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +4 -1
- data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- 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-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 +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/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/indirector/facts/facter_spec.rb +18 -3
- data/spec/unit/indirector/file_server_spec.rb +5 -5
- data/spec/unit/indirector/node/plain_spec.rb +1 -1
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +1 -1
- data/spec/unit/provider/file/posix_spec.rb +4 -4
- data/spec/unit/provider/ldap_spec.rb +1 -1
- data/spec/unit/provider/nameservice_spec.rb +15 -15
- data/spec/unit/provider/package/aix_spec.rb +1 -1
- data/spec/unit/provider/package/nim_spec.rb +2 -2
- 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/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 +2 -2
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/util/backups_spec.rb +1 -1
- data/spec/unit/util/filetype_spec.rb +3 -3
- data/spec/unit/util/resource_template_spec.rb +1 -1
- metadata +8 -2
@@ -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
|
@@ -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)
|
@@ -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)
|
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
|
|
@@ -80,7 +80,7 @@ describe Puppet::Util::Backups do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "a copy should be created in the local directory" do
|
83
|
-
expect(FileUtils).to receive(:cp_r).with(path, backup, :preserve => true)
|
83
|
+
expect(FileUtils).to receive(:cp_r).with(path, backup, {:preserve => true})
|
84
84
|
allow(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true)
|
85
85
|
|
86
86
|
expect(file.perform_backup).to be_truthy
|
@@ -16,7 +16,7 @@ describe Puppet::Util::FileType do
|
|
16
16
|
describe "when the file already exists" do
|
17
17
|
it "should return the file's contents when asked to read it" do
|
18
18
|
expect(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true)
|
19
|
-
expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding.default_external).and_return("my text")
|
19
|
+
expect(Puppet::FileSystem).to receive(:read).with(path, {:encoding => Encoding.default_external}).and_return("my text")
|
20
20
|
|
21
21
|
expect(file.read).to eq("my text")
|
22
22
|
end
|
@@ -46,7 +46,7 @@ describe Puppet::Util::FileType do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should first create a temp file and copy its contents over to the file location" do
|
49
|
-
expect(Tempfile).to receive(:new).with("puppet", :encoding => Encoding.default_external).and_return(tempfile)
|
49
|
+
expect(Tempfile).to receive(:new).with("puppet", {:encoding => Encoding.default_external}).and_return(tempfile)
|
50
50
|
expect(tempfile).to receive(:print).with("my text")
|
51
51
|
expect(tempfile).to receive(:flush)
|
52
52
|
expect(tempfile).to receive(:close)
|
@@ -163,7 +163,7 @@ describe Puppet::Util::FileType do
|
|
163
163
|
@tmp_cron = Tempfile.new("puppet_crontab_spec")
|
164
164
|
@tmp_cron_path = @tmp_cron.path
|
165
165
|
allow(Puppet::Util).to receive(:uid).with(uid).and_return(9000)
|
166
|
-
expect(Tempfile).to receive(:new).with("puppet_#{name}", :encoding => Encoding.default_external).and_return(@tmp_cron)
|
166
|
+
expect(Tempfile).to receive(:new).with("puppet_#{name}", {:encoding => Encoding.default_external}).and_return(@tmp_cron)
|
167
167
|
end
|
168
168
|
|
169
169
|
after :each do
|
@@ -38,7 +38,7 @@ describe Puppet::Util::ResourceTemplate do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should create a template instance with the contents of the file" do
|
41
|
-
expect(Puppet::FileSystem).to receive(:read).with("/my/template", :encoding => 'utf-8').and_return("yay")
|
41
|
+
expect(Puppet::FileSystem).to receive(:read).with("/my/template", {:encoding => 'utf-8'}).and_return("yay")
|
42
42
|
expect(Puppet::Util).to receive(:create_erb).with("yay").and_return(@template)
|
43
43
|
|
44
44
|
allow(@wrapper).to receive(:set_resource_variables)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|
@@ -133,6 +133,9 @@ dependencies:
|
|
133
133
|
- - "~>"
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '1.0'
|
136
|
+
- - "<"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.2.0
|
136
139
|
type: :runtime
|
137
140
|
prerelease: false
|
138
141
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -140,6 +143,9 @@ dependencies:
|
|
140
143
|
- - "~>"
|
141
144
|
- !ruby/object:Gem::Version
|
142
145
|
version: '1.0'
|
146
|
+
- - "<"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: 1.2.0
|
143
149
|
- !ruby/object:Gem::Dependency
|
144
150
|
name: deep_merge
|
145
151
|
requirement: !ruby/object:Gem::Requirement
|