How do I get execution/run time in Puppet 5.3 for use in .epp template?

asked 2018-10-17 16:26:30 -0600

DH gravatar image

Was able to use @_timestamp in old .erb template with Puppet 3.8 (I think). Now have Puppet 5.3 and would like to use .epp template. What is the correct/preferred why to do that now? Want to keep a log of when various modules have been run on each system.

edit retag flag offensive close merge delete

Comments

1

Well you can always generate https://puppet.com/docs/puppet/latest/function.html#generate your timestamp formatted the way you prefer. In Ruby I would have written Time.new().utc().to_s() instead of @_timestamp. The latter isn't documented. As a general principle, do not use undocumented behaviors.

Kai Burghardt gravatar imageKai Burghardt ( 2018-10-18 13:38:36 -0600 )edit

See also https://puppet.com/docs/puppet/3.8/deprecated_misc.html#the-hidden-timestamp-fact . Although Puppet has a Timestamp data type built-in, I haven't found any described behavior giving you the chance to retrieve the time as of evaluation.

Kai Burghardt gravatar imageKai Burghardt ( 2018-10-18 13:41:48 -0600 )edit