puppet 2.7.20 → 2.7.21

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 (81) hide show
  1. data/CHANGELOG +226 -0
  2. data/conf/auth.conf +3 -3
  3. data/ext/packaging/README.md +191 -57
  4. data/ext/packaging/spec/spec_helper.rb +2 -2
  5. data/ext/packaging/spec/tasks/00_utils_spec.rb +63 -18
  6. data/ext/packaging/spec/tasks/build_object_spec.rb +171 -0
  7. data/ext/packaging/tasks/00_utils.rake +186 -33
  8. data/ext/packaging/tasks/10_setupvars.rake +94 -65
  9. data/ext/packaging/tasks/20_setupextravars.rake +45 -26
  10. data/ext/packaging/tasks/30_metrics.rake +41 -0
  11. data/ext/packaging/tasks/apple.rake +92 -36
  12. data/ext/packaging/tasks/build.rake +183 -0
  13. data/ext/packaging/tasks/deb.rake +45 -40
  14. data/ext/packaging/tasks/deb_repos.rake +103 -0
  15. data/ext/packaging/tasks/doc.rake +5 -5
  16. data/ext/packaging/tasks/fetch.rake +35 -10
  17. data/ext/packaging/tasks/gem.rake +38 -27
  18. data/ext/packaging/tasks/ips.rake +14 -14
  19. data/ext/packaging/tasks/jenkins.rake +337 -0
  20. data/ext/packaging/tasks/mock.rake +153 -72
  21. data/ext/packaging/tasks/pe_deb.rake +2 -2
  22. data/ext/packaging/tasks/pe_remote.rake +22 -19
  23. data/ext/packaging/tasks/pe_rpm.rake +5 -5
  24. data/ext/packaging/tasks/pe_ship.rake +31 -21
  25. data/ext/packaging/tasks/pe_sign.rake +20 -19
  26. data/ext/packaging/tasks/pe_sles.rake +40 -36
  27. data/ext/packaging/tasks/pe_tar.rake +5 -0
  28. data/ext/packaging/tasks/release.rake +32 -12
  29. data/ext/packaging/tasks/remote_build.rake +141 -83
  30. data/ext/packaging/tasks/retrieve.rake +23 -0
  31. data/ext/packaging/tasks/rpm.rake +11 -19
  32. data/ext/packaging/tasks/rpm_repos.rake +127 -0
  33. data/ext/packaging/tasks/ship.rake +68 -55
  34. data/ext/packaging/tasks/sign.rake +38 -10
  35. data/ext/packaging/tasks/tar.rake +25 -9
  36. data/ext/packaging/tasks/update.rake +2 -2
  37. data/ext/packaging/tasks/version.rake +34 -14
  38. data/ext/packaging/tasks/z_data_dump.rake +33 -0
  39. data/lib/puppet/indirector/catalog/compiler.rb +13 -2
  40. data/lib/puppet/indirector/certificate_status/file.rb +5 -0
  41. data/lib/puppet/indirector/errors.rb +5 -0
  42. data/lib/puppet/indirector/file_bucket_file/file.rb +4 -0
  43. data/lib/puppet/indirector/file_bucket_file/selector.rb +4 -0
  44. data/lib/puppet/indirector/indirection.rb +1 -0
  45. data/lib/puppet/indirector/resource/active_record.rb +3 -0
  46. data/lib/puppet/indirector/resource/ral.rb +4 -0
  47. data/lib/puppet/indirector/resource/store_configs.rb +3 -0
  48. data/lib/puppet/indirector/resource/validator.rb +8 -0
  49. data/lib/puppet/indirector/rest.rb +8 -0
  50. data/lib/puppet/indirector/run/local.rb +4 -0
  51. data/lib/puppet/indirector/terminus.rb +20 -0
  52. data/lib/puppet/network/formats.rb +3 -3
  53. data/lib/puppet/network/handler/master.rb +1 -1
  54. data/lib/puppet/network/handler/report.rb +1 -1
  55. data/lib/puppet/network/http/handler.rb +7 -1
  56. data/lib/puppet/network/http/rack/rest.rb +7 -2
  57. data/lib/puppet/network/http/webrick.rb +1 -0
  58. data/lib/puppet/network/rest_authconfig.rb +1 -1
  59. data/lib/puppet/parser/templatewrapper.rb +17 -17
  60. data/lib/puppet/util/monkey_patches.rb +58 -0
  61. data/lib/puppet/version.rb +1 -1
  62. data/spec/integration/indirector/catalog/compiler_spec.rb +1 -0
  63. data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
  64. data/spec/integration/resource/catalog_spec.rb +1 -0
  65. data/spec/unit/indirector/catalog/compiler_spec.rb +29 -2
  66. data/spec/unit/indirector/indirection_spec.rb +18 -1
  67. data/spec/unit/indirector/terminus_spec.rb +191 -177
  68. data/spec/unit/network/formats_spec.rb +6 -6
  69. data/spec/unit/network/http/handler_spec.rb +25 -0
  70. data/spec/unit/network/http/rack/rest_spec.rb +17 -0
  71. data/spec/unit/network/http/webrick_spec.rb +4 -0
  72. data/spec/unit/network/http_pool_spec.rb +0 -1
  73. data/spec/unit/network/rest_authconfig_spec.rb +16 -1
  74. data/spec/unit/parser/functions/inline_template_spec.rb +13 -0
  75. data/spec/unit/parser/functions/template_spec.rb +15 -0
  76. data/spec/unit/parser/templatewrapper_spec.rb +19 -4
  77. data/spec/unit/ssl/certificate_request_spec.rb +2 -0
  78. data/spec/unit/ssl/host_spec.rb +1 -0
  79. data/spec/unit/util/monkey_patches_spec.rb +12 -0
  80. data/test/language/snippets.rb +1 -1
  81. metadata +13 -2
