From f13806626c7a9699428b0e86ac8ca6c8bc6ba2d3 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 11 Sep 2013 21:51:18 -0300 Subject: [PATCH] Use vagrant 1.3+ ProvisionerCleanup builtin action on destroy --- lib/vagrant-lxc/action.rb | 4 +++- lib/vagrant-lxc/plugin.rb | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index 1967595..8a592d3 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -40,7 +40,6 @@ module Vagrant end end - # This action boots the VM, assuming the VM is in a state that requires # a bootup (i.e. not saved). def self.action_boot @@ -146,6 +145,9 @@ module Vagrant b3.use Vagrant::Action::Builtin::EnvSet, :force_halt => true b3.use action_halt b3.use Destroy + if Vagrant::LXC.vagrant_1_3_or_later + b3.use Vagrant::Action::Builtin::ProvisionerCleanup + end else b3.use Message, :will_not_destroy end diff --git a/lib/vagrant-lxc/plugin.rb b/lib/vagrant-lxc/plugin.rb index c3222cc..549a084 100644 --- a/lib/vagrant-lxc/plugin.rb +++ b/lib/vagrant-lxc/plugin.rb @@ -23,5 +23,9 @@ module Vagrant Config end end + + def self.vagrant_1_3_or_later + Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0') + end end end