summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-06 16:19:09 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit804105d925b526bcf209910172bc14bdeafaf4e7 (patch)
treec83327108bd8aa40d041a0ea239bc4f21519d8b4 /lib
parent26b272b218b02115ce66edbc6dd4cffd231105ab (diff)
downloadpuppet-804105d925b526bcf209910172bc14bdeafaf4e7.tar.gz
puppet-804105d925b526bcf209910172bc14bdeafaf4e7.tar.xz
puppet-804105d925b526bcf209910172bc14bdeafaf4e7.zip
Moving Rails initialization to Compiler terminus
It was previously handled by the Interpreter, but we're planning on getting of that. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/indirector/catalog/compiler.rb6
-rw-r--r--lib/puppet/parser/interpreter.rb16
2 files changed, 7 insertions, 15 deletions
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb
index 4f6b0602a..ecb1c74e1 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -49,6 +49,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
def initialize
set_server_facts
+ setup_database_backend if Puppet[:storeconfigs]
end
# Create/return our interpreter.
@@ -163,6 +164,11 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
end
end
+ def setup_database_backend
+ raise Puppet::Error, "Rails is missing; cannot store configurations" unless Puppet.features.rails?
+ Puppet::Rails.init
+ end
+
# Mark that the node has checked in. LAK:FIXME this needs to be moved into
# the Node class, or somewhere that's got abstract backends.
def update_node_check(node)
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index bc0ae4fdf..1b158209d 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -17,11 +17,6 @@ class Puppet::Parser::Interpreter
include Puppet::Util::Errors
- # Determine the configuration version for a given node's environment.
- def configuration_version(node)
- parser(node.environment).version
- end
-
# evaluate our whole tree
def compile(node)
raise Puppet::ParseError, "Could not parse configuration; cannot compile on node %s" % node.name unless env_parser = parser(node.environment)
@@ -35,15 +30,6 @@ class Puppet::Parser::Interpreter
# create our interpreter
def initialize
- # The class won't always be defined during testing.
- if Puppet[:storeconfigs]
- if Puppet.features.rails?
- Puppet::Rails.init
- else
- raise Puppet::Error, "Rails is missing; cannot store configurations"
- end
- end
-
@parsers = {}
end
@@ -61,7 +47,7 @@ class Puppet::Parser::Interpreter
# Create a new parser object and pre-parse the configuration.
def create_parser(environment)
begin
- parser = Puppet::Parser::Parser.new(:environment => environment)
+ parser = Puppet::Parser::Parser.new(environment)
if code = Puppet.settings.uninterpolated_value(:code, environment) and code != ""
parser.string = code
else