puppet 6.2.0-x86-mingw32 → 6.3.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +70 -0
- data/Gemfile.lock +7 -7
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/lookup.rb +1 -1
- data/lib/puppet/confine/boolean.rb +45 -0
- data/lib/puppet/confine/false.rb +7 -1
- data/lib/puppet/confine/true.rb +7 -1
- data/lib/puppet/defaults.rb +0 -18
- data/lib/puppet/functions/call.rb +2 -1
- data/lib/puppet/functions/group_by.rb +54 -0
- data/lib/puppet/functions/index.rb +167 -0
- data/lib/puppet/functions/partition.rb +54 -0
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/issues.rb +4 -0
- data/lib/puppet/pops/model/factory.rb +38 -4
- data/lib/puppet/pops/parser/egrammar.ra +2 -2
- data/lib/puppet/pops/parser/eparser.rb +2 -2
- data/lib/puppet/pops/parser/heredoc_support.rb +17 -7
- data/lib/puppet/pops/parser/lexer2.rb +6 -1
- data/lib/puppet/pops/parser/locator.rb +106 -86
- data/lib/puppet/pops/parser/parser_support.rb +11 -2
- data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +2 -2
- data/lib/puppet/provider/group/windows_adsi.rb +4 -1
- data/lib/puppet/provider/package/apt.rb +2 -2
- data/lib/puppet/provider/package/dnf.rb +2 -2
- data/lib/puppet/provider/package/gem.rb +2 -2
- data/lib/puppet/provider/package/openbsd.rb +2 -2
- data/lib/puppet/provider/package/pacman.rb +1 -2
- data/lib/puppet/provider/package/pip.rb +1 -2
- data/lib/puppet/provider/package/pip3.rb +1 -2
- data/lib/puppet/provider/package/pkg.rb +2 -4
- data/lib/puppet/provider/package/portage.rb +1 -2
- data/lib/puppet/provider/package/rpm.rb +1 -2
- data/lib/puppet/provider/package/sun.rb +2 -2
- data/lib/puppet/provider/package/windows.rb +2 -2
- data/lib/puppet/provider/package/yum.rb +1 -2
- data/lib/puppet/provider/package/zypper.rb +2 -2
- data/lib/puppet/provider/service/upstart.rb +16 -6
- data/lib/puppet/transaction/resource_harness.rb +1 -0
- data/lib/puppet/type/file.rb +6 -1
- data/lib/puppet/util/log.rb +7 -2
- data/lib/puppet/util/pidlock.rb +14 -1
- data/lib/puppet/util/windows/process.rb +73 -5
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +92 -92
- 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-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +2 -2
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/unit/application_spec.rb +8 -1
- data/spec/unit/confine/false_spec.rb +27 -0
- data/spec/unit/confine/true_spec.rb +27 -0
- data/spec/unit/defaults_spec.rb +0 -14
- data/spec/unit/functions/group_by_spec.rb +40 -0
- data/spec/unit/functions/index_spec.rb +184 -0
- data/spec/unit/functions/partition_spec.rb +40 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +5 -0
- data/spec/unit/pops/parser/locator_spec.rb +45 -0
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +111 -15
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +7 -1
- data/spec/unit/transaction/resource_harness_spec.rb +26 -0
- data/spec/unit/util/execution_spec.rb +2 -2
- data/spec/unit/util/log_spec.rb +15 -0
- data/spec/unit/util/pidlock_spec.rb +21 -1
- metadata +13 -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" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
\fBThis page is autogenerated; any changes will get overwritten\fR
|
6
6
|
.
|
7
7
|
.SH "Configuration settings"
|
@@ -876,7 +876,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
|
|
876
876
|
The HTTP User\-Agent string to send when making network requests\.
|
877
877
|
.
|
878
878
|
.IP "\(bu" 4
|
879
|
-
\fIDefault\fR: Puppet/6\.
|
879
|
+
\fIDefault\fR: Puppet/6\.3\.0 Ruby/2\.4\.1\-p111 (x86_64\-linux)
|
880
880
|
.
|
881
881
|
.IP "" 0
|
882
882
|
.
|
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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-help\fR \- Display Puppet help\.
|
data/man/man8/puppet-key.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\-KEY" "8" "
|
4
|
+
.TH "PUPPET\-KEY" "8" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
|
data/man/man8/puppet-lookup.8
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "
|
4
|
+
.TH "LOOKUP" "8" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
|
-
\
|
7
|
+
\fBlookup\fR \- Interactive Hiera lookup
|
8
8
|
.
|
9
9
|
.SH "SYNOPSIS"
|
10
10
|
Does Hiera lookups from the command line\.
|
data/man/man8/puppet-man.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\-MAN" "8" "
|
4
|
+
.TH "PUPPET\-MAN" "8" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-man\fR \- Display Puppet manual pages\.
|
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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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" "February 2019" "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-status.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\-STATUS" "8" "
|
4
|
+
.TH "PUPPET\-STATUS" "8" "February 2019" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-status\fR \- View puppet server status\.
|
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" "February 2019" "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\. 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 v6\.
|
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 v6\.3\.0
|
@@ -664,10 +664,17 @@ describe Puppet::Application do
|
|
664
664
|
it "should log an exception that is raised" do
|
665
665
|
our_exception = Puppet::DevError.new("test exception")
|
666
666
|
Puppet::Util::Log.expects(:newdestination).with(test_arg).raises(our_exception)
|
667
|
-
Puppet.expects(:
|
667
|
+
Puppet.expects(:log_and_raise).with(our_exception, anything)
|
668
668
|
@app.handle_logdest_arg(test_arg)
|
669
669
|
end
|
670
670
|
|
671
|
+
it "should exit when an exception is raised" do
|
672
|
+
our_exception = Puppet::DevError.new("test exception")
|
673
|
+
Puppet::Util::Log.expects(:newdestination).with(test_arg).raises(our_exception)
|
674
|
+
Puppet.expects(:log_and_raise).with(our_exception, anything).raises(our_exception)
|
675
|
+
expect { @app.handle_logdest_arg(test_arg) }.to raise_error(Puppet::DevError)
|
676
|
+
end
|
677
|
+
|
671
678
|
it "should set the new log destination" do
|
672
679
|
Puppet::Util::Log.expects(:newdestination).with(test_arg)
|
673
680
|
@app.handle_logdest_arg(test_arg)
|
@@ -12,6 +12,33 @@ describe Puppet::Confine::False do
|
|
12
12
|
expect { Puppet::Confine.new }.to raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
|
+
describe "when passing in a lambda as a value for lazy evaluation" do
|
16
|
+
it "should accept it" do
|
17
|
+
confine = Puppet::Confine::False.new(lambda { false })
|
18
|
+
expect(confine.values).to eql([false])
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "when enforcing cache-positive behavior" do
|
22
|
+
def cached_value_of(confine)
|
23
|
+
confine.instance_variable_get(:@cached_value)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should cache a false value" do
|
27
|
+
confine = Puppet::Confine::False.new(lambda { false })
|
28
|
+
confine.values
|
29
|
+
|
30
|
+
expect(cached_value_of(confine)).to eql([false])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not cache a true value" do
|
34
|
+
confine = Puppet::Confine::False.new(lambda { true })
|
35
|
+
confine.values
|
36
|
+
|
37
|
+
expect(cached_value_of(confine)).to be_nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
15
42
|
describe "when testing values" do
|
16
43
|
before { @confine = Puppet::Confine::False.new("foo") }
|
17
44
|
|
@@ -12,6 +12,33 @@ describe Puppet::Confine::True do
|
|
12
12
|
expect { Puppet::Confine::True.new }.to raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
|
+
describe "when passing in a lambda as a value for lazy evaluation" do
|
16
|
+
it "should accept it" do
|
17
|
+
confine = Puppet::Confine::True.new(lambda { true })
|
18
|
+
expect(confine.values).to eql([true])
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "when enforcing cache-positive behavior" do
|
22
|
+
def cached_value_of(confine)
|
23
|
+
confine.instance_variable_get(:@cached_value)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should cache a true value" do
|
27
|
+
confine = Puppet::Confine::True.new(lambda { true })
|
28
|
+
confine.values
|
29
|
+
|
30
|
+
expect(cached_value_of(confine)).to eql([true])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not cache a false value" do
|
34
|
+
confine = Puppet::Confine::True.new(lambda { false })
|
35
|
+
confine.values
|
36
|
+
|
37
|
+
expect(cached_value_of(confine)).to be_nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
15
42
|
describe "when testing values" do
|
16
43
|
before do
|
17
44
|
@confine = Puppet::Confine::True.new("foo")
|
data/spec/unit/defaults_spec.rb
CHANGED
@@ -110,20 +110,6 @@ describe "Defaults" do
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
describe 'server vs server_list' do
|
114
|
-
it 'should warn when both settings are set in code' do
|
115
|
-
Puppet.expects(:deprecation_warning).with('Attempted to set both server and server_list. Server setting will not be used.', :SERVER_DUPLICATION)
|
116
|
-
Puppet.settings[:server] = 'test_server'
|
117
|
-
Puppet.settings[:server_list] = ['one', 'two']
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should warn when both settings are set by command line' do
|
121
|
-
Puppet.expects(:deprecation_warning).with('Attempted to set both server and server_list. Server setting will not be used.', :SERVER_DUPLICATION)
|
122
|
-
Puppet.settings.handlearg("--server_list", "one,two")
|
123
|
-
Puppet.settings.handlearg("--server", "test_server")
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
113
|
describe 'manage_internal_file_permissions' do
|
128
114
|
describe 'on windows', :if => Puppet::Util::Platform.windows? do
|
129
115
|
it 'should default to false' do
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'puppet_spec/compiler'
|
4
|
+
require 'matchers/resource'
|
5
|
+
|
6
|
+
describe 'the group_by function' do
|
7
|
+
include PuppetSpec::Compiler
|
8
|
+
include Matchers::Resource
|
9
|
+
|
10
|
+
context 'for an array' do
|
11
|
+
it 'groups by item' do
|
12
|
+
manifest = "notify { String(group_by([a, b, ab]) |$s| { $s.length }): }"
|
13
|
+
expect(compile_to_catalog(manifest)).to have_resource("Notify[{1 => ['a', 'b'], 2 => ['ab']}]")
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'groups by index, item' do
|
17
|
+
manifest = "notify { String(group_by([a, b, ab]) |$i, $s| { $i%2 + $s.length }): }"
|
18
|
+
expect(compile_to_catalog(manifest)).to have_resource("Notify[{1 => ['a'], 2 => ['b', 'ab']}]")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'for a hash' do
|
23
|
+
it 'groups by key-value pair' do
|
24
|
+
manifest = "notify { String(group_by(a => [1, 2], b => [1]) |$kv| { $kv[1].length }): }"
|
25
|
+
expect(compile_to_catalog(manifest)).to have_resource("Notify[{2 => [['a', [1, 2]]], 1 => [['b', [1]]]}]")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'groups by key, value' do
|
29
|
+
manifest = "notify { String(group_by(a => [1, 2], b => [1]) |$k, $v| { $v.length }): }"
|
30
|
+
expect(compile_to_catalog(manifest)).to have_resource("Notify[{2 => [['a', [1, 2]]], 1 => [['b', [1]]]}]")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'for a string' do
|
35
|
+
it 'fails' do
|
36
|
+
manifest = "notify { String(group_by('something') |$s| { $s.length }): }"
|
37
|
+
expect { compile_to_catalog(manifest) }.to raise_error(Puppet::PreformattedError)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet_spec/compiler'
|
4
|
+
|
5
|
+
require 'shared_behaviours/iterative_functions'
|
6
|
+
|
7
|
+
describe 'the index function' do
|
8
|
+
include PuppetSpec::Compiler
|
9
|
+
|
10
|
+
context "should be callable on Array with" do
|
11
|
+
it 'a lambda to compute match' do
|
12
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
13
|
+
$a = [1,2,3]
|
14
|
+
$n = $a.index |$v| { $v == 2 }
|
15
|
+
file { "$n": ensure => present }
|
16
|
+
MANIFEST
|
17
|
+
expect(catalog.resource(:file, "1")['ensure']).to eq('present')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'a lambda taking two arguments to compute match' do
|
21
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
22
|
+
$a = [6,6,6]
|
23
|
+
$n = $a.index |$i, $v| { $i == 2 }
|
24
|
+
file { "$n": ensure => present }
|
25
|
+
MANIFEST
|
26
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'a given value' do
|
30
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
31
|
+
$a = [1,2,3]
|
32
|
+
$n = $a.index(3)
|
33
|
+
file { "$n": ensure => present }
|
34
|
+
MANIFEST
|
35
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "should be callable on Hash with" do
|
40
|
+
it 'a lambda to compute match' do
|
41
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
42
|
+
$h = {1 => 10, 2 => 20, 3 => 30 }
|
43
|
+
$n = $h.index |$v| { $v == 20 }
|
44
|
+
file { "$n": ensure => present }
|
45
|
+
MANIFEST
|
46
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'a lambda taking two arguments to compute match' do
|
50
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
51
|
+
$h = {1 => 10, 2 => 20, 3 => 30 }
|
52
|
+
$n = $h.index |$k, $v| { $k == 3 }
|
53
|
+
file { "$n": ensure => present }
|
54
|
+
MANIFEST
|
55
|
+
expect(catalog.resource(:file, "3")['ensure']).to eq('present')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'a given value' do
|
59
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
60
|
+
$h = {1 => 10, 2 => 20, 3 => 30 }
|
61
|
+
$n = $h.index(20)
|
62
|
+
file { "$n": ensure => present }
|
63
|
+
MANIFEST
|
64
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "should be callable on String with" do
|
69
|
+
it 'a lambda to compute match' do
|
70
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
71
|
+
$s = "foobarfuu"
|
72
|
+
$n = $s.index |$v| { $v == 'o' }
|
73
|
+
file { "$n": ensure => present }
|
74
|
+
MANIFEST
|
75
|
+
expect(catalog.resource(:file, "1")['ensure']).to eq('present')
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'a lambda taking two arguments to compute match' do
|
79
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
80
|
+
$s = "foobarfuu"
|
81
|
+
$n = $s.index |$i, $v| { $i == 2 }
|
82
|
+
file { "$n": ensure => present }
|
83
|
+
MANIFEST
|
84
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'a given value returns index of first found substring given as a string' do
|
88
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
89
|
+
$s = "foobarfuu"
|
90
|
+
$n = $s.index('fu')
|
91
|
+
file { "$n": ensure => present }
|
92
|
+
MANIFEST
|
93
|
+
expect(catalog.resource(:file, "6")['ensure']).to eq('present')
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'a given value returns index of first found substring given as a regexp' do
|
97
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
98
|
+
$s = "foobarfuub"
|
99
|
+
$n = $s.index(/f(oo|uu)b/)
|
100
|
+
file { "$n": ensure => present }
|
101
|
+
MANIFEST
|
102
|
+
expect(catalog.resource(:file, "0")['ensure']).to eq('present')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "should be callable on an iterable" do
|
107
|
+
it 'for example a reverse_each' do
|
108
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
109
|
+
$a = [1,2,3]
|
110
|
+
$n = $a.reverse_each.index |$v| { $v == 1 }
|
111
|
+
file { "$n": ensure => present }
|
112
|
+
MANIFEST
|
113
|
+
expect(catalog.resource(:file, "2")['ensure']).to eq('present')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'stops iteration when result is known' do
|
118
|
+
it 'true when boolean true is found' do
|
119
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
120
|
+
$a = [1,2,3]
|
121
|
+
$n = $a.index |$i, $v| { if $i == 0 { true } else { fail("unwanted") } }
|
122
|
+
file { "$n": ensure => present }
|
123
|
+
MANIFEST
|
124
|
+
|
125
|
+
expect(catalog.resource(:file, "0")['ensure']).to eq('present')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'returns undef when value is not found' do
|
130
|
+
it 'when using array and a lambda' do
|
131
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
132
|
+
$a = [1,2,3]
|
133
|
+
$n = $a.index |$v| { $v == 'blue' }
|
134
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
135
|
+
MANIFEST
|
136
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'when using array and a value' do
|
140
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
141
|
+
$a = [1,2,3]
|
142
|
+
$n = $a.index('blue')
|
143
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
144
|
+
MANIFEST
|
145
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'when using a hash and a lambda' do
|
149
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
150
|
+
$h = {1 => 10, 2 => 20, 3 => 30}
|
151
|
+
$n = $h.index |$v| { $v == 'blue' }
|
152
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
153
|
+
MANIFEST
|
154
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'when using a hash and a value' do
|
158
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
159
|
+
$h = {1 => 10, 2 => 20, 3 => 30}
|
160
|
+
$n = $h.index('blue')
|
161
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
162
|
+
MANIFEST
|
163
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'when using a String and a lambda' do
|
167
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
168
|
+
$s = "foobarfuub"
|
169
|
+
$n = $s.index() |$v| { false }
|
170
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
171
|
+
MANIFEST
|
172
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'when using a String and a value' do
|
176
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
177
|
+
$s = "foobarfuub"
|
178
|
+
$n = $s.index('banana')
|
179
|
+
file { "test": ensure => if $n =~ Undef { present } else {absent} }
|
180
|
+
MANIFEST
|
181
|
+
expect(catalog.resource(:file, "test")['ensure']).to eq('present')
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|