summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Parker <andy@puppetlabs.com>2014-10-03 12:59:12 -0700
committerAndrew Parker <andy@puppetlabs.com>2014-10-03 12:59:12 -0700
commite19552a098258daab0894befcb8d7ef73a60e715 (patch)
treede588ac91e6b3fc9f0367a8106127c3177066270
parent766cce7ff953b63698a7a4c819e6b21b60703c6d (diff)
parentb62ec8c7d1c3f7c6a34e804f0c568275e77a2aa4 (diff)
downloadpuppet-e19552a098258daab0894befcb8d7ef73a60e715.tar.gz
Merge branch 'pr/3126' into stable
* pr/3126: (PUP-3351) Test using example of problematic behavior (PUP-3351) Evaluate ENC classes in the correct order Closes GH-3126
-rw-r--r--lib/puppet/parser/compiler.rb3
-rwxr-xr-xspec/unit/parser/compiler_spec.rb20
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 5df2916fc..125b8e9f2 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -187,9 +187,8 @@ class Puppet::Parser::Compiler
classes_without_params = @node.classes
end
- evaluate_classes(classes_without_params, @node_scope || topscope)
-
evaluate_classes(classes_with_params, @node_scope || topscope)
+ evaluate_classes(classes_without_params, @node_scope || topscope)
end
# Evaluate each specified class in turn. If there are any classes we can't
diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb
index 0ca01f521..74cb326d9 100755
--- a/spec/unit/parser/compiler_spec.rb
+++ b/spec/unit/parser/compiler_spec.rb
@@ -1,6 +1,6 @@
-#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet_spec/compiler'
+require 'matchers/resource'
class CompilerTestResource
attr_accessor :builtin, :virtual, :evaluated, :type, :title
@@ -53,6 +53,7 @@ end
describe Puppet::Parser::Compiler do
include PuppetSpec::Files
+ include Matchers::Resource
def resource(type, title)
Puppet::Parser::Resource.new(type, title, :scope => @scope)
@@ -864,6 +865,23 @@ describe Puppet::Parser::Compiler do
it "should fail if the class doesn't exist" do
expect { compile_to_catalog('', node) }.to raise_error(Puppet::Error, /Could not find class something/)
end
+
+ it 'evaluates classes declared with parameters before unparameterized classes' do
+ node = Puppet::Node.new('someone', :classes => { 'app::web' => {}, 'app' => { 'port' => 8080 } })
+ manifest = <<-MANIFEST
+ class app($port = 80) { }
+
+ class app::web($port = $app::port) inherits app {
+ notify { expected: message => "$port" }
+ }
+ MANIFEST
+
+ catalog = compile_to_catalog(manifest, node)
+
+ expect(catalog).to have_resource("Class[App]").with_parameter(:port, 8080)
+ expect(catalog).to have_resource("Class[App::Web]")
+ expect(catalog).to have_resource("Notify[expected]").with_parameter(:message, "8080")
+ end
end
end
end