diff options
| author | Rick Bradley <rick@rickbradley.com> | 2007-10-06 13:25:12 -0500 |
|---|---|---|
| committer | Rick Bradley <rick@rickbradley.com> | 2007-10-06 13:25:12 -0500 |
| commit | 42b98562b5237797e1a51fdcdd57aa3c6825b404 (patch) | |
| tree | 0f5cc25fb42b348f3c851c988f3b86979871794a /lib/puppet/network | |
| parent | 1befcc46926a27ec5f799d6ad8caa59c3b808c4c (diff) | |
| parent | cdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5 (diff) | |
| download | puppet-42b98562b5237797e1a51fdcdd57aa3c6825b404.tar.gz puppet-42b98562b5237797e1a51fdcdd57aa3c6825b404.tar.xz puppet-42b98562b5237797e1a51fdcdd57aa3c6825b404.zip | |
Merge branch 'master' of git://reductivelabs.com/puppet into routing
Diffstat (limited to 'lib/puppet/network')
| -rw-r--r-- | lib/puppet/network/client/master.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/network/handler/configuration.rb | 45 | ||||
| -rw-r--r-- | lib/puppet/network/handler/master.rb | 15 |
3 files changed, 16 insertions, 46 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index f950a6059..5408cabe4 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -266,6 +266,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client self.getconfig end rescue => detail + puts detail.backtrace if Puppet[:trace] Puppet.err "Could not retrieve configuration: %s" % detail end @@ -544,6 +545,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end rescue => detail + puts detail.backtrace Puppet.err "Could not retrieve configuration: %s" % detail unless Puppet[:usecacheonfailure] diff --git a/lib/puppet/network/handler/configuration.rb b/lib/puppet/network/handler/configuration.rb index 353693bdc..09c4b971a 100644 --- a/lib/puppet/network/handler/configuration.rb +++ b/lib/puppet/network/handler/configuration.rb @@ -49,10 +49,14 @@ class Puppet::Network::Handler @local = false end - # Just store the options, rather than creating the interpreter - # immediately. Mostly, this is so we can create the interpreter - # on-demand, which is easier for testing. - @options = options + options.each do |param, value| + case param + when :Classes: @classes = value + when :Local: self.local = true + else + raise ArgumentError, "Configuration handler does not accept %s" % param + end + end set_server_facts end @@ -82,8 +86,8 @@ class Puppet::Network::Handler node.merge(@server_facts) # Add any specified classes to the node's class list. - if classes = @options[:Classes] - classes.each do |klass| + if @classes + @classes.each do |klass| node.classes << klass end end @@ -121,37 +125,14 @@ class Puppet::Network::Handler end # Create our interpreter object. - def create_interpreter(options) - args = {} - - # Allow specification of a code snippet or of a file - if code = options[:Code] - args[:Code] = code - elsif options[:Manifest] - args[:Manifest] = options[:Manifest] - end - - args[:Local] = local? - - if options.include?(:UseNodes) - args[:UseNodes] = options[:UseNodes] - elsif @local - args[:UseNodes] = false - end - - # This is only used by the cfengine module, or if --loadclasses was - # specified in +puppet+. - if options.include?(:Classes) - args[:Classes] = options[:Classes] - end - - return Puppet::Parser::Interpreter.new(args) + def create_interpreter + return Puppet::Parser::Interpreter.new end # Create/return our interpreter. def interpreter unless defined?(@interpreter) and @interpreter - @interpreter = create_interpreter(@options) + @interpreter = create_interpreter end @interpreter end diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index 25c4318b8..1c7f7310e 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -30,13 +30,6 @@ class Puppet::Network::Handler def initialize(hash = {}) args = {} - # Allow specification of a code snippet or of a file - if code = hash[:Code] - args[:Code] = code - elsif man = hash[:Manifest] - args[:Manifest] = man - end - if hash[:Local] @local = hash[:Local] else @@ -53,12 +46,6 @@ class Puppet::Network::Handler Puppet.debug("Creating interpreter") - if hash.include?(:UseNodes) - args[:UseNodes] = hash[:UseNodes] - elsif @local - args[:UseNodes] = false - end - # This is only used by the cfengine module, or if --loadclasses was # specified in +puppet+. if hash.include?(:Classes) @@ -74,7 +61,7 @@ class Puppet::Network::Handler client, clientip = clientname(client, clientip, facts) # Pass the facts to the fact handler - Puppet::Node::Facts.new(client, facts).save + Puppet::Node::Facts.new(client, facts).save unless local? # And get the configuration from the config handler config = config_handler.configuration(client) |
