Disable the plugin on machines backed by cloud providers (fix GH-45)
This commit is contained in:
parent
09d65c4a3c
commit
0106155a0f
3 changed files with 20 additions and 1 deletions
|
@ -28,6 +28,12 @@ module VagrantPlugins
|
||||||
def validate(machine)
|
def validate(machine)
|
||||||
errors = _detected_errors
|
errors = _detected_errors
|
||||||
|
|
||||||
|
if enabled? && backed_by_cloud_provider?(machine)
|
||||||
|
machine.ui.warn(I18n.t('vagrant_cachier.backed_by_cloud_provider',
|
||||||
|
provider: machine.provider_name))
|
||||||
|
disable!
|
||||||
|
end
|
||||||
|
|
||||||
if enabled? && ! ALLOWED_SCOPES.include?(@scope.to_s)
|
if enabled? && ! ALLOWED_SCOPES.include?(@scope.to_s)
|
||||||
errors << I18n.t('vagrant_cachier.unknown_cache_scope',
|
errors << I18n.t('vagrant_cachier.unknown_cache_scope',
|
||||||
allowed: ALLOWED_SCOPES.inspect,
|
allowed: ALLOWED_SCOPES.inspect,
|
||||||
|
@ -55,6 +61,12 @@ module VagrantPlugins
|
||||||
@synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE
|
@synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE
|
||||||
@buckets = @buckets ? @buckets.dup : {}
|
@buckets = @buckets ? @buckets.dup : {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def backed_by_cloud_provider?(machine)
|
||||||
|
CLOUD_PROVIDERS.include?(machine.provider_name.to_s)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,12 +11,16 @@ module VagrantPlugins
|
||||||
module Cachier
|
module Cachier
|
||||||
class Plugin < Vagrant.plugin('2')
|
class Plugin < Vagrant.plugin('2')
|
||||||
name 'vagrant-cachier'
|
name 'vagrant-cachier'
|
||||||
|
|
||||||
config 'cache' do
|
config 'cache' do
|
||||||
require_relative "config"
|
require_relative "config"
|
||||||
Config
|
Config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Keep an eye on https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins#wiki-providers
|
||||||
|
# for more.
|
||||||
|
CLOUD_PROVIDERS = %w( aws cloudstack digitalocean hp joyent openstack rackspace
|
||||||
|
softlayer proxmox managed virtualbox )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,3 +16,6 @@ en:
|
||||||
scoped cache dirs starting with the 0.3.0 version of the plugin.
|
scoped cache dirs starting with the 0.3.0 version of the plugin.
|
||||||
unable_to_ssh: |-
|
unable_to_ssh: |-
|
||||||
vagrant-cachier was unable to SSH into the VM to remove symlinks!
|
vagrant-cachier was unable to SSH into the VM to remove symlinks!
|
||||||
|
backed_by_cloud_provider: |-
|
||||||
|
The machine is backed by a cloud provider (%{provider}), caching
|
||||||
|
will be disabled.
|
||||||
|
|
Loading…
Reference in a new issue