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

rjl
2010-12-20T15:58:22Z

Thanks to everyone for all of your input. It was very helpful. I like
Felix''s suggestion about writing a plugin.

rjl

On Dec 20, 5:03 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:
> 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