From f52e2d006fb3ae8f0b3f58deac8f4287708bdb7b Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 29 Dec 2006 17:27:30 +0000 Subject: Trying to clean up how rails is loaded git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1989 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/collector.rb | 1 - lib/puppet/parser/interpreter.rb | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index fa7a41589..8b7df8c78 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -5,7 +5,6 @@ class Puppet::Parser::Collector # Collect exported objects. def collect_exported - require 'puppet/rails' # First get everything from the export table. Just reuse our # collect_virtual method but tell it to use 'exported? for the test. resources = collect_virtual(true) diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 6c1c27926..ad2487f11 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -375,9 +375,12 @@ class Puppet::Parser::Interpreter end # The class won't always be defined during testing. - if Puppet[:storeconfigs] and Puppet.features.rails? - require 'puppet/rails' - Puppet::Rails.init + if Puppet[:storeconfigs] + if Puppet.features.rails? + Puppet::Rails.init + else + raise Puppet::Error, "Rails is missing; cannot store configurations" + end end @files = [] @@ -770,12 +773,9 @@ class Puppet::Parser::Interpreter # Store the configs into the database. def storeconfigs(hash) - unless defined? ActiveRecord - require 'puppet/rails' - unless defined? ActiveRecord - raise LoadError, - "storeconfigs is enabled but rails is unavailable" - end + unless Puppet.features.rails? + raise Puppet::Error, + "storeconfigs is enabled but rails is unavailable" end Puppet::Rails.init -- cgit