provisioners/chef: synced_folder_type

This commit is contained in:
Mitchell Hashimoto 2014-01-02 14:40:57 -08:00
parent 1da271c536
commit 040e1a2e0a
3 changed files with 28 additions and 9 deletions

View File

@ -2,6 +2,9 @@
DEPRECATIONS:
- provisioners/chef-solo: The "nfs" setting has been replaced by
`synced_folder_type`. The "nfs" setting will be removed in the next
version.
- provisioners/puppet: The "nfs" setting has been replaced by
`synced_folder_type`. The "nfs" setting will be removed in the next
version.
@ -12,6 +15,9 @@ FEATURES:
IMPROVEMENTS:
- provisioners/chef-solo: New config `synced_folder_type` replaces the
`nfs` option. This can be used to set the synced folders the provisioner
needs to any type. [GH-2709]
- provisioners/puppet: New config `synced_folder_type` replaces the
`nfs` option. This can be used to set the synced folders the provisioner
needs to any type. [GH-2709]

View File

@ -10,9 +10,9 @@ module VagrantPlugins
attr_accessor :encrypted_data_bag_secret
attr_accessor :environments_path
attr_accessor :environment
attr_accessor :nfs
attr_accessor :recipe_url
attr_accessor :roles_path
attr_accessor :synced_folder_type
def initialize
super
@ -23,11 +23,23 @@ module VagrantPlugins
@environment = UNSET_VALUE
@recipe_url = UNSET_VALUE
@roles_path = UNSET_VALUE
@nfs = UNSET_VALUE
@synced_folder_type = UNSET_VALUE
@encrypted_data_bag_secret = UNSET_VALUE
@encrypted_data_bag_secret_key_path = UNSET_VALUE
end
def nfs=(value)
puts "DEPRECATION: The 'nfs' setting for the Puppet provisioner is"
puts "deprecated. Please use the 'synced_folder_type' setting instead."
puts "The 'nfs' setting will be removed in the next version of Vagrant."
if value
@synced_folder_type = "nfs"
else
@synced_folder_type = nil
end
end
#------------------------------------------------------------
# Internal methods
#------------------------------------------------------------
@ -35,8 +47,9 @@ module VagrantPlugins
def finalize!
super
@recipe_url = nil if @recipe_url == UNSET_VALUE
@environment = nil if @environment == UNSET_VALUE
@recipe_url = nil if @recipe_url == UNSET_VALUE
@synced_folder_type = nil if @synced_folder_type == UNSET_VALUE
if @cookbooks_path == UNSET_VALUE
@cookbooks_path = []
@ -55,7 +68,6 @@ module VagrantPlugins
@roles_path = prepare_folders_config(@roles_path)
@environments_path = prepare_folders_config(@environments_path)
@nfs = false if @nfs == UNSET_VALUE
@encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret" if \
@encrypted_data_bag_secret == UNSET_VALUE
@encrypted_data_bag_secret_key_path = nil if \
@ -76,7 +88,7 @@ module VagrantPlugins
path = Pathname.new(raw_path).expand_path(machine.env.root_path)
if !path.directory?
errors << I18n.t("vagrant.config.chef.environment_path_missing",
path: raw_path.to_s)
path: raw_path.to_s)
end
end

View File

@ -106,10 +106,11 @@ module VagrantPlugins
def share_folders(root_config, prefix, folders)
folders.each do |type, local_path, remote_path|
if type == :host
root_config.vm.synced_folder(
local_path, remote_path,
:id => "v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}",
:nfs => @config.nfs)
opts = {}
opts[:id] = "v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}"
opts[:type] = @config.synced_folder_type if @config.synced_folder_type
root_config.vm.synced_folder(local_path, remote_path, opts)
end
end
end