From bbdbc5beba2a8e4fddc56ec87939ca904848444b Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Tue, 11 Jun 2013 20:16:06 -0300 Subject: [PATCH] Add support for using NFS for root cache folder --- CHANGELOG.md | 4 ++++ development/Vagrantfile | 5 +++++ lib/vagrant-cachier/action.rb | 3 ++- lib/vagrant-cachier/config.rb | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1339eb7..934b3cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 0.1.1 (unreleased) +IMPROVEMENTS: + + - Support enabling NFS for root cache folder. [GH-7] + ## 0.1.0 (June 9, 2013) IMPROVEMENTS: diff --git a/development/Vagrantfile b/development/Vagrantfile index d39ea0a..919e523 100644 --- a/development/Vagrantfile +++ b/development/Vagrantfile @@ -9,6 +9,11 @@ Vagrant.configure("2") do |config| config.cache.scope = :machine config.cache.auto_detect = true + config.cache.enable_nfs = true + + config.vm.provider :virtualbox do |_, vb| + vb.vm.network :private_network, ip: "192.168.50.123" + end debian_like_configs = lambda do |debian| debian.vm.provision :shell, inline: ' diff --git a/lib/vagrant-cachier/action.rb b/lib/vagrant-cachier/action.rb index 3a2b47b..631da9b 100644 --- a/lib/vagrant-cachier/action.rb +++ b/lib/vagrant-cachier/action.rb @@ -16,7 +16,8 @@ module VagrantPlugins FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist? - env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', id: "vagrant-cache" + nfs_flag = env[:machine].config.cache.enable_nfs + env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', id: "vagrant-cache", nfs: nfs_flag @app.call env diff --git a/lib/vagrant-cachier/config.rb b/lib/vagrant-cachier/config.rb index bcc5715..b3fcda0 100644 --- a/lib/vagrant-cachier/config.rb +++ b/lib/vagrant-cachier/config.rb @@ -1,12 +1,13 @@ module VagrantPlugins module Cachier class Config < Vagrant.plugin(2, :config) - attr_accessor :scope, :auto_detect + attr_accessor :scope, :auto_detect, :enable_nfs attr_reader :buckets def initialize @scope = UNSET_VALUE @auto_detect = UNSET_VALUE + @enable_nfs = UNSET_VALUE end def enable(bucket, opts = {}) @@ -18,6 +19,7 @@ module VagrantPlugins @scope = :box if @scope == UNSET_VALUE @auto_detect = false if @auto_detect == UNSET_VALUE + @enable_nfs = false if @enable_nfs == UNSET_VALUE @buckets = @buckets ? @buckets.dup : {} end