@@ -55,15 +55,15 @@ describe "Puppet Network Format" do
55
55
  @yaml.render_multiple(instances).should == "foo"
56
56
  end
57
57
 
58
- it "should intern by calling 'YAML.load'" do
58
+ it "should safely load YAML when interning" do
59
59
  text = "foo"
60
- YAML.expects(:load).with("foo").returns "bar"
60
+ YAML.expects(:safely_load).with("foo").returns "bar"
61
61
  @yaml.intern(String, text).should == "bar"
62
62
  end
63
63
 
64
- it "should intern multiples by calling 'YAML.load'" do
64
+ it "should safely load YAML when interning multiples" do
65
65
  text = "foo"
66
- YAML.expects(:load).with("foo").returns "bar"
66
+ YAML.expects(:safely_load).with("foo").returns "bar"
67
67
  @yaml.intern_multiple(String, text).should == "bar"
68
68
  end
69
69
  end
@@ -120,10 +120,10 @@ describe "Puppet Network Format" do
120
120
  @yaml.intern_multiple(String, text).should == "bar"
121
121
  end
122
122
 
123
- it "should decode by base64 decoding, uncompressing and Yaml loading" do
123
+ it "should decode by base64 decoding, uncompressing and safely Yaml loading" do
124
124
  Base64.expects(:decode64).with("zorg").returns "foo"
125
125
  Zlib::Inflate.expects(:inflate).with("foo").returns "baz"
126
- YAML.expects(:load).with("baz").returns "bar"
126
+ YAML.expects(:safely_load).with("baz").returns "bar"
127
127
  @yaml.decode("zorg").should == "bar"
128
128
  end
129
129
 
@@ -125,6 +125,31 @@ describe Puppet::Network::HTTP::Handler do
125
125
  @handler.request_format(@request).should == "s"
126
126
  end
127
127
 
128
+ it "should deserialize YAML parameters" do
129
+ params = {'my_param' => [1,2,3].to_yaml}
130
+
131
+ decoded_params = @handler.send(:decode_params, params)
132
+
133
+ decoded_params.should == {:my_param => [1,2,3]}
134
+ end
135
+
136
+ it "should accept YAML parameters with !ruby/hash tags on Ruby 1.8", :if => RUBY_VERSION =~ /^1\.8/ do
137
+ params = {'my_param' => "--- !ruby/hash:Array {}"}
138
+
139
+ decoded_params = @handler.send(:decode_params, params)
140
+
141
+ decoded_params[:my_param].should be_an(Array)
142
+ end
143
+
144
+ # These are only dangerous with Psych, which is Ruby 1.9-only. Since
145
+ # there's no real way to change the yamler in Puppet, assume that 1.9 means
146
+ # Psych, especially in tests.
147
+ it "should fail if YAML parameters have !ruby/hash tags on Ruby 1.9", :unless => RUBY_VERSION =~ /^1\.8/ do
148
+ params = {'my_param' => "--- !ruby/hash:Array {}"}
149
+
150
+ expect { @handler.send(:decode_params, params) }.to raise_error(ArgumentError, /Illegal YAML mapping found/)
151
+ end
152
+
128
153
  describe "when finding a model instance" do
129
154
  before do
130
155
  @indirection.stubs(:find).returns @result
