From 9671f00e3a16c117fe2b9947cedfc26dbff28339 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Mon, 20 Oct 2014 22:05:56 -0700 Subject: [PATCH 1/2] use smb username and password in synced_folders config if available instead of prompting --- plugins/synced_folders/smb/synced_folder.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/synced_folders/smb/synced_folder.rb b/plugins/synced_folders/smb/synced_folder.rb index 8e700a183..e3f5a1af2 100644 --- a/plugins/synced_folders/smb/synced_folder.rb +++ b/plugins/synced_folders/smb/synced_folder.rb @@ -45,15 +45,17 @@ module VagrantPlugins script_path = File.expand_path("../scripts/set_share.ps1", __FILE__) # If we need auth information, then ask the user. - need_auth = false + have_auth = false folders.each do |id, data| - if !data[:smb_username] || !data[:smb_password] - need_auth = true + if data[:smb_username] && data[:smb_password] + @creds[:username] = data[:smb_username] + @creds[:password] = data[:smb_password] + have_auth = true break end end - if need_auth + if !have_auth machine.ui.detail(I18n.t("vagrant_sf_smb.warning_password") + "\n ") @creds[:username] = machine.ui.ask("Username: ") @creds[:password] = machine.ui.ask("Password (will be hidden): ", echo: false) From 461f6f1281d4ec5f086aaec0b3965d9e16035e77 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Mon, 20 Oct 2014 23:13:13 -0700 Subject: [PATCH 2/2] do not automatically add /vagrant synced folder if another folder is already assigned to current path --- plugins/kernel_v2/config/vm.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 31af48df7..ccebfdede 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -429,12 +429,7 @@ module VagrantPlugins p.run = p.run.to_sym if p.run end - # If we didn't share our current directory, then do it - # manually. - if !@__synced_folders["/vagrant"] - synced_folder(".", "/vagrant") - end - + current_dir_shared = false @__synced_folders.each do |id, options| if options[:nfs] options[:type] = :nfs @@ -444,6 +439,14 @@ module VagrantPlugins if options[:type] == :nfs && Vagrant::Util::Platform.windows? options.delete(:type) end + + if options[:hostpath] == '.' + current_dir_shared = true + end + end + + if !current_dir_shared && !@__synced_folders["/vagrant"] + synced_folder(".", "/vagrant") end # Flag that we finalized