From 1fc36d2d3aeec8b39b5c31f16d6b8514282588c2 Mon Sep 17 00:00:00 2001 From: Steven Leung Date: Mon, 21 Jul 2014 10:50:52 -0700 Subject: [PATCH] =?UTF-8?q?Redhat=207=20to=20use=20systemd=20as=20well=20?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change nfs plugin to detect distribution and version Fixes issue #4227 --- plugins/hosts/redhat/cap/nfs.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/hosts/redhat/cap/nfs.rb b/plugins/hosts/redhat/cap/nfs.rb index 4c11e2d07..edcabe21c 100644 --- a/plugins/hosts/redhat/cap/nfs.rb +++ b/plugins/hosts/redhat/cap/nfs.rb @@ -22,10 +22,12 @@ module VagrantPlugins release_file = Pathname.new("/etc/redhat-release") begin release_file.open("r:ISO-8859-1:UTF-8") do |f| - fedora_match = /Fedora.* release ([0-9]+)/.match(f.gets) - if fedora_match - version_number = fedora_match[1].to_i - if version_number >= 16 + match = /(Red Hat|CentOS|Fedora).* release ([0-9]+)/.match(f.gets) + if match + distribution = match[1] + 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 # when "service nfs-server restart" is called. nfs_server_binary = "/usr/sbin/service nfs-server"