@@ -91,6 +91,23 @@ describe "Puppet::Network::HTTP::RackREST", :if => Puppet.features.rack? do
91
91
  @handler.set_response(@response, @file, 200)
92
92
  end
93
93
  end
94
+
95
+ it "should ensure the body has been read on success" do
96
+ req = mk_req('/production/report/foo', :method => 'PUT')
97
+ req.body.expects(:read).at_least_once
98
+
99
+ Puppet::Transaction::Report.stubs(:save)
100
+
101
+ @handler.process(req, @response)
102
+ end
103
+
104
+ it "should ensure the body has been partially read on failure" do
105
+ req = mk_req('/production/report/foo')
106
+ req.body.expects(:read).with(1)
107
+ req.stubs(:check_authorization).raises(Exception)
108
+
109
+ @handler.process(req, @response)
110
+ end
94
111
  end
95
112
 
96
113
  describe "and determining the request parameters" do
@@ -313,6 +313,10 @@ describe Puppet::Network::HTTP::WEBrick do
313
313
  @server.setup_ssl[:SSLEnable].should be_true
314
314
  end
315
315
 
316
+ it "should reject SSLv2" do
317
+ @server.setup_ssl[:SSLOptions].should == OpenSSL::SSL::OP_NO_SSLv2
318
+ end
319
+
316
320
  it "should configure the verification method as 'OpenSSL::SSL::VERIFY_PEER'" do
317
321
  @server.setup_ssl[:SSLVerifyClient].should == OpenSSL::SSL::VERIFY_PEER
318
322
  end
@@ -79,7 +79,6 @@ describe Puppet::Network::HttpPool do
79
79
 
80
80
  it { should be_use_ssl }
81
81
  its(:cert) { should be_nil }
82
- its(:cert_store) { should be_nil }
83
82
  its(:ca_file) { should be_nil }
84
83
  its(:key) { should be_nil }
85
84
  its(:verify_mode) { should == OpenSSL::SSL::VERIFY_NONE }
@@ -85,6 +85,9 @@ describe Puppet::Network::RestAuthConfig do
85
85
  end
86
86
 
87
87
  it "should create default ACL entries if no file have been read" do
88
+ # The singleton instance is stored as an instance variable we don't have
89
+ # access to, so.. instance_variable_set. Alas.
90
+ Puppet::Network::RestAuthConfig.instance_variable_set(:@main, nil)
88
91
  Puppet::Network::RestAuthConfig.any_instance.stubs(:exists?).returns(false)
89
92
 
90
93
  Puppet::Network::RestAuthConfig.any_instance.expects(:insert_default_acl)
@@ -122,6 +125,18 @@ describe Puppet::Network::RestAuthConfig do
122
125
  @authconfig.insert_default_acl
123
126
  end
124
127
 
125
- end
128
+ it '(CVE-2013-2275) allows report submission only for the node matching the certname by default' do
129
+ acl = {
130
+ :acl => "~ ^\/report\/([^\/]+)$",
131
+ :method => :save,
132
+ :allow => '$1',
133
+ :authenticated => true
134
+ }
135
+ @authconfig.rights.stubs(:[]).returns(true)
136
+ @authconfig.rights.stubs(:[]).with(acl[:acl]).returns(nil)
126
137
 
138
+ @authconfig.expects(:mk_acl).with(acl)
139
+ @authconfig.insert_default_acl
140
+ end
141
+ end
127
142
  end
@@ -58,4 +58,17 @@ describe "the inline_template function", :'fails_on_ruby_1.9.2' => true do
58
58
  lambda { @scope.function_inline_template("1") }.should raise_error(Puppet::ParseError)
59
59
  end
60
60
 
61
+ it "is not interfered with by a variable called 'string' (#14093)" do
62
+ @scope.setvar("string", "this is a variable")
63
+ inline_template("this is a template").should == "this is a template"
64
+ end
65
+
66
+ it "has access to a variable called 'string' (#14093)" do
67
+ @scope.setvar('string', "this is a variable")
68
+ inline_template("string was: <%= @string %>").should == "string was: this is a variable"
69
+ end
70
+
71
+ def inline_template(*templates)
72
+ @scope.function_inline_template(templates)
73
+ end
61
74
  end
@@ -58,6 +58,16 @@ describe "the template function", :'fails_on_ruby_1.9.2' => true do
58
58
  @scope.function_template(["1","2"]).should == "result1result2"
59
59
  end
60
60
 
