From 1eedc2b5f1c2d5195153719c3153a73d95aa92ad Mon Sep 17 00:00:00 2001 From: gpkfr Date: Fri, 20 Feb 2015 20:15:05 +0100 Subject: [PATCH 1/2] Added specific support for Debian 8 (aka jessie) to permit proper vagrant halt execution --- plugins/guests/debian/guest.rb | 2 +- plugins/guests/debian8/cap/halt.rb | 16 ++++++++++++++++ plugins/guests/debian8/guest.rb | 9 +++++++++ plugins/guests/debian8/plugin.rb | 21 +++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/guests/debian8/cap/halt.rb create mode 100644 plugins/guests/debian8/guest.rb create mode 100644 plugins/guests/debian8/plugin.rb diff --git a/plugins/guests/debian/guest.rb b/plugins/guests/debian/guest.rb index a7f3d65de..be08b3605 100644 --- a/plugins/guests/debian/guest.rb +++ b/plugins/guests/debian/guest.rb @@ -2,7 +2,7 @@ module VagrantPlugins module GuestDebian class Guest < Vagrant.plugin("2", :guest) def detect?(machine) - machine.communicate.test("cat /etc/issue | grep 'Debian'") + machine.communicate.test("cat /etc/issue | grep 'Debian' | grep -v '8'") end end end diff --git a/plugins/guests/debian8/cap/halt.rb b/plugins/guests/debian8/cap/halt.rb new file mode 100644 index 000000000..932281347 --- /dev/null +++ b/plugins/guests/debian8/cap/halt.rb @@ -0,0 +1,16 @@ +module VagrantPlugins + module GuestDebian8 + module Cap + class Halt + def self.halt(machine) + begin + machine.communicate.sudo("shutdown -h -H") + rescue IOError + # Do nothing, because it probably means the machine shut down + # and SSH connection was lost. + end + end + end + end + end +end diff --git a/plugins/guests/debian8/guest.rb b/plugins/guests/debian8/guest.rb new file mode 100644 index 000000000..ec95e9e85 --- /dev/null +++ b/plugins/guests/debian8/guest.rb @@ -0,0 +1,9 @@ +module VagrantPlugins + module GuestDebian8 + class Guest < Vagrant.plugin("2", :guest) + def detect?(machine) + machine.communicate.test("cat /etc/issue | grep 'Debian' | grep '8'") + end + end + end +end diff --git a/plugins/guests/debian8/plugin.rb b/plugins/guests/debian8/plugin.rb new file mode 100644 index 000000000..12de9eb38 --- /dev/null +++ b/plugins/guests/debian8/plugin.rb @@ -0,0 +1,21 @@ +require "vagrant" + +module VagrantPlugins + module GuestDebian8 + class Plugin < Vagrant.plugin("2") + name "Debian Jessie guest" + description "Debian Jessie guest support." + + guest("debian8", "debian") do + require File.expand_path("../guest", __FILE__) + Guest + end + + guest_capability("debian8", "halt") do + require_relative "cap/halt" + Cap::Halt + end + + end + end +end From c01c4bf41eb021cbbb7122e862996a524fbbf8bb Mon Sep 17 00:00:00 2001 From: gpkfr Date: Fri, 20 Feb 2015 20:48:34 +0100 Subject: [PATCH 2/2] remove extra spaces on plugin.rb ;). --- plugins/guests/debian8/plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/debian8/plugin.rb b/plugins/guests/debian8/plugin.rb index 12de9eb38..1f566f5fa 100644 --- a/plugins/guests/debian8/plugin.rb +++ b/plugins/guests/debian8/plugin.rb @@ -10,12 +10,12 @@ module VagrantPlugins require File.expand_path("../guest", __FILE__) Guest end - + guest_capability("debian8", "halt") do require_relative "cap/halt" Cap::Halt end - + end end end