puppet 6.8.1-x86-mingw32 → 6.9.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.

Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +10 -11
  4. data/ext/project_data.yaml +1 -0
  5. data/lib/puppet.rb +9 -1
  6. data/lib/puppet/application/agent.rb +12 -0
  7. data/lib/puppet/application_support.rb +1 -1
  8. data/lib/puppet/context.rb +120 -48
  9. data/lib/puppet/face/config.rb +10 -48
  10. data/lib/puppet/face/help.rb +1 -1
  11. data/lib/puppet/face/plugin.rb +9 -2
  12. data/lib/puppet/forge/repository.rb +1 -1
  13. data/lib/puppet/functions/regsubst.rb +58 -37
  14. data/lib/puppet/indirector/catalog/compiler.rb +10 -6
  15. data/lib/puppet/module_tool/applications/uninstaller.rb +2 -3
  16. data/lib/puppet/network/http/connection.rb +1 -1
  17. data/lib/puppet/network/http/factory.rb +1 -1
  18. data/lib/puppet/network/http_pool.rb +1 -0
  19. data/lib/puppet/provider/package/dnf.rb +1 -1
  20. data/lib/puppet/provider/package/rpm.rb +51 -13
  21. data/lib/puppet/provider/package/yum.rb +8 -4
  22. data/lib/puppet/provider/service/systemd.rb +1 -1
  23. data/lib/puppet/settings.rb +40 -0
  24. data/lib/puppet/ssl.rb +1 -1
  25. data/lib/puppet/ssl/base.rb +1 -1
  26. data/lib/puppet/ssl/openssl_loader.rb +28 -0
  27. data/lib/puppet/ssl/validator.rb +1 -1
  28. data/lib/puppet/ssl/validator/default_validator.rb +1 -1
  29. data/lib/puppet/ssl/validator/no_validator.rb +1 -1
  30. data/lib/puppet/thread_local.rb +7 -0
  31. data/lib/puppet/type/exec.rb +14 -6
  32. data/lib/puppet/type/group.rb +4 -2
  33. data/lib/puppet/type/package.rb +10 -0
  34. data/lib/puppet/type/user.rb +4 -2
  35. data/lib/puppet/util/checksums.rb +3 -3
  36. data/lib/puppet/util/http_proxy.rb +8 -6
  37. data/lib/puppet/util/monkey_patches.rb +53 -47
  38. data/lib/puppet/util/platform.rb +16 -0
  39. data/lib/puppet/util/ssl.rb +1 -1
  40. data/lib/puppet/util/windows/root_certs.rb +1 -1
  41. data/lib/puppet/version.rb +1 -1
  42. data/lib/puppet/x509.rb +1 -1
  43. data/locales/puppet.pot +119 -119
  44. data/man/man5/puppet.conf.5 +2 -2
  45. data/man/man8/puppet-agent.8 +1 -1
  46. data/man/man8/puppet-apply.8 +1 -1
  47. data/man/man8/puppet-catalog.8 +1 -1
  48. data/man/man8/puppet-config.8 +1 -1
  49. data/man/man8/puppet-describe.8 +1 -1
  50. data/man/man8/puppet-device.8 +1 -1
  51. data/man/man8/puppet-doc.8 +1 -1
  52. data/man/man8/puppet-epp.8 +1 -1
  53. data/man/man8/puppet-facts.8 +1 -1
  54. data/man/man8/puppet-filebucket.8 +1 -1
  55. data/man/man8/puppet-generate.8 +1 -1
  56. data/man/man8/puppet-help.8 +1 -1
  57. data/man/man8/puppet-key.8 +1 -1
  58. data/man/man8/puppet-lookup.8 +1 -1
  59. data/man/man8/puppet-man.8 +1 -1
  60. data/man/man8/puppet-module.8 +1 -1
  61. data/man/man8/puppet-node.8 +1 -1
  62. data/man/man8/puppet-parser.8 +1 -1
  63. data/man/man8/puppet-plugin.8 +1 -1
  64. data/man/man8/puppet-report.8 +1 -1
  65. data/man/man8/puppet-resource.8 +1 -1
  66. data/man/man8/puppet-script.8 +1 -1
  67. data/man/man8/puppet-ssl.8 +1 -1
  68. data/man/man8/puppet-status.8 +1 -1
  69. data/man/man8/puppet.8 +3 -3
  70. data/spec/integration/provider/service/systemd_spec.rb +7 -6
  71. data/spec/integration/util/execution_spec.rb +1 -1
  72. data/spec/lib/puppet_spec/matchers.rb +0 -13
  73. data/spec/spec_helper.rb +1 -3
  74. data/spec/unit/application/agent_spec.rb +19 -0
  75. data/spec/unit/context_spec.rb +119 -38
  76. data/spec/unit/face/help_spec.rb +1 -1
  77. data/spec/unit/face/plugin_spec.rb +8 -0
  78. data/spec/unit/forge/forge_spec.rb +1 -3
  79. data/spec/unit/forge/repository_spec.rb +1 -3
  80. data/spec/unit/functions/contain_spec.rb +1 -1
  81. data/spec/unit/indirector/catalog/compiler_spec.rb +62 -5
  82. data/spec/unit/module_tool/applications/uninstaller_spec.rb +16 -7
  83. data/spec/unit/node/environment_spec.rb +1 -1
  84. data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
  85. data/spec/unit/provider/package/dnf_spec.rb +7 -0
  86. data/spec/unit/provider/package/pkgin_spec.rb +1 -1
  87. data/spec/unit/provider/package/rpm_spec.rb +150 -16
  88. data/spec/unit/provider/package/yum_spec.rb +7 -0
  89. data/spec/unit/type/exec_spec.rb +9 -0
  90. data/spec/unit/type/schedule_spec.rb +1 -1
  91. data/spec/unit/util/http_proxy_spec.rb +50 -0
  92. data/spec/unit/util/inifile_spec.rb +5 -5
  93. metadata +18 -2
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -904,7 +904,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
904
904
  The HTTP User\-Agent string to send when making network requests\.
