hosts/freebsd: convert
This commit is contained in:
parent
a6c7cc481e
commit
4cec8b48d9
|
@ -0,0 +1,31 @@
|
|||
require "vagrant/util"
|
||||
require "vagrant/util/retryable"
|
||||
|
||||
require Vagrant.source_root.join("plugins", "hosts", "bsd", "cap", "nfs")
|
||||
|
||||
module VagrantPlugins
|
||||
module HostFreeBSD
|
||||
module Cap
|
||||
class NFS
|
||||
def self.nfs_export(environment, ui, id, ips, folders)
|
||||
folders.each do |folder_name, folder_values|
|
||||
if folder_values[:hostpath] =~ /\s+/
|
||||
raise Vagrant::Errors::VagrantError,
|
||||
_key: :freebsd_nfs_whitespace
|
||||
end
|
||||
end
|
||||
|
||||
HostBSD::Cap::NFS.nfs_export(environment, ui, id, ips, folders)
|
||||
end
|
||||
|
||||
def self.nfs_exports_template(environment)
|
||||
"nfs/exports_freebsd"
|
||||
end
|
||||
|
||||
def self.nfs_restart_command(environment)
|
||||
"sudo /etc/rc.d/mountd onereload"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,43 +1,12 @@
|
|||
require "vagrant"
|
||||
require 'vagrant/util/platform'
|
||||
|
||||
require Vagrant.source_root.join("plugins/hosts/bsd/host")
|
||||
|
||||
module VagrantPlugins
|
||||
module HostFreeBSD
|
||||
class Host < VagrantPlugins::HostBSD::Host
|
||||
class FreeBSDHostError < Vagrant::Errors::VagrantError
|
||||
error_namespace("vagrant.hosts.freebsd")
|
||||
end
|
||||
|
||||
include Vagrant::Util
|
||||
include Vagrant::Util::Retryable
|
||||
|
||||
def self.match?
|
||||
class Host < Vagrant.plugin("2", :host)
|
||||
def self.detect?(env)
|
||||
Vagrant::Util::Platform.freebsd?
|
||||
end
|
||||
|
||||
# Normal, mid-range precedence.
|
||||
def self.precedence
|
||||
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
|
||||
end
|
||||
|
|
|
@ -6,10 +6,26 @@ module VagrantPlugins
|
|||
name "FreeBSD host"
|
||||
description "FreeBSD host support."
|
||||
|
||||
host("freebsd") do
|
||||
require File.expand_path("../host", __FILE__)
|
||||
host("freebsd", "bsd") do
|
||||
require_relative "host"
|
||||
Host
|
||||
end
|
||||
|
||||
host_capability("freebsd", "nfs_export") do
|
||||
require_relative "cap/nfs"
|
||||
Cap::NFS
|
||||
end
|
||||
|
||||
# BSD-specific helpers
|
||||
host_capability("freebsd", "nfs_exports_template") do
|
||||
require_relative "cap/nfs"
|
||||
Cap::NFS
|
||||
end
|
||||
|
||||
host_capability("freebsd", "nfs_restart_command") do
|
||||
require_relative "cap/nfs"
|
||||
Cap::NFS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -379,6 +379,9 @@ en:
|
|||
Host port: %{host}
|
||||
Guest port: %{guest}
|
||||
Adapter: %{adapter}
|
||||
freebsd_nfs_whitespace: |-
|
||||
FreeBSD hosts do not support sharing directories with whitespace in
|
||||
their path. Please adjust your path accordingly.
|
||||
gem_command_in_bundler: |-
|
||||
You cannot run the `vagrant plugin` command while in a bundler environment.
|
||||
This should generally never happen unless Vagrant is installed outside
|
||||
|
@ -1345,10 +1348,6 @@ 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:
|
||||
|
|
Loading…
Reference in New Issue