Fixed class naming and detection for suse hosts

This commit is contained in:
Thomas Boerger 2014-09-11 10:48:58 +02:00
parent 6fa0fe09ab
commit f1b62ae03a
3 changed files with 20 additions and 14 deletions

View File

@ -1,5 +1,5 @@
module VagrantPlugins module VagrantPlugins
module HostOpenSUSE module HostSUSE
module Cap module Cap
class NFS class NFS
def self.nfs_check_command(env) def self.nfs_check_command(env)

View File

@ -3,14 +3,22 @@ require "pathname"
require "vagrant" require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostOpenSUSE module HostSUSE
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def detect?(env) def detect?(env)
release_file = Pathname.new("/etc/SuSE-release") old_release_file = Pathname.new("/etc/SuSE-release")
if release_file.exist? if old_release_file.exist?
release_file.open("r") do |f| old_release_file.open("r") do |f|
return true if f.gets =~ /^openSUSE/ return true if f.gets =~ /^(openSUSE|SUSE Linux Enterprise)/
end
end
new_release_file = Pathname.new("/etc/os-release")
if new_release_file.exist?
new_release_file.open("r") do |f|
return true if f.gets =~ /(openSUSE|SLES)/
end end
end end

View File

@ -1,24 +1,22 @@
require "vagrant" require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostOpenSUSE module HostSUSE
class Plugin < Vagrant.plugin("2") class Plugin < Vagrant.plugin("2")
name "OpenSUSE host" name "SUSE host"
description "OpenSUSE host support." description "SUSE host support."
host("opensuse", "linux") do host("suse", "linux") do
require_relative "host" require_relative "host"
Host Host
end end
# Linux-specific helpers we need to determine paths that can host_capability("suse", "nfs_check_command") do
# be overriden.
host_capability("opensuse", "nfs_check_command") do
require_relative "cap/nfs" require_relative "cap/nfs"
Cap::NFS Cap::NFS
end end
host_capability("opensuse", "nfs_start_command") do host_capability("suse", "nfs_start_command") do
require_relative "cap/nfs" require_relative "cap/nfs"
Cap::NFS Cap::NFS
end end