diff --git a/plugins/hosts/fedora/host.rb b/plugins/hosts/redhat/host.rb similarity index 65% rename from plugins/hosts/fedora/host.rb rename to plugins/hosts/redhat/host.rb index c8fef743c..f6a92401a 100644 --- a/plugins/hosts/fedora/host.rb +++ b/plugins/hosts/redhat/host.rb @@ -5,7 +5,7 @@ require "vagrant" require Vagrant.source_root.join("plugins/hosts/linux/host") module VagrantPlugins - module HostFedora + module HostRedHat class Host < VagrantPlugins::HostLinux::Host def self.match? release_file = Pathname.new("/etc/redhat-release") @@ -13,9 +13,10 @@ module VagrantPlugins if release_file.exist? release_file.open("r:ISO-8859-1:UTF-8") do |f| contents = f.gets - return true if contents =~ /^Fedora/ - return true if contents =~ /^CentOS/ - return true if contents =~ /^Red Hat Enterprise Linux Server/ + return true if contents =~ /^Fedora/ # Fedora + return true if contents =~ /^CentOS/ # CentOS + return true if contents =~ /^Enterprise Linux Enterprise Linux/ # Oracle Linux < 5.3 + return true if contents =~ /^Red Hat Enterprise Linux/ # Red Hat Enterprise Linux and Oracle Linux >= 5.3 end end @@ -37,11 +38,14 @@ module VagrantPlugins release_file = Pathname.new("/etc/redhat-release") begin release_file.open("r:ISO-8859-1:UTF-8") do |f| - version_number = /(CentOS|Fedora|Red Hat Enterprise Linux Server).*release ([0-9]+)/.match(f.gets)[2].to_i - if version_number >= 16 - # "service nfs-server" will redirect properly to systemctl - # when "service nfs-server restart" is called. - nfs_server_binary = "/usr/sbin/service nfs-server" + fedora_match = /Fedora.* release ([0-9]+)/.match(f.gets) + if fedora_match + version_number = fedora_match[1].to_i + if version_number >= 16 + # "service nfs-server" will redirect properly to systemctl + # when "service nfs-server restart" is called. + nfs_server_binary = "/usr/sbin/service nfs-server" + end end end rescue Errno::ENOENT diff --git a/plugins/hosts/fedora/plugin.rb b/plugins/hosts/redhat/plugin.rb similarity index 61% rename from plugins/hosts/fedora/plugin.rb rename to plugins/hosts/redhat/plugin.rb index 430b13708..f35a2a7c8 100644 --- a/plugins/hosts/fedora/plugin.rb +++ b/plugins/hosts/redhat/plugin.rb @@ -1,12 +1,12 @@ require "vagrant" module VagrantPlugins - module HostFedora + module HostRedHat class Plugin < Vagrant.plugin("2") - name "Fedora host" - description "Fedora host support." + name "Red Hat host" + description "Red Hat host support." - host("fedora") do + host("redhat") do require File.expand_path("../host", __FILE__) Host end