[Pkg-puppet-devel] [facter] 176/352: (FACT-237) Freeze results of each aggregate chunk

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit a4b2fa147c0b9ea6fc1e52cbbf219eb84e2de233
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Thu Jan 16 17:24:00 2014 -0800

    (FACT-237) Freeze results of each aggregate chunk
---
 lib/facter/core/aggregate.rb     |  4 +++-
 spec/unit/core/aggregate_spec.rb | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/facter/core/aggregate.rb b/lib/facter/core/aggregate.rb
index 20b51cd..ff199fc 100644
--- a/lib/facter/core/aggregate.rb
+++ b/lib/facter/core/aggregate.rb
@@ -2,6 +2,7 @@ require 'facter'
 require 'facter/core/directed_graph'
 require 'facter/core/suitable'
 require 'facter/core/resolvable'
+require 'facter/util/values'
 
 # Aggregates provide a mechanism for facts to be resolved in multiple steps.
 #
@@ -154,7 +155,8 @@ class Facter::Core::Aggregate
     order_chunks.each do |(name, block)|
       input = @deps[name].map { |dep_name| results[dep_name] }
 
-      results[name] = block.call(*input)
+      output = block.call(*input)
+      results[name] = Facter::Util::Values.deep_freeze(output)
     end
 
     results
diff --git a/spec/unit/core/aggregate_spec.rb b/spec/unit/core/aggregate_spec.rb
index e1d9ab4..6f85022 100644
--- a/spec/unit/core/aggregate_spec.rb
+++ b/spec/unit/core/aggregate_spec.rb
@@ -86,7 +86,18 @@ describe Facter::Core::Aggregate do
       expect(output).to include 'foo bar'
     end
 
-    it "clones and freezes chunk results passed to other chunks"
+    it "clones and freezes chunk results passed to other chunks" do
+      subject.chunk(:first) { 'foo' }
+      subject.chunk(:second, :require => [:first]) do |first|
+        expect(first).to be_frozen
+      end
+
+      subject.aggregate do |chunks|
+        chunks.values.each do |chunk|
+          expect(chunk).to be_frozen
+        end
+      end
+    end
   end
 
   describe "evaluating chunks" do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list