Clean up SMB related errors
This commit is contained in:
parent
00fa50c296
commit
5a607d9248
|
@ -6,6 +6,10 @@ module VagrantPlugins
|
||||||
error_namespace("vagrant_sf_smb.errors")
|
error_namespace("vagrant_sf_smb.errors")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class SMBNotSupported < SMBError
|
||||||
|
error_key(:not_supported)
|
||||||
|
end
|
||||||
|
|
||||||
class DefineShareFailed < SMBError
|
class DefineShareFailed < SMBError
|
||||||
error_key(:define_share_failed)
|
error_key(:define_share_failed)
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,8 @@ require "log4r"
|
||||||
require "vagrant/util/platform"
|
require "vagrant/util/platform"
|
||||||
require "vagrant/util/powershell"
|
require "vagrant/util/powershell"
|
||||||
|
|
||||||
|
require_relative "errors"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module SyncedFolderSMB
|
module SyncedFolderSMB
|
||||||
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
|
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
|
||||||
|
@ -13,7 +15,6 @@ module VagrantPlugins
|
||||||
super
|
super
|
||||||
|
|
||||||
@logger = Log4r::Logger.new("vagrant::synced_folders::smb")
|
@logger = Log4r::Logger.new("vagrant::synced_folders::smb")
|
||||||
@creds = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def usable?(machine, raise_error=false)
|
def usable?(machine, raise_error=false)
|
||||||
|
@ -23,7 +24,7 @@ module VagrantPlugins
|
||||||
return true if machine.env.host.capability?(:smb_installed) &&
|
return true if machine.env.host.capability?(:smb_installed) &&
|
||||||
machine.env.host.capability(:smb_installed)
|
machine.env.host.capability(:smb_installed)
|
||||||
return false if !raise_error
|
return false if !raise_error
|
||||||
raise Vagrant::Errors::SMBNotSupported
|
raise Errors::SMBNotSupported
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare(machine, folders, opts)
|
def prepare(machine, folders, opts)
|
||||||
|
@ -53,13 +54,13 @@ module VagrantPlugins
|
||||||
data[:smb_password] ||= smb_password
|
data[:smb_password] ||= smb_password
|
||||||
|
|
||||||
# Register password as sensitive
|
# Register password as sensitive
|
||||||
Vagrant::Util::CredentialScrubber.sensitive(smb_password)
|
Vagrant::Util::CredentialScrubber.sensitive(data[:smb_password])
|
||||||
end
|
end
|
||||||
|
|
||||||
machine.env.host.capability(:smb_prepare, machine, folders, opts)
|
machine.env.host.capability(:smb_prepare, machine, folders, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable(machine, folders, nfsopts)
|
def enable(machine, folders, opts)
|
||||||
machine.ui.output(I18n.t("vagrant_sf_smb.mounting"))
|
machine.ui.output(I18n.t("vagrant_sf_smb.mounting"))
|
||||||
|
|
||||||
# Make sure that this machine knows this dance
|
# Make sure that this machine knows this dance
|
||||||
|
@ -99,10 +100,7 @@ module VagrantPlugins
|
||||||
ssh_info = machine.ssh_info
|
ssh_info = machine.ssh_info
|
||||||
|
|
||||||
folders.each do |id, data|
|
folders.each do |id, data|
|
||||||
data = data.dup
|
|
||||||
data[:smb_host] ||= host_ip
|
data[:smb_host] ||= host_ip
|
||||||
data[:smb_username] ||= @creds[:username]
|
|
||||||
data[:smb_password] ||= @creds[:password]
|
|
||||||
|
|
||||||
# Default the owner/group of the folder to the SSH user
|
# Default the owner/group of the folder to the SSH user
|
||||||
data[:owner] ||= ssh_info[:username]
|
data[:owner] ||= ssh_info[:username]
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
en:
|
en:
|
||||||
vagrant_sf_smb:
|
vagrant_sf_smb:
|
||||||
|
not_supported: |-
|
||||||
|
It appears your machine doesn't support SMB, or there is not an
|
||||||
|
adapter to enable SMB on this machine for Vagrant. Ensure SMB
|
||||||
|
host functionality is available on this machine and try again.
|
||||||
mounting: |-
|
mounting: |-
|
||||||
Mounting SMB shared folders...
|
Mounting SMB shared folders...
|
||||||
mounting_single: |-
|
mounting_single: |-
|
||||||
|
|
Loading…
Reference in New Issue