puppet 6.0.9 → 6.0.10

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -16
  3. data/lib/hiera/scope.rb +7 -0
  4. data/lib/puppet.rb +1 -1
  5. data/lib/puppet/application/device.rb +13 -3
  6. data/lib/puppet/application/ssl.rb +2 -0
  7. data/lib/puppet/configurer.rb +1 -1
  8. data/lib/puppet/network/http/connection.rb +2 -0
  9. data/lib/puppet/network/http/factory.rb +5 -0
  10. data/lib/puppet/pops/types/types.rb +5 -3
  11. data/lib/puppet/provider.rb +1 -2
  12. data/lib/puppet/provider/package.rb +2 -0
  13. data/lib/puppet/provider/package/dpkg.rb +15 -2
  14. data/lib/puppet/provider/package/gem.rb +65 -29
  15. data/lib/puppet/provider/package/pip.rb +135 -111
  16. data/lib/puppet/provider/package/pip3.rb +1 -1
  17. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  18. data/lib/puppet/provider/package/rpm.rb +27 -16
  19. data/lib/puppet/provider/package/yum.rb +2 -1
  20. data/lib/puppet/provider/package_targetable.rb +68 -0
  21. data/lib/puppet/provider/service/upstart.rb +5 -3
  22. data/lib/puppet/provider/user/useradd.rb +16 -13
  23. data/lib/puppet/settings/server_list_setting.rb +9 -0
  24. data/lib/puppet/ssl/host.rb +0 -11
  25. data/lib/puppet/ssl/validator/default_validator.rb +31 -0
  26. data/lib/puppet/type/package.rb +46 -9
  27. data/lib/puppet/util/pidlock.rb +3 -2
  28. data/lib/puppet/util/windows/process.rb +8 -8
  29. data/lib/puppet/util/windows/registry.rb +7 -1
  30. data/lib/puppet/util/windows/user.rb +14 -4
  31. data/lib/puppet/version.rb +1 -1
  32. data/locales/puppet.pot +83 -79
  33. data/man/man5/puppet.conf.5 +2 -2
  34. data/man/man8/puppet-agent.8 +1 -1
  35. data/man/man8/puppet-apply.8 +1 -1
  36. data/man/man8/puppet-catalog.8 +1 -1
  37. data/man/man8/puppet-config.8 +1 -1
  38. data/man/man8/puppet-describe.8 +1 -1
  39. data/man/man8/puppet-device.8 +1 -1
  40. data/man/man8/puppet-doc.8 +1 -1
  41. data/man/man8/puppet-epp.8 +1 -1
  42. data/man/man8/puppet-facts.8 +1 -1
  43. data/man/man8/puppet-filebucket.8 +1 -1
  44. data/man/man8/puppet-generate.8 +1 -1
  45. data/man/man8/puppet-help.8 +1 -1
  46. data/man/man8/puppet-key.8 +1 -1
  47. data/man/man8/puppet-lookup.8 +1 -1
  48. data/man/man8/puppet-man.8 +1 -1
  49. data/man/man8/puppet-module.8 +1 -1
  50. data/man/man8/puppet-node.8 +1 -1
  51. data/man/man8/puppet-parser.8 +1 -1
  52. data/man/man8/puppet-plugin.8 +1 -1
  53. data/man/man8/puppet-report.8 +1 -1
  54. data/man/man8/puppet-resource.8 +1 -1
  55. data/man/man8/puppet-script.8 +1 -1
  56. data/man/man8/puppet-ssl.8 +1 -1
  57. data/man/man8/puppet-status.8 +1 -1
  58. data/man/man8/puppet.8 +2 -2
  59. data/spec/integration/network/http_pool_spec.rb +120 -0
  60. data/spec/integration/type/package_spec.rb +1 -1
  61. data/spec/integration/util/windows/registry_spec.rb +52 -0
  62. data/spec/integration/util/windows/user_spec.rb +19 -0
  63. data/spec/lib/puppet_spec/https.rb +166 -0
  64. data/spec/unit/application/ssl_spec.rb +5 -0
  65. data/spec/unit/configurer_spec.rb +1 -1
  66. data/spec/unit/functions/new_spec.rb +15 -0
  67. data/spec/unit/hiera/scope_spec.rb +7 -0
  68. data/spec/unit/indirector/resource/ral_spec.rb +1 -0
  69. data/spec/unit/network/http/connection_spec.rb +0 -96
  70. data/spec/unit/network/http/factory_spec.rb +6 -0
  71. data/spec/unit/provider/package/dpkg_spec.rb +18 -1
  72. data/spec/unit/provider/package/gem_spec.rb +101 -48
  73. data/spec/unit/provider/package/pip3_spec.rb +17 -0
  74. data/spec/unit/provider/package/pip_spec.rb +57 -67
  75. data/spec/unit/provider/package/puppet_gem_spec.rb +22 -6
  76. data/spec/unit/provider/package/rpm_spec.rb +116 -27
  77. data/spec/unit/provider/service/upstart_spec.rb +3 -22
  78. data/spec/unit/settings/server_list_setting_spec.rb +21 -0
  79. data/spec/unit/ssl/validator_spec.rb +2 -0
  80. data/spec/unit/util/pidlock_spec.rb +26 -0
  81. metadata +9 -5
  82. data/lib/puppet/rest/client.rb +0 -83
  83. data/spec/unit/rest/client_spec.rb +0 -166
