diff options
| author | Luke Kanies <luke@madstop.com> | 2007-08-25 15:47:49 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-08-25 15:47:49 -0500 |
| commit | 3030d3eb3f6ed5640c14f3dae2c5167c51ce43eb (patch) | |
| tree | 214aa536f4e9ecf167ec465056670b23a2bae934 /lib/puppet/parser | |
| parent | ab5418390e3e49ce3a12b60902f405db157ed45b (diff) | |
| download | puppet-3030d3eb3f6ed5640c14f3dae2c5167c51ce43eb.tar.gz puppet-3030d3eb3f6ed5640c14f3dae2c5167c51ce43eb.tar.xz puppet-3030d3eb3f6ed5640c14f3dae2c5167c51ce43eb.zip | |
Modules are now tested with spec, and they now can handle environment-specific module paths.
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/configuration.rb | 10 | ||||
| -rw-r--r-- | lib/puppet/parser/templatewrapper.rb | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/puppet/parser/configuration.rb b/lib/puppet/parser/configuration.rb index 148f4dcd1..a56bfa080 100644 --- a/lib/puppet/parser/configuration.rb +++ b/lib/puppet/parser/configuration.rb @@ -97,6 +97,16 @@ class Puppet::Parser::Configuration @resource_graph.remove_vertex!(resource) if @resource_graph.vertex?(resource) end + # Return the node's environment. + def environment + unless defined? @environment + if node.environment and node.environment != "" + @environment = node.environment + end + end + @environment + end + # Evaluate each class in turn. If there are any classes we can't find, # just tag the configuration and move on. def evaluate_classes(classes = nil) diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 9c3c6c0d0..ecef60e43 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -7,14 +7,14 @@ class Puppet::Parser::TemplateWrapper def initialize(scope, file) @scope = scope - @file = Puppet::Module::find_template(file) + @file = Puppet::Module::find_template(file, @scope.configuration.environment) unless FileTest.exists?(@file) raise Puppet::ParseError, "Could not find template %s" % file end - # We'll only ever not have an interpreter in testing, but, eh. + # We'll only ever not have a parser in testing, but, eh. if @scope.parser @scope.parser.watch_file(@file) end |
