So isn't this the same as: > > + @should.any? { |desired| property_matches?(desired, is) } >
I never seem to remember that #any? exists, and I keep end up re-implementing it. > > - mode_int = mode ? Puppet::Util::Octal.integerForOctal(mode) : nil >> + mode_int = mode ? Puppet::Util::FileMode.bits_for_mode(mode, 0) : nil >> > > Now I'm feeling silly for my to_i(8) / to_s(8) notes on the previous > commit. > well, I was still using it elsewhere, and I should still change it. > > > I'm not understanding why we don't do this with symbolic modes as > well...the logic of "dirs must be executable" doesn't depend on the > representation does it? > Oh, probably. I had convinced myself that the +X mode was sufficiently similar that people should use that instead, but upon reflection I don't think I can defend that position. > > >> + def property_matches?(desired, current) >> + return false unless current >> + current_bits = Puppet::Util::Octal.integerForOctal(current) >> + desired_bits = Puppet::Util::FileMode.bits_for_mode(desired, >> current_bits, stat_is_directory?) >> + desired_bits == current_bits >> + end >> + >> > > I'm probably just being dense, but I can't square this with "don't care > bits" as mentioned in the commit message. > Basically: I start with current_bits, do a virtual chmod to produce desired_bits. So, for example, 0777 and "a+x" will return 0777 as the desired_bits, which is equal, so they're insync. If the sticky bit or some read bits were set different, the file would still be insync. > 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 don't have the faintest clue, actually. I can't find any evidence that the argument is actually used, but it's pasted all over the File providers. Is it some relic from some previous behavior of cached_attr ? -- 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.