puppet 3.3.1.rc3 → 3.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0efbe0e0e21b0391a01f1f2faab2d1b0226a26e7
4
- data.tar.gz: 3ec5f8c802c8be9915e9442e3f4c2ee9d0b512ec
3
+ metadata.gz: ee9d3b6d97827d31437f89eddf9f9ebe7bdba1c8
4
+ data.tar.gz: aa84cc4a207e01010674f784720f9dba747dd7d6
5
5
  SHA512:
6
- metadata.gz: 343e12a8a203d0c1eca34bc7f850d3e456717e09961b0fb62d5a826f635c911f4578619f3c4f4c8d201378cb0f0080526a341af514b61b51ea4ea9d779358c98
7
- data.tar.gz: 51b63bad22e5ab099b2233fbef0b88e10f609432d74de59b2def5de71e6e8c9ad7a30b75f15bc89116b3ece9fed520eb0483a951dbe6f604338a70f7658e0f72
6
+ metadata.gz: d43b4ec3e3857c62ce765f57d12508ff11a4a9728f06449d4abb231b80fa7c142e36f913e7ddf439956212388e459d083e23f2ea68c7e82bfe600c1aa1b30a7e
7
+ data.tar.gz: 8e12c44a4422f68e9c06b814d88f29c199668d40db3f8a9e366a5de1142a908e27699d01159847fa7dde52b3abe8879b18c2aad0a0b9c188701476db2ab32dd5
@@ -3,18 +3,28 @@ require 'puppet/network/format_handler'
3
3
  Puppet::Network::FormatHandler.create_serialized_formats(:yaml) do
4
4
  def intern(klass, text)
5
5
  data = YAML.load(text, :safe => true, :deserialize_symbols => true)
6
- return data if data.is_a?(klass)
7
- klass.from_pson(data)
6
+ data_to_instance(klass, data)
8
7
  end
9
8
 
10
9
  def intern_multiple(klass, text)
11
- YAML.load(text, :safe => true, :deserialize_symbols => true).collect do |data|
12
- if data.is_a?(klass)
13
- data
14
- else
15
- klass.from_pson(data)
16
- end
10
+ data = YAML.load(text, :safe => true, :deserialize_symbols => true)
11
+ unless data.respond_to?(:collect)
12
+ raise Puppet::Network::FormatHandler::FormatError, "Serialized YAML did not contain a collection of instances when calling intern_multiple"
13
+ end
14
+
15
+ data.collect do |datum|
16
+ data_to_instance(klass, datum)
17
+ end
18
+ end
19
+
20
+ def data_to_instance(klass, data)
21
+ return data if data.is_a?(klass)
22
+
23
+ unless data.is_a? Hash
24
+ raise Puppet::Network::FormatHandler::FormatError, "Serialized YAML did not contain a valid instance of #{klass}"
17
25
  end
26
+
27
+ klass.from_pson(data)
18
28
  end
19
29
 
20
30
  def render(instance)
@@ -255,7 +255,6 @@ module Puppet::Network::HTTP::Handler
255
255
 
256
256
  def read_body_into_model(model_class, request)
257
257
  data = body(request).to_s
258
- raise ArgumentError, "No data to save" if !data or data.empty?
259
258
 
260
259
  format = request_format(request)
261
260
  model_class.convert_from(format, data)
@@ -7,11 +7,11 @@ Puppet::Parser::Functions::newfunction(:create_resources, :arity => -3, :doc =>
7
7
  # A hash of user resources:
8
8
  $myusers = {
9
9
  'nick' => { uid => '1330',
10
- group => allstaff,
11
- groups => ['developers', 'operations', 'release'], }
10
+ gid => allstaff,
11
+ groups => ['developers', 'operations', 'release'], },
12
12
  'dan' => { uid => '1308',
13
- group => allstaff,
14
- groups => ['developers', 'prosvc', 'release'], }
13
+ gid => allstaff,
14
+ groups => ['developers', 'prosvc', 'release'], },
15
15
  }
16
16
 
17
17
  create_resources(user, $myusers)
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.3.1-rc3'
10
+ PUPPETVERSION = '3.3.1'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -1004,8 +1004,8 @@ describe Puppet::Type.type(:file) do
1004
1004
  catalog.add_resource file
1005
1005
  catalog.apply
1006
1006
 
