diff options
| author | Luke Kanies <luke@madstop.com> | 2009-01-19 18:10:45 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-06 18:08:40 -0600 |
| commit | b99c6b554d935c3dddf5c2e6968333865ff46505 (patch) | |
| tree | e45a65e009e2ddcbebd326af42a7b4594bbd0b2c /lib | |
| parent | 8b44d6fd7c73071afc4a78abcbd50b9f5d487ce5 (diff) | |
| download | puppet-b99c6b554d935c3dddf5c2e6968333865ff46505.tar.gz puppet-b99c6b554d935c3dddf5c2e6968333865ff46505.tar.xz puppet-b99c6b554d935c3dddf5c2e6968333865ff46505.zip | |
Clarifying how node names are used during catalog compilation
We now use any passed in node (used by bin/puppet), then any
authenticated node info (e.g., the cert name), then any
passed in information (usually the host name).
The third option will never be used in Puppet's architecture,
but simplifies using the API for other users.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/indirector/catalog/compiler.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index df1808d73..aba53bff8 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -14,8 +14,14 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code # Compile a node's catalog. def find(request) - unless node = request.options[:use_node] || find_node(request.key) - raise ArgumentError, "Could not find node '%s'; cannot compile" % request.key + unless node = request.options[:use_node] + # If the request is authenticated, then the 'node' info will + # be available; if not, then we use the passed-in key. We rely + # on our authorization system to determine whether this is allowed. + name = request.node || request.key + unless node = find_node(name) + raise ArgumentError, "Could not find node '%s'; cannot compile" % name + end end if catalog = compile(node) @@ -81,15 +87,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code end # Turn our host name into a node object. - def find_node(key) - # If we want to use the cert name as our key - # LAK:FIXME This needs to be figured out somehow, but it requires the routing. - # This should be able to use the request, yay. - #if Puppet[:node_name] == 'cert' and client - # key = client - #end - - return nil unless node = Puppet::Node.find(key) + def find_node(name) + return nil unless node = Puppet::Node.find(name) # Add any external data to the node. add_node_data(node) |
