Merge pull request #4228 from stvleung/fix-master-add-el7-nfs-support

hosts/redhat: use systemd for NFS on RH7+
This commit is contained in:
Mitchell Hashimoto 2014-08-05 17:44:35 -07:00
commit 4600963dc9
1 changed files with 6 additions and 4 deletions

View File

@ -22,10 +22,12 @@ module VagrantPlugins
release_file = Pathname.new("/etc/redhat-release") release_file = Pathname.new("/etc/redhat-release")
begin begin
release_file.open("r:ISO-8859-1:UTF-8") do |f| release_file.open("r:ISO-8859-1:UTF-8") do |f|
fedora_match = /Fedora.* release ([0-9]+)/.match(f.gets) match = /(Red Hat|CentOS|Fedora).* release ([0-9]+)/.match(f.gets)
if fedora_match if match
version_number = fedora_match[1].to_i distribution = match[1]
if version_number >= 16 version_number = match[2].to_i
if (distribution =~ /Fedora/ && version_number >= 16) ||
(distribution =~ /Red Hat|CentOS/ && version_number >= 7)
# "service nfs-server" will redirect properly to systemctl # "service nfs-server" will redirect properly to systemctl
# when "service nfs-server restart" is called. # when "service nfs-server restart" is called.
nfs_server_binary = "/usr/sbin/service nfs-server" nfs_server_binary = "/usr/sbin/service nfs-server"