61
+ it "is not interfered with by having a variable named 'string' (#14093)" do
62
+ @scope.setvar('string', "this output should not be seen")
63
+ eval_template("some text that is static").should == "some text that is static"
64
+ end
65
+
66
+ it "has access to a variable named 'string' (#14093)" do
67
+ @scope.setvar('string', "the string value")
68
+ eval_template("string was: <%= @string %>").should == "string was: the string value"
69
+ end
70
+
61
71
  it "should raise an error if the template raises an error" do
62
72
  tw = stub_everything 'template_wrapper'
63
73
  Puppet::Parser::TemplateWrapper.stubs(:new).returns(tw)
@@ -66,4 +76,9 @@ describe "the template function", :'fails_on_ruby_1.9.2' => true do
66
76
  lambda { @scope.function_template("1") }.should raise_error(Puppet::ParseError)
67
77
  end
68
78
 
79
+ def eval_template(content)
80
+ File.stubs(:read).with("template").returns(content)
81
+ Puppet::Parser::Files.stubs(:find_template).returns("template")
82
+ @scope.function_template(['template'])
83
+ end
69
84
  end
@@ -30,16 +30,14 @@ describe Puppet::Parser::TemplateWrapper do
30
30
 
31
31
  it "should check template file existance and read its content" do
32
32
  Puppet::Parser::Files.expects(:find_template).with("fake_template", @scope.environment.to_s).returns("/tmp/fake_template")
33
- File.expects(:read).with("/tmp/fake_template").returns("template content")
34
33
 
35
34
  @tw.file = @file
36
35
  end
37
36
 
38
37
  it "should mark the file for watching" do
39
- Puppet::Parser::Files.expects(:find_template).returns("/tmp/fake_template")
40
- File.stubs(:read)
38
+ full_file_name = given_a_template_file("fake_template", "content")
41
39
 
42
- @known_resource_types.expects(:watch_file).with("/tmp/fake_template")
40
+ @known_resource_types.expects(:watch_file).with(full_file_name)
43
41
  @tw.file = @file
44
42
  end
45
43
 
@@ -66,6 +64,13 @@ describe Puppet::Parser::TemplateWrapper do
66
64
  @tw.result.should eql("woot!")
67
65
  end
68
66
 
67
+ it "provides access to the name of the template via #file" do
68
+ full_file_name = given_a_template_file("fake_template", "<%= file %>")
69
+
70
+ @tw.file = "fake_template"
71
+ @tw.result.should == full_file_name
72
+ end
73
+
69
74
  it "should return the processed template contents with a call to result and a string" do
70
75
  mock_template
71
76
  @tw.result("template contents").should eql("woot!")
@@ -139,4 +144,14 @@ describe Puppet::Parser::TemplateWrapper do
139
144
  @tw.instance_variable_get("@one_").should == "foo"
140
145
  end
141
146
  end
147
+
148
+ def given_a_template_file(name, contents)
149
+ full_name = "/full/path/to/#{name}"
150
+ Puppet::Parser::Files.stubs(:find_template).
151
+ with(name, anything()).
152
+ returns(full_name)
153
+ File.stubs(:read).with(full_name).returns(contents)
154
+
155
+ full_name
156
+ end
142
157
  end
@@ -254,6 +254,7 @@ describe Puppet::SSL::CertificateRequest do
254
254
 
255
255
  csr = Puppet::SSL::CertificateRequest.new("me")
256
256
  terminus = mock 'terminus'
257
+ terminus.stubs(:validate)
257
258
  Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
258
259
  terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" }
259
260
 
@@ -267,6 +268,7 @@ describe Puppet::SSL::CertificateRequest do
267
268
 
268
269
  csr = Puppet::SSL::CertificateRequest.new("me")
269
270
  terminus = mock 'terminus'
271
+ terminus.stubs(:validate)
270
272
  Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
271
273
  terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" }
272
274
 
@@ -495,6 +495,7 @@ describe Puppet::SSL::Host do
495
495
  @request.stubs(:generate)
496
496
  @request.stubs(:name).returns("myname")
497
497
  terminus = stub 'terminus'
498
+ terminus.stubs(:validate)
498
499
  Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
499
500
  terminus.expects(:save).with { |req| req.instance == @request && req.key == "myname" }.raises "eh"
500
501
 
@@ -179,3 +179,15 @@ describe Range do
179
179
  end
180
180
  end
181
181
  end
