Hi,
On 02/28/2012 04:58 PM, Craig White wrote:
> Object: to get a custom fact that lets me know the last time a Ubuntu system
> had run 'upgrade' (ie apt-get upgrade or aptitude [safe-|full-]upgrade)
>
> One-liner: (will probably still need some adaptation but so far, I am doing)
> tac /var/log/apt/history.log | \
> awk '{if (substr($0,1,8)=="Upgrade:") { getline; print }}' \
> | head -n 1
>
> which will return something like: 'Start-Date: 2011-11-21 23:51:47' which I
> can cut the date out of and store as a custom fact - ie... last_upgrade:
>
> The problem is that the logs rotate and now this may be in
> /var/log/apt/history.2.gz or possibly get rotated out of existence altogether
> and while I can loop and search for the last time an upgrade was run, I may
> not actually be able to get that date and would want the last_upgrade to
> persist.
yes, you don't want to retrieve this kind of info from system logs, I
believe.
> Now I could conceivably store this value in say /var/lib/puppet/last_upgrade
> so I always have a fallback, I'm wondering if there isn't a better way.
> Comments - Ideas?
This is not a puppet related piece of information, so I wouldn't place
it in this tree.
Is it possible to define hooks for aptitude operations? If so, it would
seem cleanest to me to make aptitude itself update a persistent log that
can serve as a basis for your inventory.
Cheers,
Felix
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.