@@ -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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "July 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\.0\.9 Ruby/2\.4\.1\-p111 (x86_64\-linux)
879
+ \fIDefault\fR: Puppet/6\.0\.10 Ruby/2\.4\.1\-p111 (x86_64\-linux)
880
880
  .
881
881
  .IP "" 0
882
882
  .
@@ -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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "July 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 "PUPPET\-LOOKUP" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-lookup\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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "July 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" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "July 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\.0\.9
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\.0\.10
@@ -0,0 +1,120 @@
1
+ require 'spec_helper'
2
+ require 'puppet_spec/https'
3
+ require 'puppet_spec/files'
4
+ require 'puppet/network/http_pool'
5
+
6
+ describe Puppet::Network::HttpPool do
7
+ include PuppetSpec::Files
8
+
9
+ before :all do
10
+ WebMock.disable!
11
+ end
12
+
13
+ after :all do
14
+ WebMock.enable!
15
+ end
16
+
17
+ before :each do
18
+ # make sure we don't take too long
19
+ Puppet[:http_connect_timeout] = '5s'
20
+ end
21
+
22
+ let(:hostname) { '127.0.0.1' }
23
+ let(:wrong_hostname) { 'localhost' }
24
+ let(:server) { PuppetSpec::HTTPSServer.new }
25
+
26
+ context "when calling deprecated HttpPool methods" do
27
+ let(:ssl_host) {
28
+ # use server's cert/key as the client cert/key
29
+ host = Puppet::SSL::Host.new
30
+ host.key = Puppet::SSL::Key.from_instance(server.server_key, host.name)
31
+ host.certificate = Puppet::SSL::Certificate.from_instance(server.server_cert, host.name)
32
+ host
33
+ }
34
+
35
+ before(:each) do
36
+ ssldir = tmpdir('http_pool')
37
+ Puppet[:ssldir] = ssldir
38
+ Puppet.settings.use(:main, :ssl)
39
+
40
+ File.write(Puppet[:localcacert], server.ca_cert.to_pem)
41
+ File.write(Puppet[:hostcrl], server.ca_crl.to_pem)
42
+ File.write(Puppet[:hostcert], server.server_cert.to_pem)
43
+ File.write(Puppet[:hostprivkey], server.server_key.to_pem)
44
+ end
45
+
46
+ # Can't use `around(:each)` because it will cause ssl_host to be
47
+ # created outside of any rspec example, and $confdir won't be set
48
+ before(:each) do
49
+ Puppet.push_context(ssl_host: ssl_host)
50
+ end
51
+
52
+ after (:each) do
53
+ Puppet.pop_context
54
+ end
55
+
56
+ def connection(host, port)
57
+ Puppet::Network::HttpPool.http_instance(host, port, use_ssl: true)
58
+ end
59
+
60
+ shared_examples_for 'HTTPS client' do
61
+ it "connects over SSL" do
62
+ server.start_server do |port|
63
+ http = connection(hostname, port)
64
+ res = http.get('/')
65
+ expect(res.code).to eq('200')
66
+ end
67
+ end
68
+
69
+ it "raises if the server's cert doesn't match the hostname we connected to" do
70
+ server.start_server do |port|
71
+ http = connection(wrong_hostname, port)
72
+ expect {
73
+ http.get('/')
74
+ }.to raise_error { |err|
75
+ expect(err).to be_instance_of(Puppet::Error)
76
+ expect(err.message).to match(/\AServer hostname '#{wrong_hostname}' did not match server certificate; expected one of (.+)/)
77
+
78
+ md = err.message.match(/expected one of (.+)/)
79
+ expect(md[1].split(', ')).to contain_exactly('127.0.0.1', 'DNS:127.0.0.1', 'DNS:127.0.0.2')
80
+ }
81
+ end
82
+ end
83
+
84
+ it "raises if the server's CA is unknown" do
85
+ # File must exist and by not empty so DefaultValidator doesn't
86
+ # downgrade to VERIFY_NONE, so use a different CA that didn't
87
+ # issue the server's cert
88
+ capath = tmpfile('empty')
89
+ File.write(capath, PuppetSpec::HTTPSServer::UNKNOWN_CA)
90
+ Puppet[:localcacert] = capath
91
+ Puppet[:certificate_revocation] = false
92
+
93
+ server.start_server do |port|
94
+ http = connection(hostname, port)
95
+ expect {
96
+ http.get('/')
97
+ }.to raise_error(Puppet::Error,
98
+ %r{certificate verify failed.* .self signed certificate in certificate chain for /CN=Test CA.})
99
+ end
100
+ end
101
+ end
102
+
103
+
104
+ context "when using single use HTTPS connections" do
105
+ include_examples 'HTTPS client'
106
+ end
107
+
108
+ context "when using persistent HTTPS connections" do
109
+ around :each do |example|
110
+ pool = Puppet::Network::HTTP::Pool.new
111
+ Puppet.override(:http_pool => pool) do
112
+ example.run
113
+ end
114
+ pool.close
115
+ end
116
+
117
+ include_examples 'HTTPS client'
118
+ end
119
+ end
120
+ end
@@ -100,7 +100,7 @@ describe Puppet::Type.type(:package), "when packages with the same name are sour
100
100
  provider_name = Puppet::Type.type(:package).defaultprovider.name
