[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1456-g2f0b1e5

Markus Roberts Markus at reality.com
Tue Oct 27 17:06:04 UTC 2009


The following commit has been merged in the upstream branch:
commit ae528f62e898fac37ea7d37c6fcff2e5c0954782
Author: Markus Roberts <Markus at reality.com>
Date:   Mon Oct 19 09:25:55 2009 -0700

    Ticket #2734 PSON/JSON not serializing classes of a catalog
    
    Now it does, there are tests to prove it, and the related tests
    for tags and version have been strengthend.
    
    Signed-off-by: Markus Roberts <Markus at reality.com>

diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index 8ab788e..5bf9a83 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -418,6 +418,10 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
             end
         end
 
+        if classes = data['classes']
+            result.add_class(*classes)
+        end
+
         result
     end
 
@@ -452,7 +456,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
                 'name'      => name,
                 'version'   => version,
                 'resources' => vertices.collect { |v| v.to_pson_data_hash },
-                'edges'     => edges.   collect { |e| e.to_pson_data_hash }
+                'edges'     => edges.   collect { |e| e.to_pson_data_hash },
+                'classes'   => classes
                 },
             'metadata' => {
                 'api_version' => 1
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index 39f185a..db67243 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -911,7 +911,7 @@ describe Puppet::Resource::Catalog, "when converting to pson" do
         PSON.parse @catalog.to_pson
     end
 
-    [:name, :version, :tags].each do |param|
+    [:name, :version, :tags, :classes].each do |param|
         it "should set its #{param} to the #{param} of the resource" do
             @catalog.send(param.to_s + "=", "testing") unless @catalog.send(param)
 
@@ -979,16 +979,20 @@ describe Puppet::Resource::Catalog, "when converting from pson" do
 
     it "should set the provided version on the catalog if one is set" do
         @data['version'] = 50
-        @catalog.expects(:version=).with(@data['version'])
-
         PSON.parse @pson.to_pson
+        @catalog.version.should == @data['version']
     end
 
     it "should set any provided tags on the catalog" do
         @data['tags'] = %w{one two}
-        @catalog.expects(:tag).with("one", "two")
+        PSON.parse @pson.to_pson
+        @catalog.tags.should == @data['tags']
+    end
 
+    it "should set any provided classes on the catalog" do
+        @data['classes'] = %w{one two}
         PSON.parse @pson.to_pson
+        @catalog.classes.should == @data['classes']
     end
 
     it 'should convert the resources list into resources and add each of them' do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list