1007
- get_owner(path).should == 'S-1-5-32-544'
1008
- get_group(path).should == 'S-1-0-0'
1007
+ get_owner(path).should =~ /^S\-1\-5\-.*$/
1008
+ get_group(path).should =~ /^S\-1\-0\-0.*$/
1009
1009
  get_mode(path).should == 0644
1010
1010
  end
1011
1011
  end
@@ -4,6 +4,8 @@ require 'puppet/indirector'
4
4
  require 'puppet/indirector/errors'
5
5
  require 'puppet/indirector/rest'
6
6
 
7
+ HTTP_ERROR_CODES = [300, 400, 500]
8
+
7
9
  # Just one from each category since the code makes no real distinctions
8
10
  shared_examples_for "a REST terminus method" do |terminus_method|
9
11
  describe "when talking to an older master" do
@@ -26,7 +28,6 @@ shared_examples_for "a REST terminus method" do |terminus_method|
26
28
  end
27
29
  end
28
30
 
29
- HTTP_ERROR_CODES = [300, 400, 500]
30
31
  HTTP_ERROR_CODES.each do |code|
31
32
  describe "when the response code is #{code}" do
32
33
  let(:response) { mock_response(code, 'error messaged!!!') }
@@ -63,27 +63,31 @@ describe "Puppet Network Format" do
63
63
  @yaml.intern(String, YAML.dump(:foo)).should == "foo"
64
64
  end
65
65
 
66
- it "should fail when type does not match deserialized form and has no from_pson" do
67
- expect do
68
- @yaml.intern(Hash, YAML.dump("foo"))
69
- end.to raise_error(NoMethodError)
70
- end
71
-
72
66
  it "should load from yaml when deserializing an array" do
73
67
  text = YAML.dump(["foo"])
74
68
  @yaml.intern_multiple(String, text).should == ["foo"]
75
69
  end
76
70
 
77
- it "should fail when one element does not have a from_pson" do
71
+ it "fails intelligibly instead of calling to_pson with something other than a hash" do
72
+ expect do
73
+ @yaml.intern(Puppet::Node, '')
74
+ end.to raise_error(Puppet::Network::FormatHandler::FormatError, /did not contain a valid instance/)
75
+ end
76
+
77
+ it "fails intelligibly when intern_multiple is called and yaml doesn't decode to an array" do
78
78
  expect do
79
- @yaml.intern_multiple(Hash, YAML.dump(["foo"]))
80
- end.to raise_error(NoMethodError)
79
+ @yaml.intern_multiple(Puppet::Node, '')
80
+ end.to raise_error(Puppet::Network::FormatHandler::FormatError, /did not contain a collection/)
81
+ end
82
+
83
+ it "fails intelligibly instead of calling to_pson with something other than a hash when interning multiple" do
84
+ expect do
85
+ @yaml.intern_multiple(Puppet::Node, YAML.dump(["hello"]))
86
+ end.to raise_error(Puppet::Network::FormatHandler::FormatError, /did not contain a valid instance/)
81
87
  end
82
88
  end
83
89
 
84
90
  describe "base64 compressed yaml", :if => Puppet.features.zlib? do
85
- yaml = Puppet::Network::FormatHandler.format(:b64_zlib_yaml)
86
-
87
91
  before do
88
92
  @yaml = Puppet::Network::FormatHandler.format(:b64_zlib_yaml)
89
93
  end
@@ -294,6 +298,12 @@ describe "Puppet Network Format" do
294
298
  PsonTest.expects(:from_pson).with("baz").returns "BAZ"
295
299
  @pson.intern_multiple(PsonTest, text).should == %w{BAR BAZ}
296
300
  end
301
+
302
+ it "fails intelligibly when given invalid data" do
303
+ expect do
304
+ @pson.intern(Puppet::Node, '')
305
+ end.to raise_error(PSON::ParserError, /source did not contain any PSON/)
306
+ end
297
307
  end
298
308
  end
299
309
 
@@ -17,6 +17,10 @@ describe Puppet::Network::HTTP::Handler do
17
17
  @data = data
18
18
  end
19
19
 
20
+ def self.from_raw(raw)
21
+ new(nil, raw)
22
+ end
23
+
20
24
  def self.from_pson(pson)
21
25
  new(pson["name"], pson["data"])
22
26
  end
