Re: [Puppet Users] Update time in template file.

Felix Frank
2010-12-20T12:03:51Z

On 12/19/2010 10:16 PM, rjl wrote:
> Hi all,
> How can I put in an update time in a template file? The problem I am
> running it to is this...
>
> Here is my file to update the timestamp
>
> snmp.conf.erb
>
> # HEADER: [ <%= Time.now.gmtime %> ] Modified by puppet.
> defVersion 2c
> devCommunity somecommunity
>
>
> The problem is that everytime puppet runs, it updates the time stamp.
> I only want it to update if there was an actual change to the content
> of the file
>
> Thanks in advace.
>
> rjl

Hi,

a template probably won''t do this for you. Whenever puppet generates
your client''s catalog, the template text is put into that. So if the
master generates the header, it will produce a different catalog each time.

The most simple thing would be for you to rely on the mtime instead.
This has some drawbacks, of course.

If the template is simple enough (and, unlike me, you know some ruby),
it may be feasible to write a simple plugin instead. That way, you *can*
limit header generation to times when there are actual changes.

HTH,
Felix