182
+
183
+ describe OpenSSL::SSL::SSLContext do
184
+ it 'disables SSLv2 via the SSLContext#options bitmask' do
185
+ (subject.options & OpenSSL::SSL::OP_NO_SSLv2).should == OpenSSL::SSL::OP_NO_SSLv2
186
+ end
187
+ it 'has no ciphers with version SSLv2 enabled' do
188
+ ciphers = subject.ciphers.select do |name, version, bits, alg_bits|
189
+ /SSLv2/.match(version)
190
+ end
191
+ ciphers.should be_empty
192
+ end
193
+ end
@@ -494,7 +494,7 @@ class TestSnippets < Test::Unit::TestCase
494
494
 
495
495
  catalog = nil
496
496
  assert_nothing_raised("Could not compile catalog") {
497
- catalog = Puppet::Resource::Catalog.indirection.find(node)
497
+ catalog = Puppet::Resource::Catalog.indirection.find(node.name)
498
498
  }
499
499
 
500
500
  assert_nothing_raised("Could not convert catalog") {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.20
4
+ version: 2.7.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-20 00:00:00.000000000 Z
12
+ date: 2013-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter
@@ -217,6 +217,7 @@ files:
217
217
  - lib/puppet/indirector/couch.rb
218
218
  - lib/puppet/indirector/direct_file_server.rb
219
219
  - lib/puppet/indirector/envelope.rb
220
+ - lib/puppet/indirector/errors.rb
220
221
  - lib/puppet/indirector/exec.rb
221
222
  - lib/puppet/indirector/face.rb
222
223
  - lib/puppet/indirector/facts/active_record.rb
@@ -277,6 +278,7 @@ files:
277
278
  - lib/puppet/indirector/resource/ral.rb
278
279
  - lib/puppet/indirector/resource/rest.rb
279
280
  - lib/puppet/indirector/resource/store_configs.rb
281
+ - lib/puppet/indirector/resource/validator.rb
280
282
  - lib/puppet/indirector/resource_type/parser.rb
281
283
  - lib/puppet/indirector/resource_type/rest.rb
282
284
  - lib/puppet/indirector/resource_type.rb
@@ -997,16 +999,21 @@ files:
997
999
  - ext/packaging/README.md
998
1000
  - ext/packaging/spec/spec_helper.rb
999
1001
  - ext/packaging/spec/tasks/00_utils_spec.rb
1002
+ - ext/packaging/spec/tasks/build_object_spec.rb
1000
1003
  - ext/packaging/tasks/00_utils.rake
1001
1004
  - ext/packaging/tasks/10_setupvars.rake
1002
1005
  - ext/packaging/tasks/20_setupextravars.rake
1006
+ - ext/packaging/tasks/30_metrics.rake
1003
1007
  - ext/packaging/tasks/apple.rake
1008
+ - ext/packaging/tasks/build.rake
1004
1009
  - ext/packaging/tasks/clean.rake
1005
1010
  - ext/packaging/tasks/deb.rake
1011
+ - ext/packaging/tasks/deb_repos.rake
1006
1012
  - ext/packaging/tasks/doc.rake
1007
1013
  - ext/packaging/tasks/fetch.rake
1008
1014
  - ext/packaging/tasks/gem.rake
1009
1015
  - ext/packaging/tasks/ips.rake
1016
+ - ext/packaging/tasks/jenkins.rake
1010
1017
  - ext/packaging/tasks/mock.rake
1011
1018
  - ext/packaging/tasks/pe_deb.rake
1012
1019
  - ext/packaging/tasks/pe_remote.rake
@@ -1014,9 +1021,12 @@ files:
1014
1021
  - ext/packaging/tasks/pe_ship.rake
1015
1022
  - ext/packaging/tasks/pe_sign.rake
1016
1023
  - ext/packaging/tasks/pe_sles.rake
1024
+ - ext/packaging/tasks/pe_tar.rake
1017
1025
  - ext/packaging/tasks/release.rake
1018
1026
  - ext/packaging/tasks/remote_build.rake
1027
+ - ext/packaging/tasks/retrieve.rake
1019
1028
  - ext/packaging/tasks/rpm.rake
1029
+ - ext/packaging/tasks/rpm_repos.rake
1020
1030
  - ext/packaging/tasks/ship.rake
1021
1031
  - ext/packaging/tasks/sign.rake
1022
1032
  - ext/packaging/tasks/tag.rake
@@ -1024,6 +1034,7 @@ files:
1024
1034
  - ext/packaging/tasks/template.rake
1025
1035
  - ext/packaging/tasks/update.rake
1026
1036
  - ext/packaging/tasks/version.rake
1037
+ - ext/packaging/tasks/z_data_dump.rake
1027
1038
  - ext/project_data.yaml
1028
1039
  - ext/puppet-load.rb
1029
1040
  - ext/puppet-test