[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/2.6.1-1-69-gb75a307

Markus Roberts Markus at reality.com
Tue Nov 9 22:10:56 UTC 2010


The following commit has been merged in the master branch:
commit 31118fe85aca4ee46903b17a3eb7aee07b8c0d69
Author: Markus Roberts <Markus at reality.com>
Date:   Sat Oct 23 08:26:24 2010 -0700

    Kludge for #5048 -- serialization compatibility with 0.25.x
    
    In 0.25.x the type & title of a resource were wrapped in a Puppet::Resource::Reference
    object whereas in 2.6.x they are attributes of the resource itself without the
    additional indirection (see 7089446697ad550c22012bc2b5572030727d67e1).
    
    When pson serialization is used this isn’t a problem but with formats in which
    we just blindly emit the structure either because we have no choice (marshal)
    or because we just use the default (yaml) it is a compatibility-breaking change.
    
    This patch resoloves the problem by adding a dummy reference object to cause
    the "correct" serialization; it is intended as a stop-gap for 2.6.x and should
    NOT be merged into next.

diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 39803b0..7dea270 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -154,6 +154,14 @@ class Puppet::Resource
     end
   end
 
+  # This stub class is only needed for serialization compatibility with 0.25.x
+  class Reference
+    attr_accessor :type,:title
+    def initialize(type,title)
+      @type, at title = type,title
+    end
+  end
+
   # Create our resource.
   def initialize(type, title = nil, attributes = {})
     @parameters = {}
@@ -180,6 +188,8 @@ class Puppet::Resource
     tag(self.type)
     tag(self.title) if valid_tag?(self.title)
 
+    @reference = Reference.new(@type, at title) # for serialization compatibility with 0.25.x
+
     raise ArgumentError, "Invalid resource type #{type}" if strict? and ! resource_type
   end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list