+1 I would not have used trailing ";"s, but it's perfectly valid.
On Wed, Nov 4, 2009 at 8:56 AM, Al Hoang <[email protected]> wrote: > > Hi, > > In order to get Puppet to properly work on Ruby 1.9.x case statements > cannot use a colon after each particular case. There are some places in > lib/puppet/rails.rb and lib/puppet/type/file.rb that use this syntax > which breaks under Ruby 1.9.x > > The following patch changes the case statements to be compatible with > Ruby 1.9 > > --- > > > diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb > index ec2d618..a78d0f9 100644 > --- a/lib/puppet/rails.rb > +++ b/lib/puppet/rails.rb > @@ -51,7 +51,7 @@ module Puppet::Rails > > socket = Puppet[:dbsocket] > args[:socket] = socket unless socket.empty? > - when "oracle_enhanced": > + when "oracle_enhanced" > args[:database] = Puppet[:dbname] unless Puppet[:dbname].empty? > args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty? > args[:password] = Puppet[:dbpassword] unless > Puppet[:dbpassword].empty? > diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb > index 34dc445..d6b7bef 100644 > --- a/lib/puppet/type/file.rb > +++ b/lib/puppet/type/file.rb > @@ -120,10 +120,10 @@ module Puppet > munge do |value| > newval = super(value) > case newval > - when :true, :inf: true > - when :false: false > - when :remote: :remote > - when Integer, Fixnum, Bignum: > + when :true, :inf; true > + when :false; false > + when :remote; :remote > + when Integer, Fixnum, Bignum; > self.warning "Setting recursion depth with the recurse > parameter is now deprecated, please use recurselimit" > > # recurse == 0 means no recursion > @@ -131,7 +131,7 @@ module Puppet > > resource[:recurselimit] = value > true > - when /^\d+$/: > + when /^\d+$/; > self.warning "Setting recursion depth with the recurse > parameter is now deprecated, please use recurselimit" > value = Integer(value) > > @@ -154,8 +154,8 @@ module Puppet > munge do |value| > newval = super(value) > case newval > - when Integer, Fixnum, Bignum: value > - when /^\d+$/: Integer(value) > + when Integer, Fixnum, Bignum; value > + when /^\d+$/; Integer(value) > else > raise ArgumentError, "Invalid recurselimit value %s" % > value.inspect > end > @@ -613,14 +613,14 @@ module Puppet > end > > case s.ftype > - when "directory" > + when "directory"; > if self[:force] == :true > debug "Removing existing directory for replacement with > %s" % should > FileUtils.rmtree(self[:path]) > else > notice "Not removing directory; use 'force' to > override" > end > - when "link", "file" > + when "link", "file"; > debug "Removing existing %s for replacement with %s" % > [s.ftype, should] > File.unlink(self[:path]) > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
