diff options
| author | Luke Kanies <luke@madstop.com> | 2009-08-14 13:52:03 -0700 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-08-18 07:44:54 +1000 |
| commit | 7e0924737d817644402b1c3d2d5abb2cf006e76b (patch) | |
| tree | ef9edd6853bdedb7ad7e4942844fe106f05329b7 | |
| parent | a35e9bf918db0f6fca45d8b0b002a372cff4f982 (diff) | |
| download | puppet-7e0924737d817644402b1c3d2d5abb2cf006e76b.tar.gz puppet-7e0924737d817644402b1c3d2d5abb2cf006e76b.tar.xz puppet-7e0924737d817644402b1c3d2d5abb2cf006e76b.zip | |
Fixing fact-missing problem when puppet.conf is reparsed
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | lib/puppet/indirector/node/active_record.rb | 6 | ||||
| -rwxr-xr-x | spec/unit/indirector/node/active_record.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/indirector/node/active_record.rb b/lib/puppet/indirector/node/active_record.rb index ab33af4b0..7b1ef9242 100644 --- a/lib/puppet/indirector/node/active_record.rb +++ b/lib/puppet/indirector/node/active_record.rb @@ -4,4 +4,10 @@ require 'puppet/node' class Puppet::Node::ActiveRecord < Puppet::Indirector::ActiveRecord use_ar_model Puppet::Rails::Host + + def find(request) + node = super + node.fact_merge + node + end end diff --git a/spec/unit/indirector/node/active_record.rb b/spec/unit/indirector/node/active_record.rb index 75a377230..1d90295cf 100755 --- a/spec/unit/indirector/node/active_record.rb +++ b/spec/unit/indirector/node/active_record.rb @@ -17,4 +17,18 @@ describe "Puppet::Node::ActiveRecord" do it "should use Puppet::Rails::Host as its ActiveRecord model" do Puppet::Node::ActiveRecord.ar_model.should equal(Puppet::Rails::Host) end + + it "should call fact_merge when a node is found" do + db_instance = stub 'db_instance' + Puppet::Node::ActiveRecord.ar_model.expects(:find_by_name).returns db_instance + + node = Puppet::Node.new("foo") + db_instance.expects(:to_puppet).returns node + ar = Puppet::Node::ActiveRecord.new + + node.expects(:fact_merge) + + request = Puppet::Indirector::Request.new(:node, :find, "what.ever") + ar.find(request) + end end |
