diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-05 11:46:35 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-05 11:46:35 -0500 |
| commit | 9c58c476c2ffcf9613f14e5881b1177f01d413a7 (patch) | |
| tree | 8791274ce754f486f039ba942e3a5d3d9939df3e /lib/puppet | |
| parent | d35cd947c82ba9da8ec798100a3c710c34492521 (diff) | |
| download | puppet-9c58c476c2ffcf9613f14e5881b1177f01d413a7.tar.gz puppet-9c58c476c2ffcf9613f14e5881b1177f01d413a7.tar.xz puppet-9c58c476c2ffcf9613f14e5881b1177f01d413a7.zip | |
Adding a :code setting for specifying code to run
instead of a manifest, and removing all of the ambiguity
around whether an interpreter gets its own file specified
or uses the central setting.
Most of the changes are around fixing existing tests to use this new system.
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/defaults.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/indirector/code/configuration.rb | 16 | ||||
| -rw-r--r-- | lib/puppet/node.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 19 |
4 files changed, 8 insertions, 32 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 6ea4eef4c..ce1411b62 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -292,6 +292,9 @@ module Puppet "Where puppetmasterd looks for its manifests."], :manifest => ["$manifestdir/site.pp", "The entry-point manifest for puppetmasterd."], + :code => ["", "Code to parse directly. This is essentially only used + by ``puppet`, and should only be set if you're writing your own Puppet + executable"], :masterlog => { :default => "$logdir/puppetmaster.log", :owner => "$user", :group => "$group", diff --git a/lib/puppet/indirector/code/configuration.rb b/lib/puppet/indirector/code/configuration.rb index b3a4c67dd..0d06cb029 100644 --- a/lib/puppet/indirector/code/configuration.rb +++ b/lib/puppet/indirector/code/configuration.rb @@ -91,21 +91,7 @@ class Puppet::Indirector::Code::Configuration < Puppet::Indirector::Code # Create our interpreter object. def create_interpreter - args = {} - - # Allow specification of a code snippet or of a file - if self.code - args[:Code] = self.code - end - - # LAK:FIXME This needs to be handled somehow. - #if options.include?(:UseNodes) - # args[:UseNodes] = options[:UseNodes] - #elsif @local - # args[:UseNodes] = false - #end - - return Puppet::Parser::Interpreter.new(args) + return Puppet::Parser::Interpreter.new end # Turn our host name into a node object. diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index d71bd507e..9758c895c 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -9,7 +9,7 @@ class Puppet::Node extend Puppet::Indirector # Use the node source as the indirection terminus. - indirects :node + indirects :node, :terminus_class => :null # Add the node-searching methods. This is what people will actually # interact with that will find the node with the list of names or diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 8c727118c..87513cb18 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -14,7 +14,6 @@ class Puppet::Parser::Interpreter include Puppet::Util attr_accessor :usenodes - attr_accessor :code, :file include Puppet::Util::Errors @@ -30,17 +29,7 @@ class Puppet::Parser::Interpreter end # create our interpreter - def initialize(options = {}) - if @code = options[:Code] - elsif @file = options[:Manifest] - end - - if options.include?(:UseNodes) - @usenodes = options[:UseNodes] - else - @usenodes = true - end - + def initialize # The class won't always be defined during testing. if Puppet[:storeconfigs] if Puppet.features.rails? @@ -59,10 +48,8 @@ class Puppet::Parser::Interpreter def create_parser(environment) begin parser = Puppet::Parser::Parser.new(:environment => environment) - if self.code - parser.string = self.code - elsif self.file - parser.file = self.file + if code = Puppet.settings.value(:code, environment) and code != "" + parser.string = code else file = Puppet.settings.value(:manifest, environment) parser.file = file |
