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 HostOpenSUSE
module HostSUSE
module Cap
class NFS
def self.nfs_check_command(env)

View File

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

View File

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