101
101
  expect {
102
102
  @catalog.add_resource(@alt_package)
103
- }.to raise_error ArgumentError, "Cannot alias Package[gem-yay] to [\"yay\", :#{provider_name}]; resource [\"Package\", \"yay\", :#{provider_name}] already declared"
103
+ }.to raise_error ArgumentError, "Cannot alias Package[gem-yay] to [nil, \"yay\", :#{provider_name}]; resource [\"Package\", nil, \"yay\", :#{provider_name}] already declared"
104
104
  end
105
105
  end
106
106
 
@@ -242,6 +242,58 @@ describe Puppet::Util::Windows::Registry do
242
242
  end
243
243
  end
244
244
  end
245
+
246
+ context 'whean reading null byte' do
247
+ let(:hklm) { Win32::Registry::HKEY_LOCAL_MACHINE }
248
+ let(:puppet_key) { 'SOFTWARE\\Puppet Labs' }
249
+ let(:subkey_name) { "PuppetRegistryTest#{SecureRandom.uuid}" }
250
+ let(:value_name) { SecureRandom.uuid }
251
+
252
+ after(:each) do
253
+ hklm.open(puppet_key, Win32::Registry::KEY_ALL_ACCESS) do |reg|
254
+ subject.delete_key(reg, subkey_name)
255
+ end
256
+ end
257
+
258
+ [
259
+ {
260
+ name: 'REG_SZ',
261
+ type: Win32::Registry::REG_SZ,
262
+ value: "reg sz\u0000 string",
263
+ expected_value: "reg sz string"
264
+ },
265
+ {
266
+ name: 'REG_SZ_2',
267
+ type: Win32::Registry::REG_SZ,
268
+ value: "reg sz\x00 string",
269
+ expected_value: "reg sz string"
270
+ },
271
+ {
272
+ name: 'REG_EXPAND_SZ',
273
+ type: Win32::Registry::REG_EXPAND_SZ,
274
+ value: "\0reg expand string",
275
+ expected_value: " reg expand string"
276
+ }
277
+ ].each do |pair|
278
+ it 'replaces null bytes with spaces' do
279
+ hklm.create("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_ALL_ACCESS) do |reg|
280
+ reg.write(value_name, pair[:type], pair[:value])
281
+ end
282
+
283
+ hklm.open("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_READ) do |reg|
284
+ vals = subject.values(reg)
285
+
286
+ expect(vals).to have_key(value_name)
287
+ subject.each_value(reg) do |_subkey, type, _data|
288
+ expect(type).to eq(pair[:type])
289
+ end
290
+
291
+ written = vals[value_name]
292
+ expect(written).to eq(pair[:expected_value])
293
+ end
294
+ end
295
+ end
296
+ end
245
297
  end
246
298
 
247
299
  context "#values_by_name" do