diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-21 23:50:51 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-21 23:50:51 +0000 |
commit | bba972fd1bcbb7747f73eee6b6789e02ad18071a (patch) | |
tree | c9a5284d6f744e60c9429c02d631c26233f6eeec /lib/puppet/parser/ast/astarray.rb | |
parent | a1d71d9e5faaebe61c51750c5dfcc2276d4be904 (diff) | |
download | puppet-bba972fd1bcbb7747f73eee6b6789e02ad18071a.tar.gz puppet-bba972fd1bcbb7747f73eee6b6789e02ad18071a.tar.xz puppet-bba972fd1bcbb7747f73eee6b6789e02ad18071a.zip |
Adding warnings and error throwing for #218 -- metaparams in prototypes are treated specially.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1481 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast/astarray.rb')
-rw-r--r-- | lib/puppet/parser/ast/astarray.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb index ab24fa86c..c42f658fd 100644 --- a/lib/puppet/parser/ast/astarray.rb +++ b/lib/puppet/parser/ast/astarray.rb @@ -111,5 +111,33 @@ class Puppet::Parser::AST # Another simple container class to make sure we can correctly arrayfy # things. - class CompArgument < ASTArray; end + class CompArgument < ASTArray + @@warnings = {} + def initialize(hash) + super + name = @children[0].value + + # If it's not a metaparamer, we're fine. + return unless Puppet::Type.metaparamclass(name) + + if @children[1] + if @children[1].value == false + raise Puppet::ParseError, + "%s is a metaparameter; please choose another name" % + name + else + unless @@warnings[name] + @@warnings[name] = true + Puppet.warning "%s is a metaparam; this value will inherit to all contained elements" % name + end + end + else + raise Puppet::ParseError, + "%s is a metaparameter; please choose another name" % + name + end + end + end end + +# $Id$ |