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")
|
@logger = Log4r::Logger.new("vagrant::hosts::bsd")
|
||||||
@nfs_restart_command = "sudo nfsd restart"
|
@nfs_restart_command = "sudo nfsd restart"
|
||||||
|
@nfs_exports_template = "nfs/exports"
|
||||||
end
|
end
|
||||||
|
|
||||||
def nfs?
|
def nfs?
|
||||||
|
@ -33,7 +34,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def nfs_export(id, ip, folders)
|
def nfs_export(id, ip, folders)
|
||||||
output = TemplateRenderer.render('nfs/exports',
|
output = TemplateRenderer.render(@nfs_exports_template,
|
||||||
:uuid => id,
|
:uuid => id,
|
||||||
:ip => ip,
|
:ip => ip,
|
||||||
:folders => folders)
|
:folders => folders)
|
||||||
|
|
|
@ -4,6 +4,10 @@ module Vagrant
|
||||||
module Hosts
|
module Hosts
|
||||||
# Represents a FreeBSD host
|
# Represents a FreeBSD host
|
||||||
class FreeBSD < BSD
|
class FreeBSD < BSD
|
||||||
|
class FreeBSDHostError < Errors::VagrantError
|
||||||
|
error_namespace("vagrant.hosts.freebsd")
|
||||||
|
end
|
||||||
|
|
||||||
include Util
|
include Util
|
||||||
include Util::Retryable
|
include Util::Retryable
|
||||||
|
|
||||||
|
@ -16,10 +20,21 @@ module Vagrant
|
||||||
5
|
5
|
||||||
end
|
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)
|
def initialize(*args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@nfs_restart_command = "sudo /etc/rc.d/mountd onereload"
|
@nfs_restart_command = "sudo /etc/rc.d/mountd onereload"
|
||||||
|
@nfs_exports_template = "nfs/exports_freebsd"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -554,6 +554,10 @@ en:
|
||||||
arch:
|
arch:
|
||||||
nfs_export:
|
nfs_export:
|
||||||
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
|
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:
|
provisioners:
|
||||||
chef:
|
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