905
905
  .
906
906
  .IP "\(bu" 4
907
- \fIDefault\fR: Puppet/6\.8\.0 Ruby/2\.4\.1\-p111 (x86_64\-linux)
907
+ \fIDefault\fR: Puppet/6\.9\.0 Ruby/2\.4\.1\-p111 (x86_64\-linux)
908
908
  .
909
909
  .IP "" 0
910
910
  .
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-agent\fR \- The puppet agent daemon
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-apply\fR \- Apply Puppet manifests locally
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-describe\fR \- Display help about resource types
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "September 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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
@@ -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 "LOOKUP" "8" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "LOOKUP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBlookup\fR \- Interactive Hiera lookup
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-man\fR \- Display Puppet manual pages\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "September 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\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-resource\fR \- The resource abstraction layer shell
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "September 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
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "September 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
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-status\fR \- View puppet server status\.
@@ -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" "August 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "September 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -22,7 +22,7 @@ agent The puppet agent daemon apply Apply Puppet manifests locally config Intera
22
22
  Specialized:
23
23
  .
24
24
  .br
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
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 v6\.8\.0
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\.9\.0
@@ -7,18 +7,19 @@ describe test_title, unless: Puppet::Util::Platform.jruby? do
7
7
 
8
8
  # TODO: Unfortunately there does not seem a way to stub the executable
9
9
  # checks in the systemd provider because they happen at load time.
10
- it "should be considered suitable if /proc/1/exe is present and points to 'systemd'",
11
- :if => File.exist?('/proc/1/exe') && Puppet::FileSystem.readlink('/proc/1/exe').include?('systemd') do
10
+
11
+ it "should be considered suitable if /proc/1/comm is present and contains 'systemd'",
12
+ :if => File.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd') do
12
13
  expect(provider_class).to be_suitable
13
14
  end
14
15
 
15
- it "should not be considered suitable if /proc/1/exe is present it does not point to 'systemd'",
16
- :if => File.exist?('/proc/1/exe') && !Puppet::FileSystem.readlink('/proc/1/exe').include?('systemd') do
16
+ it "should not be considered suitable if /proc/1/comm is present it does not contain 'systemd'",
17
+ :if => File.exist?('/proc/1/comm') && !Puppet::FileSystem.read('/proc/1/comm').include?('systemd') do
17
18
  expect(provider_class).not_to be_suitable
18
19
  end
19
20
 
20
- it "should not be considered suitable if /proc/1/exe is absent",
21
- :if => !File.exist?('/proc/1/exe') do
21
+ it "should not be considered suitable if /proc/1/comm is absent",
22
+ :if => !File.exist?('/proc/1/comm') do
22
23
  expect(provider_class).not_to be_suitable
23
24
  end
24
25
  end
@@ -52,7 +52,7 @@ describe Puppet::Util::Execution, unless: Puppet::Util::Platform.jruby? do
52
52
  end
53
53
  end
54
54
 
55
- describe "#execute (non-Windows)", :if => !Puppet.features.microsoft_windows? do
55
+ describe "#execute (non-Windows)", :if => !Puppet::Util::Platform.windows? do
56
56
  it "should execute basic shell command" do
57
57
  result = Puppet::Util::Execution.execute("ls /tmp", :failonfail => true)
