Prevent apt cacher bucket from being installed in case NFS is disabled
This commit is contained in:
parent
f38db9efc4
commit
e0eeb125d0
2 changed files with 15 additions and 8 deletions
|
@ -12,17 +12,21 @@ module VagrantPlugins
|
|||
guest = machine.guest
|
||||
|
||||
if guest.capability?(:apt_cacher_dir)
|
||||
guest_path = guest.capability(:apt_cacher_dir)
|
||||
if machine.config.cache.enable_nfs
|
||||
guest_path = guest.capability(:apt_cacher_dir)
|
||||
|
||||
@env[:cache_dirs] << guest_path
|
||||
@env[:cache_dirs] << guest_path
|
||||
|
||||
machine.communicate.tap do |comm|
|
||||
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
|
||||
unless comm.test("test -L #{guest_path}")
|
||||
comm.sudo("rm -rf #{guest_path}")
|
||||
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
||||
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
||||
machine.communicate.tap do |comm|
|
||||
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
|
||||
unless comm.test("test -L #{guest_path}")
|
||||
comm.sudo("rm -rf #{guest_path}")
|
||||
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
||||
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
||||
end
|
||||
end
|
||||
else
|
||||
@env[:ui].info I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher')
|
||||
end
|
||||
else
|
||||
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher')
|
||||
|
|
|
@ -6,6 +6,9 @@ en:
|
|||
Skipping %{bucket} cache bucket as the guest machine does not support it
|
||||
unknown_cache_scope: |-
|
||||
Unknown cache scope '%{cache_scope}' (allowed scopes: %{allowed})
|
||||
nfs_required: |-
|
||||
The '%{bucket}' cache bucket requires NFS to be enabled, please add
|
||||
`config.cache.enable_nfs = true` to your Vagrantfile.
|
||||
will_fix_machine_cache_dir: |-
|
||||
A vagrant-cachier provider specific cache dir was found under
|
||||
'%{current_path}' and it will be moved to
|
||||
|
|
Loading…
Reference in a new issue