Jaymon / chef-cookbooks

Various Chef cookbooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

package cookbook changes

Jaymon opened this issue · comments

Right now package::update creates a temp file to decide if it should run again, today I found out apt-get already does that with /var/lib/apt/periodic/update-success-stamp, you can check the modified date to see when it was last run (the file itself is empty).

It would also be cool if package::update could monitor /etc/apt/sources.list or /etc/apt/sources.list.d and if those were changed since it was last run it would go ahead and run it apt-get update anyway regardless of when it was last run, this could be done by keeping my sentinel file but adding values like how many files are in sources.list.d and the md5 hash of sources.list and if either of those are different it would run it again

http://manpages.ubuntu.com/manpages/trusty/man1/add-apt-repository.1.html

Turns out Chef's apt_package resource has a frequency property, so you could do this:

apt_package "update packages" do
  action :periodic
  frequency 86400 * 30 # every 30 days
end

I was going to change it end of March 2020 but decided against it because we use the sentinel files for the other package recipes also and so I left everything as is