58
58
  expect(result.exitstatus).to eq(0)
@@ -1,18 +1,5 @@
1
1
  require 'stringio'
2
2
 
3
- ########################################################################
4
- # Backward compatibility for Jenkins outdated environment.
5
- module RSpec
6
- module Matchers
7
- module BlockAliases
8
- alias_method :to, :should unless method_defined? :to
9
- alias_method :to_not, :should_not unless method_defined? :to_not
10
- alias_method :not_to, :should_not unless method_defined? :not_to
11
- end
12
- end
13
- end
14
-
15
-
16
3
  ########################################################################
17
4
  # Custom matchers...
18
5
  RSpec::Matchers.define :have_matching_element do |expected|
@@ -20,10 +20,8 @@ require 'puppet'
20
20
  # FastGettext's implementation of these methods.
21
21
  require 'puppet/gettext/stubs'
22
22
 
23
- gem 'rspec', '>=3.1.0'
24
- require 'rspec/expectations'
23
+ require 'rspec'
25
24
  require 'rspec/its'
26
- require 'rspec/collection_matchers'
27
25
 
28
26
  # So everyone else doesn't have to include this base constant.
29
27
  module PuppetSpec
@@ -603,6 +603,25 @@ describe Puppet::Application::Agent do
603
603
  end
604
604
  end
605
605
 
606
+ describe "when starting in daemon mode on non-windows", :unless => Puppet.features.microsoft_windows? do
607
+ before :each do
608
+ allow(Puppet).to receive(:notice)
609
+ Puppet[:daemonize] = true
610
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
611
+ end
612
+
613
+ it "should not print config in default mode" do
614
+ execute_agent
615
+ expect(@logs).to be_empty
616
+ end
617
+
618
+ it "should print config in debug mode" do
619
+ @puppetd.options[:debug] = true
620
+ execute_agent
621
+ expect(@logs).to include(an_object_having_attributes(level: :debug, message: /agent_catalog_run_lockfile=/))
622
+ end
623
+ end
624
+
606
625
  def execute_agent
607
626
  @puppetd.setup
608
627
  @puppetd.run_command
@@ -3,35 +3,11 @@ require 'spec_helper'
3
3
  describe Puppet::Context do
4
4
  let(:context) { Puppet::Context.new({ :testing => "value" }) }
5
5
 
6
- context "with the implicit test_helper.rb pushed context" do
7
- it "fails to lookup a value that does not exist" do
8
- expect { context.lookup("a") }.to raise_error(Puppet::Context::UndefinedBindingError)
9
- end
10
-
11
- it "calls a provided block for a default value when none is found" do
12
- expect(context.lookup("a") { "default" }).to eq("default")
13
- end
14
-
15
- it "behaves as if pushed a {} if you push nil" do
16
- context.push(nil)
17
- expect(context.lookup(:testing)).to eq("value")
18
- context.pop
19
- end
20
-
21
- it "fails if you try to pop off the top of the stack" do
22
- expect { context.pop }.to raise_error(Puppet::Context::StackUnderflow)
23
- end
24
- end
25
-
26
6
  describe "with additional context" do
27
7
  before :each do
28
8
  context.push("a" => 1)
29
9
  end
30
10
 
31
- it "holds values for later lookup" do
32
- expect(context.lookup("a")).to eq(1)
33
- end
34
-
35
11
  it "allows rebinding values in a nested context" do
36
12
  inner = nil
37
13
  context.override("a" => 2) do
@@ -111,26 +87,131 @@ describe Puppet::Context do
111
87
  end
112
88
  end
113
89
 
114
- context 'support lazy entries' do
115
- it 'by evaluating a bound proc' do
116
- result = nil
117
- context.override(:a => lambda {|| 'yay'}) do
118
- result = context.lookup(:a)
90
+ context "with multiple threads" do
91
+ it "a value pushed in another thread is not seen in the original thread" do
92
+ context.push(a: 1)
93
+ t = Thread.new do
94
+ context.push(a: 2, b: 5)
119
95
  end
