On 18 February 2010 09:37, Jesse Wolfe <[email protected]> wrote: > There's a limitation in Ruby 1.8.x that makes constants behave > differently than developers seem to expect: > Constants defined inside a do/end block do not get inserted into the > namespace of 'self', they instead go into the toplevel (Object) > namespace. > These providers exhibit bugs since they use constants with the same > name in the same namespace. > Other providers and other dynamically generated classes using constants > without an explicit namespace should be considered to have a code smell. > > Signed-off-by: Jesse Wolfe <[email protected]> > --- > lib/puppet/provider/package/dpkg.rb | 8 ++++---- > lib/puppet/provider/package/pkg.rb | 8 ++++---- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/lib/puppet/provider/package/dpkg.rb > b/lib/puppet/provider/package/dpkg.rb > index d6ec56a..06050ce 100755 > --- a/lib/puppet/provider/package/dpkg.rb > +++ b/lib/puppet/provider/package/dpkg.rb > @@ -32,14 +32,14 @@ Puppet::Type.type(:package).provide :dpkg, :parent => > Puppet::Provider::Package > return packages > end > > - REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$} > - FIELDS = [:desired, :error, :status, :name, :ensure] > + self::REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$} > + self::FIELDS = [:desired, :error, :status, :name, :ensure] > > def self.parse_line(line) > - if match = REGEX.match(line) > + if match = self::REGEX.match(line) > hash = {} > > - FIELDS.zip(match.captures) { |field,value| > + self::FIELDS.zip(match.captures) { |field,value|
I am presuming fixing the PUPPETVERSION constant error is not feasible using this method? Regards James -- Author of: * Pro Linux System Administration (http://tinyurl.com/linuxadmin) * Pulling Strings with Puppet (http://tinyurl.com/pupbook) * Pro Nagios 2.0 (http://tinyurl.com/pronagios) * Hardening Linux (http://tinyurl.com/hardeninglinux) -- 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.
