On Tue, 2010-10-26 at 17:29 -0700, Jesse Wolfe patch:
On Tue, 2010-10-26 at 19:33 -0700, Markus Roberts wrote:
> [snipped]
> 
>             def retrieve
>               # If we're not following links and we're a link, then we
>         just turn
>               # off mode management entirely.
>         
>         -      if stat = @resource.stat(false)
>         +      if has_stat?
>                 unless defined?(@fixed)
>                   @should &&= @should.collect { |s| self.dirmask(s) }
>                 end
>         -        return Puppet::Util::Octal.octalForInteger(stat.mode
>         & 007777)
>         +        return Puppet::Util::Octal.octalForInteger(stat_mode
>         & 007777)
>               else
>                 return :absent
>               end
>             end
>         
>         +    def has_stat?
>         +      @resource.stat(false)
>         +    end
>         +
>         +    def stat_mode
>         +      @resource.stat.mode & 007777
>         +    end
>         +
>         +    def stat_is_directory?
>         +      has_stat? and @resource.stat.directory?
>         +    end
>         +
> 
> So I'm stuck on trying to remember / re-figure-out what passing false
> to stat() does.  I know I've known in the past, but the mind forgets
> pain.  Is it significant that the previous version was using the value
> of the local variable stat which came from a @resource.stat(false)
> call (stat.mode) and this version is using @resource.stat (without the
> false) in stat_mode?

I had the same question when reading the patch. Hopefully stat is a
cached_attr so it shouldn't end with stat(3) called many times per file.
Hoping the false parameter doesn't mean "expire the cache now".
Looking to git history (hint: commit 0ecbf7), the argument was used to
refresh the internal stat cache. Since the file type now use the cacher
module, the parameter is not needed.

-- 
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to