@@ -33,7 +37,6 @@ describe Puppet::Network::HTTP::Handler do
33
37
  end
34
38
  end
35
39
 
36
- # The subclass must not be all caps even though the superclass is
37
40
  class Puppet::TestModel::Memory < Puppet::Indirector::Memory
38
41
  end
39
42
 
@@ -443,12 +446,23 @@ describe Puppet::Network::HTTP::Handler do
443
446
  end
444
447
 
445
448
  describe "when saving a model instance" do
446
- it "should fail to save model if data is not specified" do
447
- data = Puppet::TestModel.new("my data", "some data")
449
+ it "allows an empty body when the format supports it" do
450
+ class Puppet::TestModel::Nonvalidatingmemory < Puppet::TestModel::Memory
451
+ def validate_key(_)
452
+ # nothing
453
+ end
454
+ end
455
+
456
+ indirection.terminus_class = :nonvalidatingmemory
457
+
458
+ data = Puppet::TestModel.new("test", '')
448
459
  request = a_request_that_submits(data)
460
+ request[:content_type_header] = "application/x-raw"
449
461
  request[:body] = ''
450
462
 
451
- expect { handler.do_save("my_handler", "my_result", {}, request, response) }.to raise_error(ArgumentError)
463
+ handler.do_save(indirection.name, "test", {}, request, response)
464
+
465
+ Puppet::TestModel.indirection.find("test").data.should == ''
452
466
  end
453
467
 
454
468
  it "saves the data sent in the request" do
@@ -143,7 +143,7 @@ describe Puppet::Node::Environment do
143
143
  it "should use the current working directory to fully-qualify unqualified paths" do
144
144
  FileTest.stubs(:directory?).returns true
145
145
 
146
- two = File.expand_path(File.join(Dir.getwd, "two"))
146
+ two = File.expand_path("two")
147
147
  env.validate_dirs([@path_one, 'two']).should == [@path_one, two]
148
148
  end
149
149
  end
@@ -70,9 +70,8 @@ describe Puppet::Parser::Files do
70
70
  it "should accept relative templatedirs" do
71
71
  FileTest.stubs(:exist?).returns true
72
72
  Puppet[:templatedir] = "my/templates"
73
- # We expand_path to normalize backslashes and slashes on Windows
74
- File.expects(:directory?).with(File.expand_path(File.join(Dir.getwd,"my/templates"))).returns(true)
75
- Puppet::Parser::Files.find_template("mytemplate").should == File.expand_path(File.join(Dir.getwd,"my/templates/mytemplate"))
73
+ File.expects(:directory?).with(File.expand_path("my/templates")).returns(true)
74
+ Puppet::Parser::Files.find_template("mytemplate").should == File.expand_path("my/templates/mytemplate")
76
75
  end
77
76
 
78
77
  it "should use the environment templatedir if no module is found and an environment is specified" do
@@ -170,9 +170,7 @@ describe Puppet::Settings::FileSetting do
170
170
 
171
171
  it "should fully qualified returned files if necessary (#795)" do
172
172
  @settings.stubs(:value).with(:myfile).returns "myfile"
173
- path = File.join(Dir.getwd, "myfile")
174
- # Dir.getwd can return windows paths with backslashes, so we normalize them using expand_path
175
- path = File.expand_path(path) if Puppet.features.microsoft_windows?
173
+ path = File.expand_path('myfile')
176
174
  @file.to_resource.title.should == path
177
175
  end
178
176
 
@@ -59,6 +59,7 @@ describe Puppet::Util do
59
59
 
60
60
  it "should remove any new environment variables after the block ends" do
61
61
  @new_env[:FOO] = "bar"
62
+ ENV["FOO"] = nil
62
63
  Puppet::Util.withenv @new_env do
63
64
  ENV["FOO"].should == "bar"
64
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1.rc3
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -2172,9 +2172,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2172
2172
  version: '0'
2173
2173
  required_rubygems_version: !ruby/object:Gem::Requirement
2174
2174
  requirements:
2175
- - - '>'
2175
+ - - '>='
2176
2176
  - !ruby/object:Gem::Version
2177
- version: 1.3.1
2177
+ version: '0'
2178
2178
  requirements: []
2179
2179
  rubyforge_project: puppet
2180
2180
  rubygems_version: 2.0.3