Do not allow BSD hosts to double-quote in exports
This is not allowed on *BSD
This commit is contained in:
parent
0ec02fe711
commit
2d327055f3
|
@ -24,6 +24,7 @@ module Vagrant
|
|||
|
||||
@logger = Log4r::Logger.new("vagrant::hosts::bsd")
|
||||
@nfs_restart_command = "sudo nfsd restart"
|
||||
@nfs_exports_template = "nfs/exports"
|
||||
end
|
||||
|
||||
def nfs?
|
||||
|
@ -33,7 +34,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def nfs_export(id, ip, folders)
|
||||
output = TemplateRenderer.render('nfs/exports',
|
||||
output = TemplateRenderer.render(@nfs_exports_template,
|
||||
:uuid => id,
|
||||
:ip => ip,
|
||||
:folders => folders)
|
||||
|
|
|
@ -4,6 +4,10 @@ module Vagrant
|
|||
module Hosts
|
||||
# Represents a FreeBSD host
|
||||
class FreeBSD < BSD
|
||||
class FreeBSDHostError < Errors::VagrantError
|
||||
error_namespace("vagrant.hosts.freebsd")
|
||||
end
|
||||
|
||||
include Util
|
||||
include Util::Retryable
|
||||
|
||||
|
@ -16,10 +20,21 @@ module Vagrant
|
|||
5
|
||||
end
|
||||
|
||||
def nfs_export(id, ip, folders)
|
||||
folders.each do |folder_name, folder_values|
|
||||
if folder_values[:hostpath] =~ /\s+/
|
||||
raise FreeBSDHostError, :_key => :nfs_whitespace
|
||||
end
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
|
||||
@nfs_restart_command = "sudo /etc/rc.d/mountd onereload"
|
||||
@nfs_exports_template = "nfs/exports_freebsd"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -554,6 +554,10 @@ en:
|
|||
arch:
|
||||
nfs_export:
|
||||
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
|
||||
freebsd:
|
||||
nfs_whitespace: |-
|
||||
FreeBSD hosts do not support sharing directories with whitespace in
|
||||
their path. Please adjust your path accordingly.
|
||||
|
||||
provisioners:
|
||||
chef:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# VAGRANT-BEGIN: <%= uuid %>
|
||||
<% folders.each do |name, opts| %>
|
||||
<%= opts[:hostpath] %> <%= ip %><% if opts[:map_uid] -%> -alldirs -mapall=<%= [opts[:map_uid],opts[:map_gid]].compact.join(":") %><% end -%>
|
||||
<% end %>
|
||||
# VAGRANT-END: <%= uuid %>
|
Loading…
Reference in New Issue