summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-12-10 21:13:48 -0600
committerLuke Kanies <luke@madstop.com>2007-12-10 21:13:48 -0600
commitf127d04934b679b3e5edd7f55d31342abce3c96e (patch)
treebb8bc15e086b473bc27104cd6fcbbf548a68678e /lib/puppet/indirector
parent7a4ae082c216d68092f140ed1f5cca40ffb1a09e (diff)
downloadpuppet-f127d04934b679b3e5edd7f55d31342abce3c96e.tar.gz
puppet-f127d04934b679b3e5edd7f55d31342abce3c96e.tar.xz
puppet-f127d04934b679b3e5edd7f55d31342abce3c96e.zip
Fixing #951 -- external nodes work again, but you have to
set the 'node_terminus' setting to 'exec'.
Diffstat (limited to 'lib/puppet/indirector')
-rw-r--r--lib/puppet/indirector/configuration/compiler.rb6
-rw-r--r--lib/puppet/indirector/indirection.rb22
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/puppet/indirector/configuration/compiler.rb b/lib/puppet/indirector/configuration/compiler.rb
index 9fc8a7939..598f50451 100644
--- a/lib/puppet/indirector/configuration/compiler.rb
+++ b/lib/puppet/indirector/configuration/compiler.rb
@@ -55,7 +55,7 @@ class Puppet::Node::Configuration::Compiler < Puppet::Indirector::Code
# use timestamps; once one of them moves to using real versions,
# the comparison stops working.
def version(key)
- if node = Puppet::Node.search(key)
+ if node = Puppet::Node.find_by_any_name(key)
return [Puppet::Node.version(key).to_f, Puppet::Node::Facts.version(key).to_f, interpreter.configuration_version(node).to_f].sort[-1]
else
# This is the standard for "got nothing for ya".
@@ -108,9 +108,9 @@ class Puppet::Node::Configuration::Compiler < Puppet::Indirector::Code
#end
# Note that this is reasonable, because either their node source should actually
- # know about the node, or they should be using the ``none`` node source, which
+ # know about the node, or they should be using the ``null`` node source, which
# will always return data.
- unless node = Puppet::Node.search(key)
+ unless node = Puppet::Node.find_by_any_name(key)
raise Puppet::Error, "Could not find node '%s'" % key
end
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 816b4ffc5..f6f867a5f 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -59,6 +59,7 @@ class Puppet::Indirector::Indirection
@termini = {}
@cache_class = nil
+ @terminus_class = nil
raise(ArgumentError, "Indirection %s is already defined" % @name) if @@indirections.find { |i| i.name == @name }
@@indirections << self
@@ -88,12 +89,25 @@ class Puppet::Indirector::Indirection
return @termini[terminus_name] ||= make_terminus(terminus_name)
end
- attr_reader :terminus_class
+ # This can be used to select the terminus class.
+ attr_accessor :terminus_setting
+
+ # Determine the terminus class.
+ def terminus_class
+ unless @terminus_class
+ if setting = self.terminus_setting
+ self.terminus_class = Puppet.settings[setting].to_sym
+ else
+ raise Puppet::DevError, "No terminus class nor terminus setting was provided for indirection %s" % self.name
+ end
+ end
+ @terminus_class
+ end
# Specify the terminus class to use.
- def terminus_class=(terminus_class)
- validate_terminus_class(terminus_class)
- @terminus_class = terminus_class
+ def terminus_class=(klass)
+ validate_terminus_class(klass)
+ @terminus_class = klass
end
# This is used by terminus_class= and cache=.