puppet 7.11.0 → 7.12.0
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 +5 -5
- data/lib/puppet/configurer.rb +15 -16
- data/lib/puppet/file_system.rb +2 -1
- data/lib/puppet/pops/evaluator/closure.rb +7 -5
- data/lib/puppet/provider/package/pkg.rb +10 -0
- data/lib/puppet/provider/user/useradd.rb +20 -0
- data/lib/puppet/type/service.rb +8 -3
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/json.rb +3 -0
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +183 -179
- 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/unit/configurer_spec.rb +14 -0
- data/spec/unit/network/formats_spec.rb +6 -0
- data/spec/unit/provider/package/pkg_spec.rb +15 -0
- data/spec/unit/provider/user/useradd_spec.rb +40 -0
- data/spec/unit/type/service_spec.rb +27 -0
- data/spec/unit/util/autoload_spec.rb +25 -8
- metadata +2 -2
data/man/man5/puppet.conf.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPETCONF" "5" "
|
4
|
+
.TH "PUPPETCONF" "5" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
\fBThis page is autogenerated; any changes will get overwritten\fR
|
6
6
|
.
|
7
7
|
.SH "Configuration settings"
|
@@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
|
|
929
929
|
The HTTP User\-Agent string to send when making network requests\.
|
930
930
|
.
|
931
931
|
.IP "\(bu" 4
|
932
|
-
\fIDefault\fR: \fBPuppet/7\.
|
932
|
+
\fIDefault\fR: \fBPuppet/7\.12\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR
|
933
933
|
.
|
934
934
|
.IP "" 0
|
935
935
|
.
|
data/man/man8/puppet-agent.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-AGENT" "8" "
|
4
|
+
.TH "PUPPET\-AGENT" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-agent\fR \- The puppet agent daemon
|
data/man/man8/puppet-apply.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-APPLY" "8" "
|
4
|
+
.TH "PUPPET\-APPLY" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-apply\fR \- Apply Puppet manifests locally
|
data/man/man8/puppet-catalog.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-CATALOG" "8" "
|
4
|
+
.TH "PUPPET\-CATALOG" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
|
data/man/man8/puppet-config.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-CONFIG" "8" "
|
4
|
+
.TH "PUPPET\-CONFIG" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
|
data/man/man8/puppet-describe.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-DESCRIBE" "8" "
|
4
|
+
.TH "PUPPET\-DESCRIBE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-describe\fR \- Display help about resource types
|
data/man/man8/puppet-device.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-DEVICE" "8" "
|
4
|
+
.TH "PUPPET\-DEVICE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-device\fR \- Manage remote network devices
|
data/man/man8/puppet-doc.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-DOC" "8" "
|
4
|
+
.TH "PUPPET\-DOC" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-doc\fR \- Generate Puppet references
|
data/man/man8/puppet-epp.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-EPP" "8" "
|
4
|
+
.TH "PUPPET\-EPP" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
|
data/man/man8/puppet-facts.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-FACTS" "8" "
|
4
|
+
.TH "PUPPET\-FACTS" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-facts\fR \- Retrieve and store facts\.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-FILEBUCKET" "8" "
|
4
|
+
.TH "PUPPET\-FILEBUCKET" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
|
data/man/man8/puppet-generate.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-GENERATE" "8" "
|
4
|
+
.TH "PUPPET\-GENERATE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
|
data/man/man8/puppet-help.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-HELP" "8" "
|
4
|
+
.TH "PUPPET\-HELP" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-help\fR \- Display Puppet help\.
|
data/man/man8/puppet-lookup.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-LOOKUP" "8" "
|
4
|
+
.TH "PUPPET\-LOOKUP" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-lookup\fR \- Interactive Hiera lookup
|
data/man/man8/puppet-module.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-MODULE" "8" "
|
4
|
+
.TH "PUPPET\-MODULE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
|
data/man/man8/puppet-node.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-NODE" "8" "
|
4
|
+
.TH "PUPPET\-NODE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-node\fR \- View and manage node definitions\.
|
data/man/man8/puppet-parser.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PARSER" "8" "
|
4
|
+
.TH "PUPPET\-PARSER" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-parser\fR \- Interact directly with the parser\.
|
data/man/man8/puppet-plugin.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-PLUGIN" "8" "
|
4
|
+
.TH "PUPPET\-PLUGIN" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
|
data/man/man8/puppet-report.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-REPORT" "8" "
|
4
|
+
.TH "PUPPET\-REPORT" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-report\fR \- Create, display, and submit reports\.
|
data/man/man8/puppet-resource.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-RESOURCE" "8" "
|
4
|
+
.TH "PUPPET\-RESOURCE" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource\fR \- The resource abstraction layer shell
|
data/man/man8/puppet-script.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-SCRIPT" "8" "
|
4
|
+
.TH "PUPPET\-SCRIPT" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
|
data/man/man8/puppet-ssl.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET\-SSL" "8" "
|
4
|
+
.TH "PUPPET\-SSL" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
|
data/man/man8/puppet.8
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PUPPET" "8" "
|
4
|
+
.TH "PUPPET" "8" "October 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\fR
|
@@ -25,4 +25,4 @@ Specialized:
|
|
25
25
|
catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
|
26
26
|
.
|
27
27
|
.P
|
28
|
-
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.
|
28
|
+
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.12\.0
|
@@ -1282,6 +1282,20 @@ describe Puppet::Configurer do
|
|
1282
1282
|
expect(configurer.environment).to eq(last_server_specified_environment)
|
1283
1283
|
end
|
1284
1284
|
|
1285
|
+
it "pushes the converged environment found in lastrunfile over the existing context" do
|
1286
|
+
initial_env = Puppet::Node::Environment.remote('production')
|
1287
|
+
Puppet.push_context(
|
1288
|
+
current_environment: initial_env,
|
1289
|
+
loaders: Puppet::Pops::Loaders.new(initial_env, true))
|
1290
|
+
|
1291
|
+
expect(Puppet).to receive(:push_context).with(
|
1292
|
+
hash_including(:current_environment, :loaders),
|
1293
|
+
"Local node environment #{last_server_specified_environment} for configurer transaction"
|
1294
|
+
).once.and_call_original
|
1295
|
+
|
1296
|
+
configurer.run
|
1297
|
+
end
|
1298
|
+
|
1285
1299
|
it "uses environment from Puppet[:environment] if strict_environment_mode is set" do
|
1286
1300
|
Puppet[:strict_environment_mode] = true
|
1287
1301
|
configurer.run
|
@@ -368,6 +368,12 @@ describe "Puppet Network Format" do
|
|
368
368
|
expect(json.render_multiple(instances)).to eq([{"string" => "foo"}].to_json)
|
369
369
|
end
|
370
370
|
|
371
|
+
it "should render multiple instances as a JSON array of hashes when multi_json is not present" do
|
372
|
+
hide_const("MultiJson") if defined?(MultiJson)
|
373
|
+
instances = [FormatsTest.new("foo")]
|
374
|
+
expect(json.render_multiple(instances)).to eq([{"string" => "foo"}].to_json)
|
375
|
+
end
|
376
|
+
|
371
377
|
it "should intern an instance from a JSON hash" do
|
372
378
|
text = Puppet::Util::Json.dump({"string" => "parsed_json"})
|
373
379
|
instance = json.intern(FormatsTest, text)
|
@@ -414,6 +414,21 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
414
414
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
415
415
|
provider.insync?(is)
|
416
416
|
end
|
417
|
+
|
418
|
+
it "should try 5 times to install and fail when all tries failed" do
|
419
|
+
allow_any_instance_of(Kernel).to receive(:sleep)
|
420
|
+
|
421
|
+
expect(provider).to receive(:query).and_return({:ensure => :absent})
|
422
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
423
|
+
expect(provider).to receive(:unhold)
|
424
|
+
expect(Puppet::Util::Execution).to receive(:execute)
|
425
|
+
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
|
426
|
+
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 7))
|
427
|
+
.exactly(5).times
|
428
|
+
expect {
|
429
|
+
provider.update
|
430
|
+
}.to raise_error(Puppet::Error, /Pkg could not install dummy after 5 tries. Aborting run/)
|
431
|
+
end
|
417
432
|
end
|
418
433
|
end
|
419
434
|
end
|
@@ -352,6 +352,46 @@ describe Puppet::Type.type(:user).provider(:useradd) do
|
|
352
352
|
end
|
353
353
|
end
|
354
354
|
|
355
|
+
describe "#shell" do
|
356
|
+
before { described_class.has_feature :manages_local_users_and_groups }
|
357
|
+
|
358
|
+
let(:content) { "myuser:x:x:x:x:x:/bin/local_shell" }
|
359
|
+
|
360
|
+
it "should return the local shell string when forcelocal is true" do
|
361
|
+
resource[:forcelocal] = true
|
362
|
+
allow(Puppet::FileSystem).to receive(:exist?).with('/etc/passwd').and_return(true)
|
363
|
+
allow(Puppet::FileSystem).to receive(:each_line).with('/etc/passwd').and_yield(content)
|
364
|
+
expect(provider.shell).to eq('/bin/local_shell')
|
365
|
+
end
|
366
|
+
|
367
|
+
it "should fall back to nameservice shell string when forcelocal is false" do
|
368
|
+
resource[:forcelocal] = false
|
369
|
+
allow(provider).to receive(:get).with(:shell).and_return('/bin/remote_shell')
|
370
|
+
expect(provider).not_to receive(:localshell)
|
371
|
+
expect(provider.shell).to eq('/bin/remote_shell')
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
describe "#home" do
|
376
|
+
before { described_class.has_feature :manages_local_users_and_groups }
|
377
|
+
|
378
|
+
let(:content) { "myuser:x:x:x:x:/opt/local_home:x" }
|
379
|
+
|
380
|
+
it "should return the local home string when forcelocal is true" do
|
381
|
+
resource[:forcelocal] = true
|
382
|
+
allow(Puppet::FileSystem).to receive(:exist?).with('/etc/passwd').and_return(true)
|
383
|
+
allow(Puppet::FileSystem).to receive(:each_line).with('/etc/passwd').and_yield(content)
|
384
|
+
expect(provider.home).to eq('/opt/local_home')
|
385
|
+
end
|
386
|
+
|
387
|
+
it "should fall back to nameservice home string when forcelocal is false" do
|
388
|
+
resource[:forcelocal] = false
|
389
|
+
allow(provider).to receive(:get).with(:home).and_return('/opt/remote_home')
|
390
|
+
expect(provider).not_to receive(:localhome)
|
391
|
+
expect(provider.home).to eq('/opt/remote_home')
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
355
395
|
describe "#gid" do
|
356
396
|
before { described_class.has_feature :manages_local_users_and_groups }
|
357
397
|
|
@@ -158,6 +158,33 @@ describe test_title, "when validating attribute values" do
|
|
158
158
|
expect(srv[:timeout]).to eq(int)
|
159
159
|
end
|
160
160
|
end
|
161
|
+
|
162
|
+
it "should default :timeout to 10 when provider has no default value" do
|
163
|
+
srv = Puppet::Type.type(:service).new(:name => "yay")
|
164
|
+
expect(srv[:timeout]).to eq(10)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should default :timeout to provider given default time when it has one" do
|
168
|
+
provider_class_with_timeout = Puppet::Type.type(:service).provide(:simple) do
|
169
|
+
has_features :configurable_timeout
|
170
|
+
def default_timeout
|
171
|
+
30
|
172
|
+
end
|
173
|
+
end
|
174
|
+
allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class_with_timeout)
|
175
|
+
|
176
|
+
srv = Puppet::Type.type(:service).new(:name => "yay")
|
177
|
+
expect(srv[:timeout]).to eq(30)
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should accept string as value" do
|
181
|
+
srv = Puppet::Type.type(:service).new(:name => "yay", :timeout => "25")
|
182
|
+
expect(srv[:timeout]).to eq(25)
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should not support values that cannot be converted to Integer such as Array" do
|
186
|
+
expect { Puppet::Type.type(:service).new(:name => "yay", :timeout => [25]) }.to raise_error(Puppet::Error)
|
187
|
+
end
|
161
188
|
end
|
162
189
|
|
163
190
|
describe "the service logon credentials" do
|
@@ -178,15 +178,14 @@ describe Puppet::Util::Autoload do
|
|
178
178
|
end
|
179
179
|
|
180
180
|
describe "when loading all files" do
|
181
|
+
let(:basedir) { tmpdir('autoloader') }
|
182
|
+
let(:path) { File.join(basedir, @autoload.path, 'file.rb') }
|
183
|
+
|
181
184
|
before do
|
182
|
-
|
183
|
-
|
184
|
-
allow(Dir).to receive(:glob).and_return([make_absolute("/a/foo/file.rb")])
|
185
|
-
allow(Puppet::FileSystem).to receive(:exist?).and_return(true)
|
186
|
-
@time_a = Time.utc(2010, 'jan', 1, 6, 30)
|
187
|
-
allow(File).to receive(:mtime).and_return(@time_a)
|
185
|
+
FileUtils.mkdir_p(File.dirname(path))
|
186
|
+
FileUtils.touch(path)
|
188
187
|
|
189
|
-
allow(@autoload.class).to receive(:
|
188
|
+
allow(@autoload.class).to receive(:search_directories).and_return([basedir])
|
190
189
|
end
|
191
190
|
|
192
191
|
[RuntimeError, LoadError, SyntaxError].each do |error|
|
@@ -198,7 +197,25 @@ describe Puppet::Util::Autoload do
|
|
198
197
|
end
|
199
198
|
|
200
199
|
it "should require the full path to the file" do
|
201
|
-
expect(Kernel).to receive(:load).with(
|
200
|
+
expect(Kernel).to receive(:load).with(path, any_args)
|
201
|
+
|
202
|
+
@autoload.loadall(env)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "autoloads from a directory whose ancestor is Windows 8.3", if: Puppet::Util::Platform.windows? do
|
206
|
+
# File.expand_path will expand ~ in the last directory component only(!)
|
207
|
+
# so create an ancestor directory with a long path
|
208
|
+
dir = File.join(tmpdir('longpath'), 'short')
|
209
|
+
path = File.join(dir, @autoload.path, 'file.rb')
|
210
|
+
|
211
|
+
FileUtils.mkdir_p(File.dirname(path))
|
212
|
+
FileUtils.touch(path)
|
213
|
+
|
214
|
+
dir83 = File.join(File.dirname(basedir), 'longpa~1', 'short')
|
215
|
+
path83 = File.join(dir83, @autoload.path, 'file.rb')
|
216
|
+
|
217
|
+
allow(@autoload.class).to receive(:search_directories).and_return([dir83])
|
218
|
+
expect(Kernel).to receive(:load).with(path83, any_args)
|
202
219
|
|
203
220
|
@autoload.loadall(env)
|
204
221
|
end
|
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.12.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: 2021-
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|