Jaymon / chef-cookbooks

Various Chef cookbooks
MIT License
2 stars 0 forks source link

package cookbook changes #4

Open Jaymon opened 5 years ago

Jaymon commented 5 years ago

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

Jaymon commented 4 years ago

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