Display enable_nfs deprecation warning only once

This commit is contained in:
Fabio Rehm 2014-02-01 02:57:51 -02:00
parent 5c35320800
commit 77def39754

View file

@ -10,6 +10,7 @@ module VagrantPlugins
@scope = UNSET_VALUE @scope = UNSET_VALUE
@auto_detect = UNSET_VALUE @auto_detect = UNSET_VALUE
@synced_folder_opts = UNSET_VALUE @synced_folder_opts = UNSET_VALUE
@ui = Vagrant::UI::Colored.new
end end
def enable(bucket, opts = {}) def enable(bucket, opts = {})
@ -17,18 +18,15 @@ module VagrantPlugins
end end
def enable_nfs=(value) def enable_nfs=(value)
# Flag to raise warning on #validate # TODO: Show warning!!!
@_enable_nfs_set = true @ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \
"and will be removed on 0.7.0, please use " \
"`synced_folder_opts = { type: 'nfs' }` instead.\n"
@synced_folder_opts = { type: 'nfs', nfs: true } if value @synced_folder_opts = { type: 'nfs', nfs: true } if value
end end
def validate(machine) def validate(machine)
if @_enable_nfs_set
machine.ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \
"and will be removed on 0.7.0, please use " \
"`synced_folder_opts = { type: 'nfs' }` instead."
end
errors = _detected_errors errors = _detected_errors
if enabled? && ! ALLOWED_SCOPES.include?(@scope.to_s) if enabled? && ! ALLOWED_SCOPES.include?(@scope.to_s)