Skip to content

Commit

Permalink
Add a synced folder to persist chef omnibus packages
Browse files Browse the repository at this point in the history
Signed-off-by: Salim Afiune <[email protected]>
  • Loading branch information
Salim Afiune committed Nov 14, 2016
1 parent a3fdf32 commit 2704f1b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ def finalize_config!(instance)
finalize_vm_hostname!
finalize_pre_create_command!
finalize_synced_folders!
# Verify if we are using the Provisioner::ChefBase that now has a config
# parameter for the Chef omnibus cache, if that is set then we would like
# to sync a local folder to the instance so we can take advantage of the
# cache packages that we might have, therefore we wont download a package
# we already have in the cache
if instance && instance.provisioner[:chef_omnibus_cache]
FileUtils.mkdir_p(local_kitchen_cache)
config[:synced_folders].push([
local_kitchen_cache,
instance.provisioner[:chef_omnibus_cache],
"create: true"
])
end
self
end

Expand Down Expand Up @@ -389,6 +402,12 @@ def update_state(state)
state[:rdp_port] = hash["RDPPort"] if hash["RDPPort"]
end

# @return [String] full absolute path to the kitchen cache directory
# @api private
def local_kitchen_cache
@local_kitchen_cache ||= File.expand_path('~/.kitchen/cache')
end

# @return [String] full local path to the directory containing the
# instance's Vagrantfile
# @api private
Expand Down

0 comments on commit 2704f1b

Please sign in to comment.