Search code examples
vagrantchef-infraberkshelf

Chef template file file not found


My vagrant failed when provisioning with template.

template "/var/.s3cfg" do
  source "s3cfg.erb"
  owner "root"
  group "root"
  mode "0644"
end

in that cookbook directory, file templates/default/s3cfg.erb exists.

But strangely it's work successfully on opswork amazon, so it might be vagrant, vagrant-cachier, vagrant-berkshelf, berkshelf, or chef error.

Any idea how to check?

My environment:

$: vagrant -v
Vagrant 1.6.5

$: vagrant plugin list
vagrant-berkshelf (3.0.1)
vagrant-cachier (0.9.0)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.1, system)

$: chef -v
Chef Development Kit Version: 0.2.2

$: berks -v
3.1.5

vagrant box is ubuntu-precise 12.04


Solution

  • Apparently the cause is because chef default location of provisioning path located at /tmp/vagrant-chef. In the middle of the chef execution, somehow the /tmp/ folder cleaned. Hence the missing file.

    By changing the location of chef.provisioning_path to other folder than /tmp/, it worked normally.