From 1ad8158da2435126693e02c66d188dd79e71f83d Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 16 May 2011 09:46:22 -0700 Subject: (#7259) Do not try to load all Terminus classes when configuring the Indirector When configuring the Indirector routes, we should only try loading the Terminus classes that are referenced by the configuration. Previously, we were loading all Terminus classes, which would cause errors if we didn't have all of the prerequisites for all of them, even if the ones with missing prerequisites weren't being used by the configuration. Paired-with: Nick Lewis --- lib/puppet/indirector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb index 7267ac7f3..86ede5994 100644 --- a/lib/puppet/indirector.rb +++ b/lib/puppet/indirector.rb @@ -18,7 +18,7 @@ module Puppet::Indirector terminus_name = termini["terminus"] cache_name = termini["cache"] - Puppet::Indirector::Terminus.terminus_classes(indirection_name) + Puppet::Indirector::Terminus.terminus_class(indirection_name, terminus_name || cache_name) indirection = Puppet::Indirector::Indirection.instance(indirection_name) raise "Indirection #{indirection_name} does not exist" unless indirection -- cgit From c8775f9c5caa883ab3b08695b355d3575263b165 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 16 May 2011 09:52:04 -0700 Subject: (#7259) Remove ActiveRecord requirement from indirector face spec "should be able to return a list of terminuses for a given indirection" was calling Puppet::Indirector::Face.terminus_classes, which is just a thin wrapper around Puppet::Indirector::Terminus.terminus_classes, which would attempt to load all Terminus classes. This would cause problems if not all of the prerequisites for all of the Terminus classes were installed (For example: ActiveRecord). Now we only test that the thin wrapper appropriately munges the output from Puppet::Indirector::Terminus.terminus_classes, since the method being wrapped should have its own tests for the behavior that was being tested originally. Paired-with: Nick Lewis --- spec/unit/indirector/face_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/unit/indirector/face_spec.rb b/spec/unit/indirector/face_spec.rb index 1530f7270..943ff7991 100755 --- a/spec/unit/indirector/face_spec.rb +++ b/spec/unit/indirector/face_spec.rb @@ -16,8 +16,17 @@ describe Puppet::Indirector::Face do Puppet::Indirector::Face.indirections.should be_include("catalog") end - it "should be able to return a list of terminuses for a given indirection" do - Puppet::Indirector::Face.terminus_classes(:catalog).should be_include("compiler") + it "should return the sorted to_s list of terminus classes" do + Puppet::Indirector::Terminus.expects(:terminus_classes).returns([ + :yaml, + :compiler, + :rest + ]) + Puppet::Indirector::Face.terminus_classes(:catalog).should == [ + 'compiler', + 'rest', + 'yaml' + ] end describe "as an instance" do -- cgit