>
>
> > +  def min_age
> > +    if ary = File.readlines("/etc/shadow").reject { |r| r =~
> /^[^\w]/}.collect { |l| l.split(':')[0..3] }.find { |user, _, _, minage|
> user == @resource[:name] }
> > +      minage = ary[3]
> > +    end
> > +    :absent
> > +  end
> > +
> > +  def max_age
> > +    if ary = File.readlines("/etc/shadow").reject { |r| r =~
> /^[^\w]/}.collect { |l| l.split(':')[0..3] }.find { |user, _, _, _, maxage|
> user == @resource[:name] }
> > +      maxage = ary[4]
>
> This doesn't look like it would actually work?  Wouldn't the "[0..3]"
> need to be "[0..4]" here, since you're looking for "ary[4]"? Which leads
> me to believe that this line isn't actually being tested, unless I'm
> completely misunderstanding it.
>

That would be a mistake caused by the wonder of copy-paste, yep. Thanks for
catching it. I would really like to do this another way anyway, as I really
don't like reading and rewriting /etc/shadow, but I'm following the
precedent set by the code above which finds the password.


> Also: Might be worth putting a space before the closing } on the reject,
> since it gets lost in the line there, and I had to scan a couple of
> times to find it.


Good point. I'll squash in those two changes.

-- 
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.

Reply via email to