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
|
guest = machine.guest
|
||||||
|
|
||||||
if guest.capability?(:apt_cacher_dir)
|
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|
|
machine.communicate.tap do |comm|
|
||||||
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
|
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
|
||||||
unless comm.test("test -L #{guest_path}")
|
unless comm.test("test -L #{guest_path}")
|
||||||
comm.sudo("rm -rf #{guest_path}")
|
comm.sudo("rm -rf #{guest_path}")
|
||||||
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
||||||
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
@env[:ui].info I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher')
|
@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
|
Skipping %{bucket} cache bucket as the guest machine does not support it
|
||||||
unknown_cache_scope: |-
|
unknown_cache_scope: |-
|
||||||
Unknown cache scope '%{cache_scope}' (allowed scopes: %{allowed})
|
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: |-
|
will_fix_machine_cache_dir: |-
|
||||||
A vagrant-cachier provider specific cache dir was found under
|
A vagrant-cachier provider specific cache dir was found under
|
||||||
'%{current_path}' and it will be moved to
|
'%{current_path}' and it will be moved to
|
||||||
|
|
Loading…
Reference in a new issue