Every time I run kitchen verify for the first time after creating a box, it needs to download the chef-client. E.g:
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.4.1-1.el6.x86_64.rpm
to file /tmp/install.sh.2340/chef-12.4.1-1.el6.x86_64.rpm
I have a poor Internet connection so this takes a long time. Is there a simple way to cache the RPM so I don't have to download it each time?
I haven't been able to cache the RPM through Kitchen, but I have solved the problem by downloading the file myself and providing it to Kitchen.
.kitchen.yml
. e.g. chef-pkgs
/tmp
directory, so set up a synced folder in your .kitchen.yml
with the chef-pkgs
folder. Example:Example .kitchen.yml
:
driver:
name: vagrant
vagrantfiles:
- Vagrantfile
synced_folders:
- ["./chef-pkgs", "/tmp/chef-pkgs"]
provisioner:
name: chef_zero
require_chef_omnibus: 12.4.1
chef_omnibus_url: file:///tmp/chef-pkgs/install.sh
install.sh
file in your chef-pkgs
folder that installs the RPM from the cached location.Example install.sh
:
#! /bin/bash
sudo rpm -ivh /tmp/chef-pkgs/chef-12.4.1-1.el6.x86_64.rpm
I got the idea and code from this helpful blog post: http://erichelgeson.github.io/blog/2014/09/23/simple-chef-package-cache/
I added the chef-pkgs
folder to my .gitignore
file.