summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/collector.rb1
-rw-r--r--lib/puppet/parser/interpreter.rb18
2 files changed, 9 insertions, 10 deletions
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