[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:35:00 UTC 2010


The following commit has been merged in the upstream branch:
commit dc1a977512b854c967bfcb1d115d88c6f778e56e
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Tue May 25 15:13:28 2010 -0700

    [#3766] Remove YAML fixups
    
    Remove workarounds that were only needed because ruby's builtin YAML
    lib is broken.

diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb
index 92f778c..eec632d 100644
--- a/lib/puppet/network/formats.rb
+++ b/lib/puppet/network/formats.rb
@@ -12,30 +12,17 @@ Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do
     end
 
     def render(instance)
-        yaml = instance.to_yaml
-
-        yaml = fixup(yaml) unless yaml.nil?
-        yaml
+        instance.to_yaml
     end
 
     # Yaml monkey-patches Array, so this works.
     def render_multiple(instances)
-        yaml = instances.to_yaml
-
-        yaml = fixup(yaml) unless yaml.nil?
-        yaml
+        instances.to_yaml
     end
 
-    # Everything's supported unless you're on 1.8.1
+    # Unlike core's yaml, ZAML should support 1.8.1 just fine
     def supported?(klass)
-        RUBY_VERSION != '1.8.1'
-    end
-
-    # fixup invalid yaml as per:
-    # http://redmine.ruby-lang.org/issues/show/1331
-    def fixup(yaml)
-        yaml.gsub!(/((?:&id\d+\s+)?!ruby\/object:.*?)\s*\?/) { "? #{$1}" }
-        yaml
+        true
     end
 end
 
@@ -66,29 +53,15 @@ Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_ya
     end
 
     def render(instance)
-        yaml = instance.to_yaml
-
-        yaml = encode(fixup(yaml)) unless yaml.nil?
-        yaml
+        encode(instance.to_yaml)
     end
 
     def render_multiple(instances)
-        yaml = instances.to_yaml
-
-        yaml = encode(fixup(yaml)) unless yaml.nil?
-        yaml
+        encode(instances.to_yaml)
     end
 
-    # Because of yaml issue in ruby 1.8.1...
     def supported?(klass)
-        RUBY_VERSION != '1.8.1' and use_zlib?
-    end
-
-    # fixup invalid yaml as per:
-    # http://redmine.ruby-lang.org/issues/show/1331
-    def fixup(yaml)
-        yaml.gsub!(/((?:&id\d+\s+)?!ruby\/object:.*?)\s*\?/) { "? #{$1}" }
-        yaml
+        true
     end
 
     def encode(text)
diff --git a/spec/unit/network/formats.rb b/spec/unit/network/formats.rb
index 78b35fd..fd78ebf 100755
--- a/spec/unit/network/formats.rb
+++ b/spec/unit/network/formats.rb
@@ -50,29 +50,12 @@ describe "Puppet Network Format" do
             @yaml.render(instance).should == "foo"
         end
 
-        it "should fixup generated yaml on render" do
-            instance = mock 'instance', :to_yaml => "foo"
-
-            @yaml.expects(:fixup).with("foo").returns "bar"
-
-            @yaml.render(instance).should == "bar"
-        end
-
         it "should render multiple instances by calling 'to_yaml' on the array" do
             instances = [mock('instance')]
             instances.expects(:to_yaml).returns "foo"
             @yaml.render_multiple(instances).should == "foo"
         end
 
-        it "should fixup generated yaml on render" do
-            instances = [mock('instance')]
-            instances.stubs(:to_yaml).returns "foo"
-
-            @yaml.expects(:fixup).with("foo").returns "bar"
-
-            @yaml.render(instances).should == "bar"
-        end
-
         it "should intern by calling 'YAML.load'" do
             text = "foo"
             YAML.expects(:load).with("foo").returns "bar"
@@ -84,10 +67,6 @@ describe "Puppet Network Format" do
             YAML.expects(:load).with("foo").returns "bar"
             @yaml.intern_multiple(String, text).should == "bar"
         end
-
-        it "should fixup incorrect yaml to correct" do
-            @yaml.fixup("&id004 !ruby/object:Puppet::Relationship ?").should == "? &id004 !ruby/object:Puppet::Relationship"
-        end
     end
 
     describe "base64 compressed yaml" do
@@ -108,14 +87,6 @@ describe "Puppet Network Format" do
             @yaml.render(instance)
         end
 
-        it "should fixup generated yaml on render" do
-            instance = mock 'instance', :to_yaml => "foo"
-
-            @yaml.expects(:fixup).with("foo").returns "bar"
-
-            @yaml.render(instance)
-        end
-
         it "should encode generated yaml on render" do
             instance = mock 'instance', :to_yaml => "foo"
 
@@ -130,15 +101,6 @@ describe "Puppet Network Format" do
             @yaml.render_multiple(instances)
         end
 
-        it "should fixup generated yaml on render" do
-            instances = [mock('instance')]
-            instances.stubs(:to_yaml).returns "foo"
-
-            @yaml.expects(:fixup).with("foo").returns "bar"
-
-            @yaml.render(instances)
-        end
-
         it "should encode generated yaml on render" do
             instances = [mock('instance')]
             instances.stubs(:to_yaml).returns "foo"
@@ -173,10 +135,6 @@ describe "Puppet Network Format" do
             @yaml.encode("foo").should == "baz"
         end
 
-        it "should fixup incorrect yaml to correct" do
-            @yaml.fixup("&id004 !ruby/object:Puppet::Relationship ?").should == "? &id004 !ruby/object:Puppet::Relationship"
-        end
-
         describe "when zlib is disabled" do
             before do
                 Puppet[:zlib] = false

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list