- From: Bryan Berry <
>
- To:
- Subject: [chef] Re: Re: new sudo lwrp for managing sudoers fragments
- Date: Sat, 7 Jan 2012 16:35:19 +0100
the simplest solution would be to do a checksum on the rendered
template and compare it to the file currently in place. If they are
different, overwrite the sudoers fragment in /etc/sudoers.d/ and call
new_resource.updated_by_last_action(true). If they are not different
I wouldn't overwrite the fragment currently in use and also wouldn't
call new_resource.updated_by_last_action(true) at all.
Does that sound right?
Also, should I invoke new_resource.updated_by_last_action(false) if
the template hasn't changed?
On Sat, Jan 7, 2012 at 4:25 PM, Bryan Berry
<
>
wrote:
>
that is correct, render_sudo_attributes does write the file every
>
time. I hadn't figured out how to avoid this behavior. Thanks for the
>
suggestion into using a checksum. I will look into it
>
>
>
On Sat, Jan 7, 2012 at 4:20 PM, Brian Akins
>
<
>
>
wrote:
>
>
>
> On Jan 6, 2012, at 1:15 PM, Bryan Berry wrote:
>
>>
>
>> It now has a much simpler api . Comments, criticism would be much
>
>> appreciated
>
>
>
> Only on my 2nd cup of coffee, but it looks like render_sudo_attributes
>
> writes the file every time and marks itself as updated.
>
>
>
> render_sudo_template also marks it self as updated every run, even though
>
> template may not.
>
>
>
> The could called unexpected behaviors with notifies and subscribes when
>
> using these.
>
>
>
> You could generate the file as you do know, but do a checksum and only
>
> move the file into place if it's different.
>
>
>
> --Brian
>
>
Archive powered by MHonArc 2.6.16.