diff options
-rw-r--r-- | examples/code/snippets/casestatement | 8 | ||||
-rw-r--r-- | lib/puppet/parameter.rb | 6 | ||||
-rw-r--r-- | lib/puppet/parser/ast.rb | 9 | ||||
-rw-r--r-- | lib/puppet/parser/grammar.ra | 2 | ||||
-rw-r--r-- | lib/puppet/parser/parser.rb | 6 | ||||
-rw-r--r-- | lib/puppet/type.rb | 6 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/content.rb | 4 | ||||
-rwxr-xr-x | test/language/snippets.rb | 1 |
8 files changed, 25 insertions, 17 deletions
diff --git a/examples/code/snippets/casestatement b/examples/code/snippets/casestatement index a377bbb7c..565b8b422 100644 --- a/examples/code/snippets/casestatement +++ b/examples/code/snippets/casestatement @@ -37,3 +37,11 @@ case $ovar { file { "/tmp/existsfile3": mode => 755, create => true } } } + +$bool = true + +case $bool { + true: { + file { "/tmp/existsfile4": mode => 755, create => true } + } +} diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index d2656b766..9d6a8504c 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -110,7 +110,7 @@ module Puppet # And then define one of these proxies for each method in our # ParamHandler class. - proxymethods("required?", "default", "isnamevar?") + proxymethods("required?", "isnamevar?") attr_accessor :parent @@ -172,10 +172,6 @@ module Puppet @value = value end - def to_s - "%s => %s" % [self.class.name, self.value] - end - def inspect s = "Parameter(%s = %s" % [self.name, self.value || "nil"] if defined? @parent diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb index 193f85eb1..d586a23f3 100644 --- a/lib/puppet/parser/ast.rb +++ b/lib/puppet/parser/ast.rb @@ -788,10 +788,13 @@ module Puppet values = {} super - # this won't work if we move away from only allowing constants - # here - # but for now, it's fine and useful + + # This won't work if we move away from only allowing + # constants here, but for now, it's fine and useful. @options.each { |option| + unless option.is_a?(CaseOpt) + raise Puppet::DevError, "Option is not a CaseOpt" + end if option.default? @default = option end diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index fa19ad477..b365625da 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -317,7 +317,7 @@ casestatement: CASE rvalue LBRACE caseopts RBRACE { end result = AST::CaseStatement.new( :test => val[1], - :options => val[3], + :options => options, :file => @lexer.file, :line => @lexer.line ) diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index afdcb4584..3bb0fc039 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -32,7 +32,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..idd1811897f0', 'grammar.ra', 635 +module_eval <<'..end grammar.ra modeval..ida8383b5566', 'grammar.ra', 635 attr_reader :file attr_accessor :files @@ -149,7 +149,7 @@ def string=(string) end # $Id$ -..end grammar.ra modeval..idd1811897f0 +..end grammar.ra modeval..ida8383b5566 ##### racc 1.4.4 generates ### @@ -950,7 +950,7 @@ module_eval <<'.,.,', 'grammar.ra', 324 end result = AST::CaseStatement.new( :test => val[1], - :options => val[3], + :options => options, :file => @lexer.file, :line => @lexer.line ) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 1b9f61ac8..dfef5d07a 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -88,15 +88,11 @@ class Type < Puppet::Element # the Type class attribute accessors class << self - attr_reader :name, :states, :parameters + attr_reader :name, :states def inspect "Type(%s)" % self.name end - - def to_s - self.inspect - end end # Create @@typehash from @@typeary. This is meant to be run diff --git a/lib/puppet/type/pfile/content.rb b/lib/puppet/type/pfile/content.rb index 45aebdbda..f11377275 100755 --- a/lib/puppet/type/pfile/content.rb +++ b/lib/puppet/type/pfile/content.rb @@ -5,6 +5,10 @@ module Puppet primary purpose of this parameter is to provide a kind of limited templating." + def change_to_s + "synced" + end + # We should probably take advantage of existing md5 sums if they're there, # but I really don't feel like dealing with the complexity right now. def retrieve diff --git a/test/language/snippets.rb b/test/language/snippets.rb index a213d554f..2dc671be1 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -251,6 +251,7 @@ class TestSnippets < Test::Unit::TestCase /tmp/existsfile /tmp/existsfile2 /tmp/existsfile3 + /tmp/existsfile4 } files.each { |file| |