summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/defaults.rb22
-rw-r--r--lib/puppet/network/format.rb1
-rw-r--r--lib/puppet/parser/compiler.rb37
-rw-r--r--lib/puppet/resource/catalog.rb1
4 files changed, 20 insertions, 41 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 9ec26edf3..ac7281356 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -515,10 +515,7 @@ module Puppet
:graph => [false, "Whether to create dot graph files for the different
configuration graphs. These dot files can be interpreted by tools
like OmniGraffle or dot (which is part of ImageMagick)."],
- :graphdir => ["$statedir/graphs", "Where to store dot-outputted graphs."],
- :storeconfigs => [false,
- "Whether to store each client's configuration. This
- requires ActiveRecord from Ruby on Rails."]
+ :graphdir => ["$statedir/graphs", "Where to store dot-outputted graphs."]
)
# Plugin information.
@@ -680,6 +677,23 @@ module Puppet
branch under your main directory."]
)
+ setdefaults(:puppetmasterd,
+ :storeconfigs => {:default => false, :desc => "Whether to store each client's configuration. This
+ requires ActiveRecord from Ruby on Rails.",
+ :call_on_define => true, # Call our hook with the default value, so we always get the libdir set.
+ :hook => proc do |value|
+ require 'puppet/node'
+ require 'puppet/node/facts'
+ require 'puppet/resource/catalog'
+ if value
+ Puppet::Node::Catalog.cache_class = :active_record
+ Puppet::Node::Facts.cache_class = :active_record
+ Puppet::Node.cache_class = :active_record
+ end
+ end
+ }
+ )
+
# This doesn't actually work right now.
setdefaults(:parser,
:lexical => [false, "Whether to use lexical scoping (vs. dynamic)."],
diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb
index 21aead7cc..db9458ee3 100644
--- a/lib/puppet/network/format.rb
+++ b/lib/puppet/network/format.rb
@@ -1,3 +1,4 @@
+require 'puppet/provider'
require 'puppet/provider/confiner'
# A simple class for modeling encoding formats for moving
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 7dcd50270..968e0b979 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -97,10 +97,6 @@ class Puppet::Parser::Compiler
fail_on_unevaluated()
- if Puppet[:storeconfigs]
- store()
- end
-
return @catalog
end
@@ -424,39 +420,6 @@ class Puppet::Parser::Compiler
end
end
- # Store the catalog into the database.
- def store
- unless Puppet.features.rails?
- raise Puppet::Error,
- "storeconfigs is enabled but rails is unavailable"
- end
-
- unless ActiveRecord::Base.connected?
- Puppet::Rails.connect
- end
-
- # We used to have hooks here for forking and saving, but I don't
- # think it's worth retaining at this point.
- store_to_active_record(@node, resources)
- end
-
- # Do the actual storage.
- def store_to_active_record(node, resources)
- begin
- # We store all of the objects, even the collectable ones
- benchmark(:info, "Stored catalog for #{node.name}") do
- Puppet::Rails::Host.transaction do
- Puppet::Rails::Host.store(node, resources)
- end
- end
- rescue => detail
- if Puppet[:trace]
- puts detail.backtrace
- end
- Puppet.err "Could not store configs: %s" % detail.to_s
- end
- end
-
# Return an array of all of the unevaluated resources. These will be definitions,
# which need to get evaluated into native resources.
def unevaluated_resources
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index cb0ce0333..32fbc38d6 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -1,3 +1,4 @@
+require 'puppet/node'
require 'puppet/indirector'
require 'puppet/simple_graph'
require 'puppet/transaction'