summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/collector.rb3
-rw-r--r--lib/puppet/parser/interpreter.rb4
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index 8b7df8c78..d64e76132 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -17,6 +17,9 @@ class Puppet::Parser::Collector
# We're going to collect objects from rails, but we don't want any
# objects from this host.
+ unless ActiveRecord::Base.connected?
+ Puppet::Rails.init
+ end
host = Puppet::Rails::Host.find_by_name(@scope.host)
args = {}
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index ad2487f11..a00b10042 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -778,7 +778,9 @@ class Puppet::Parser::Interpreter
"storeconfigs is enabled but rails is unavailable"
end
- Puppet::Rails.init
+ unless ActiveRecord::Base.connected?
+ Puppet::Rails.init
+ end
# Fork the storage, since we don't need the client waiting
# on that. How do I avoid this duplication?