use smb username and password in synced_folders config if available instead of prompting

This commit is contained in:
Matt Wrock 2014-10-20 22:05:56 -07:00
parent 6986a8eeb2
commit 9671f00e3a
1 changed files with 6 additions and 4 deletions

View File

@ -45,15 +45,17 @@ module VagrantPlugins
script_path = File.expand_path("../scripts/set_share.ps1", __FILE__) script_path = File.expand_path("../scripts/set_share.ps1", __FILE__)
# If we need auth information, then ask the user. # If we need auth information, then ask the user.
need_auth = false have_auth = false
folders.each do |id, data| folders.each do |id, data|
if !data[:smb_username] || !data[:smb_password] if data[:smb_username] && data[:smb_password]
need_auth = true @creds[:username] = data[:smb_username]
@creds[:password] = data[:smb_password]
have_auth = true
break break
end end
end end
if need_auth if !have_auth
machine.ui.detail(I18n.t("vagrant_sf_smb.warning_password") + "\n ") machine.ui.detail(I18n.t("vagrant_sf_smb.warning_password") + "\n ")
@creds[:username] = machine.ui.ask("Username: ") @creds[:username] = machine.ui.ask("Username: ")
@creds[:password] = machine.ui.ask("Password (will be hidden): ", echo: false) @creds[:password] = machine.ui.ask("Password (will be hidden): ", echo: false)