Now it does, and there are tests to prove it.
Signed-off-by: Markus Roberts <[email protected]>
---
lib/puppet/resource/catalog.rb | 7 ++++++-
spec/unit/resource/catalog.rb | 9 ++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
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..e045afa 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)
@@ -991,6 +991,13 @@ describe Puppet::Resource::Catalog, "when converting from
pson" do
PSON.parse @pson.to_pson
end
+ it "should set any provided classes on the catalog" do
+ @data['classes'] = %w{one two}
+ @catalog.expects(:add_class).with("one", "two")
+
+ PSON.parse @pson.to_pson
+ end
+
it 'should convert the resources list into resources and add each of them'
do
@data['resources'] = [Puppet::Resource.new(:file, "/foo"),
Puppet::Resource.new(:file, "/bar")]
--
1.6.4
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---