diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-10-28 14:15:08 +0100 |
---|---|---|
committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-10-29 10:28:32 +0100 |
commit | 9f30306d2c768bad3327ecb7748669afb10cd4aa (patch) | |
tree | 94eb572fc97edd80968549bcb7fe599193bb09f0 /lib | |
parent | 649a9e009a3a5bd070051b972c2cf26989af8e8c (diff) | |
download | puppet-9f30306d2c768bad3327ecb7748669afb10cd4aa.tar.gz puppet-9f30306d2c768bad3327ecb7748669afb10cd4aa.tar.xz puppet-9f30306d2c768bad3327ecb7748669afb10cd4aa.zip |
Fix #857 - Multiple class of the same name don't append code
The following manifest wasn't working:
class one {
notice('class one')
}
class one {
notice('second class one')
}
include one
It all boiled down to class code not being arrays.
Encapsulating code in ASTArray when needed is enough to append code,
because of the property of ASTArray to evaluate all their members in
turn.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/parser_support.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index 853d6aa86..1583973a7 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -291,10 +291,14 @@ class Puppet::Parser::Parser if tmp == "" tmp = "main" end - + Puppet.debug addcontext("Adding code to %s" % tmp) # Else, add our code to it. if other.code and code + # promote if neededcodes to ASTArray so that we can append code + # ASTArray knows how to evaluate its members. + other.code = ast AST::ASTArray, :children => [other.code] unless other.code.is_a?(AST::ASTArray) + code = ast AST::ASTArray, :children => [code] unless code.is_a?(AST::ASTArray) other.code.children += code.children else other.code ||= code |