120
- expect(result).to eq('yay')
96
+ t.join
97
+
98
+ expect(context.lookup(:a)).to eq(1)
99
+ expect{ context.lookup(:b) }.to raise_error(Puppet::Context::UndefinedBindingError)
100
+ end
101
+
102
+ it "pops on a different thread do not interfere" do
103
+ context.push(a: 1)
104
+ t = Thread.new do
105
+ context.pop
106
+ end
107
+ t.join
108
+
109
+ # Raises exception if the binding we pushed has already been popped
110
+ context.pop
111
+ end
112
+
113
+ it "a mark in one thread is not seen in another thread" do
114
+ t = Thread.new do
115
+ context.push(b: 2)
116
+ context.mark('point b')
117
+ end
118
+ t.join
119
+
120
+ expect { context.rollback('point b') }.to raise_error(Puppet::Context::UnknownRollbackMarkError)
121
+ end
122
+ end
123
+ end
124
+
125
+
126
+ describe Puppet::Context::EmptyStack do
127
+ let(:empty_stack) { Puppet::Context::EmptyStack.new }
128
+
129
+ it "raises undefined binding on lookup" do
130
+ expect { empty_stack.lookup("a") }.to raise_error(Puppet::Context::UndefinedBindingError)
131
+ end
132
+
133
+ it "calls a provided block for a default value when none is found" do
134
+ expect(empty_stack.lookup("a") { "default" }).to eq("default")
135
+ end
136
+
137
+ it "raises an error when trying to pop" do
138
+ expect { empty_stack.pop }.to raise_error(Puppet::Context::StackUnderflow)
139
+ end
140
+
141
+ it "returns a stack when something is pushed" do
142
+ stack = empty_stack.push(a: 1)
143
+ expect(stack).to be_a(Puppet::Context::Stack)
144
+ end
145
+
146
+ it "returns a new stack with no bindings when pushed nil" do
147
+ stack = empty_stack.push(nil)
148
+ expect(stack).not_to be(empty_stack)
149
+ expect(stack.pop).to be(empty_stack)
150
+ end
151
+ end
152
+
153
+ describe Puppet::Context::Stack do
154
+ let(:empty_stack) { Puppet::Context::EmptyStack.new }
155
+
156
+ context "a stack with depth of 1" do
157
+ let(:stack) { empty_stack.push(a: 1) }
158
+
159
+ it "returns the empty stack when popped" do
160
+ expect(stack.pop).to be(empty_stack)
161
+ end
162
+
163
+ it "calls a provided block for a default value when none is found" do
164
+ expect(stack.lookup("a") { "default" }).to eq("default")
165
+ end
166
+
167
+ it "returns a new but equivalent stack when pushed nil" do
168
+ stackier = stack.push(nil)
169
+ expect(stackier).not_to be(stack)
170
+ expect(stackier.pop).to be(stack)
171
+ expect(stackier.bindings).to eq(stack.bindings)
172
+ end
173
+ end
174
+
175
+ context "a stack with more than 1 element" do
176
+ let(:level_one) { empty_stack.push(a: 1, c: 4) }
177
+ let(:level_two) { level_one.push(b: 2, c: 3) }
178
+
179
+ it "falls back to lower levels on lookup" do
180
+ expect(level_two.lookup(:c)).to eq(3)
181
+ expect(level_two.lookup(:a)).to eq(1)
182
+ expect{ level_two.lookup(:d) }.to raise_error(Puppet::Context::UndefinedBindingError)
183
+ end
184
+
185
+ it "the parent is immutable" do
186
+ expect(level_one.lookup(:c)).to eq(4)
187
+ expect{ level_one.lookup(:b) }.to raise_error(Puppet::Context::UndefinedBindingError)
188
+ end
189
+ end
190
+
191
+ context 'supports lazy entries' do
192
+ it 'by evaluating a bound proc' do
193
+ stack = empty_stack.push(a: lambda { || 'yay' })
194
+ expect(stack.lookup(:a)).to eq('yay')
121
195
  end
122
196
 
123
197
  it 'by memoizing the bound value' do
124
- result1 = nil
125
- result2 = nil
126
198
  original = 'yay'
127
- context.override(:a => lambda {|| tmp = original; original = 'no'; tmp}) do
128
- result1 = context.lookup(:a)
129
- result2 = context.lookup(:a)
130
- end
131
- expect(result1).to eq('yay')
199
+ stack = empty_stack.push(:a => lambda {|| tmp = original; original = 'no'; tmp})
200
+ expect(stack.lookup(:a)).to eq('yay')
201
+ expect(original).to eq('no')
202
+ expect(stack.lookup(:a)).to eq('yay')
203
+ end
204
+
205
+ it 'the bound value is memoized only at the top level of the stack' do
206
+ # I'm just characterizing the current behavior here
207
+
208
+ original = 'yay'
209
+ stack = empty_stack.push(:a => lambda {|| tmp = original; original = 'no'; tmp})
210
+ stack_two = stack.push({})
211
+ expect(stack.lookup(:a)).to eq('yay')
132
212
  expect(original).to eq('no')
133
- expect(result2).to eq('yay')
213
+ expect(stack.lookup(:a)).to eq('yay')
214
+ expect(stack_two.lookup(:a)).to eq('no')
134
215
  end
135
216
  end
136
217
  end