Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[OC-4782] persist `Chef::Config[:file_cache_path]` between Vagrant VMs

  • Loading branch information...
commit 7650e8da1660549d7e559bff8a83fcc0bd345457 1 parent 658d19d
@schisamo schisamo authored
Showing with 15 additions and 1 deletion.
  1. +1 −0  .gitignore
  2. +13 −1 Vagrantfile
  3. +1 −0  chefignore
View
1  .gitignore
@@ -1,4 +1,5 @@
.bundle
+.cache
.vagrant
Berksfile.lock
Gemfile.lock
View
14 Vagrantfile
@@ -1,6 +1,16 @@
require 'berkshelf/vagrant'
+# We'll mount the Chef::Config[:file_cache_path] so it persists between
+# Vagrant VMs
+host_cache_path = File.expand_path("../.cache", __FILE__)
+guest_cache_path = "/tmp/vagrant-cache"
+
+# ensure the cache path exists
+FileUtils.mkdir(host_cache_path) unless File.exist?(host_cache_path)
+
Vagrant::Config.run do |config|
+ # TODO REMOVE THIS WHEN WE FORCE SMP MODE IN ERCHEF
+ config.vm.customize ["modifyvm", :id, "--cpus", 2]
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@@ -43,7 +53,7 @@ Vagrant::Config.run do |config|
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
- # config.vm.share_folder "v-data", "/vagrant_data", "../data"
+ config.vm.share_folder "cache", guest_cache_path, host_cache_path
config.ssh.max_tries = 40
config.ssh.timeout = 120
@@ -52,6 +62,7 @@ Vagrant::Config.run do |config|
config.ssh.forward_agent = true
config.vm.provision :chef_solo do |chef|
+ chef.provisioning_path = guest_cache_path
chef.json = {
"chef-server" => {
@@ -62,4 +73,5 @@ Vagrant::Config.run do |config|
"recipe[chef-server::default]"
]
end
+
end
View
1  chefignore
@@ -50,3 +50,4 @@ cookbooks/*
# Vagrant
.vagrant
+.cache
Please sign in to comment.
Something went wrong with that request. Please try again.