[Pdns-users] CM (Chef) and automatic downloading of packages

Nick Douma n.douma at nekoconeko.nl
Thu Jan 5 10:22:52 UTC 2017


In December Bert tweeted the thing about the huge amount of packages
downloaded by users.


It seems that my servers were responsible for at least part of the
traffic. I'm using Chef 12 with the remote_file resource to
automatically check if a new package is available, and if so, download
and install it:

remote_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
    source "#{package_base}/#{pkg}"
    action :create

Chef is by default configured to use ETag and Last-Modified headers to
determine if a file needs to be downloaded based on the file that is
already present on the system.

The Last-Modified header mechanism doesn't seem to work properly. I
wasn't able to determine if this is something on my end (Chef) or your
end (nginx). Regardless, the following addition disables the
Last-Modified checking and just uses the ETag:

remote_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
    source "#{package_base}/#{pkg}"
    use_last_modified false
    action :create

This may be of use to other users of Chef and similar systems.

Kind regards,

Nick Douma

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20170105/b6b9d4c9/attachment.sig>

More information about the Pdns-users mailing list