From f1b62ae03a6ba9c309627fcde894ed8164d6e900 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 11 Sep 2014 10:48:58 +0200 Subject: [PATCH] Fixed class naming and detection for suse hosts --- plugins/hosts/suse/cap/nfs.rb | 2 +- plugins/hosts/suse/host.rb | 18 +++++++++++++----- plugins/hosts/suse/plugin.rb | 14 ++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/plugins/hosts/suse/cap/nfs.rb b/plugins/hosts/suse/cap/nfs.rb index d16bc9327..6bb17b172 100644 --- a/plugins/hosts/suse/cap/nfs.rb +++ b/plugins/hosts/suse/cap/nfs.rb @@ -1,5 +1,5 @@ module VagrantPlugins - module HostOpenSUSE + module HostSUSE module Cap class NFS def self.nfs_check_command(env) diff --git a/plugins/hosts/suse/host.rb b/plugins/hosts/suse/host.rb index 5e0240d27..2cc5c24c7 100644 --- a/plugins/hosts/suse/host.rb +++ b/plugins/hosts/suse/host.rb @@ -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 diff --git a/plugins/hosts/suse/plugin.rb b/plugins/hosts/suse/plugin.rb index 6ed81f8da..a2d692536 100644 --- a/plugins/hosts/suse/plugin.rb +++ b/plugins/hosts/suse/plugin.rb @@ -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