diff options
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index ee89433f3..a11e870ab 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -38,6 +38,12 @@ module Puppet branch under your main directory."] ) + Puppet.setdefaults(:puppetmaster, + :storeconfigs => [false, + "Whether to store each client's configuration. This + requires ActiveRecord from Ruby on Rails."] + ) + attr_accessor :ast, :filetimeout # just shorten the constant path a bit, using what amounts to an alias AST = Puppet::Parser::AST @@ -220,7 +226,7 @@ module Puppet end begin - return scope.evaluate(args) + objects = scope.evaluate(args) rescue Puppet::DevError, Puppet::Error, Puppet::ParseError => except raise rescue => except @@ -232,6 +238,24 @@ module Puppet #end raise error end + + if Puppet[:storeconfigs] + unless defined? ActiveRecord + require 'puppet/rails' + unless defined? ActiveRecord + raise LoadError, + "storeconfigs is enabled but rails is unavailable" + end + Puppet::Rails.init + end + Puppet::Rails::Host.store( + :objects => objects, + :host => client, + :facts => facts + ) + end + + return objects end def scope @@ -240,25 +264,6 @@ module Puppet private - # Evaluate the configuration. If there aren't any nodes defined, then - # this doesn't actually do anything, because we have to evaluate the - # entire configuration each time we get a connect. - def evaluate - # FIXME When this produces errors, it should specify which - # node caused those errors. - if @usenodes - @scope = Puppet::Parser::Scope.new() # no parent scope - @scope.name = "top" - @scope.type = "puppet" - @scope.interp = self - Puppet.debug "Nodes defined" - @ast.safeevaluate(:scope => @scope) - else - Puppet.debug "No nodes defined" - return - end - end - def parsefiles if @file if defined? @parser @@ -305,10 +310,6 @@ module Puppet # Mark when we parsed, so we can check freshness @parsedate = Time.now.to_i @lastchecked = Time.now - - # Reevaluate the config. This is what actually replaces the - # existing scope. - evaluate end end end |
