From 3f2d3886b244420c62379f10cc17b69071f51408 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Jan 2014 10:09:05 -0800 Subject: [PATCH 1/3] providers/virtualbox: fix package [GH-2739] --- lib/vagrant/action/general/package.rb | 2 ++ plugins/providers/virtualbox/action/export.rb | 17 ------------- .../providers/virtualbox/action/package.rb | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/vagrant/action/general/package.rb b/lib/vagrant/action/general/package.rb index a04deb654..996368d3a 100644 --- a/lib/vagrant/action/general/package.rb +++ b/lib/vagrant/action/general/package.rb @@ -40,6 +40,8 @@ module Vagrant end def recover(env) + @env = env + # There are certain exceptions that we don't delete the file for. ignore_exc = [Errors::PackageOutputDirectory, Errors::PackageOutputExists] ignore_exc.each do |exc| diff --git a/plugins/providers/virtualbox/action/export.rb b/plugins/providers/virtualbox/action/export.rb index 8beb9869e..1a7df0620 100644 --- a/plugins/providers/virtualbox/action/export.rb +++ b/plugins/providers/virtualbox/action/export.rb @@ -4,8 +4,6 @@ module VagrantPlugins module ProviderVirtualBox module Action class Export - attr_reader :temp_dir - def initialize(app, env) @app = app end @@ -16,24 +14,9 @@ module VagrantPlugins raise Vagrant::Errors::VMPowerOffToPackage if \ @env[:machine].provider.state.id != :poweroff - setup_temp_dir export @app.call(env) - - recover(env) # called to cleanup temp directory - end - - def recover(env) - if temp_dir && File.exist?(temp_dir) - FileUtils.rm_rf(temp_dir) - end - end - - def setup_temp_dir - @env[:ui].info I18n.t("vagrant.actions.vm.export.create_dir") - @temp_dir = @env["export.temp_dir"] = @env[:tmp_path].join(Time.now.to_i.to_s) - FileUtils.mkpath(@env["export.temp_dir"]) end def export diff --git a/plugins/providers/virtualbox/action/package.rb b/plugins/providers/virtualbox/action/package.rb index 5a6c581ce..62a564ac9 100644 --- a/plugins/providers/virtualbox/action/package.rb +++ b/plugins/providers/virtualbox/action/package.rb @@ -1,3 +1,5 @@ +require 'fileutils' + require 'vagrant/action/general/package' module VagrantPlugins @@ -8,11 +10,33 @@ module VagrantPlugins # called in the unit tests. alias_method :general_call, :call def call(env) + # Setup the temporary directory + @temp_dir = env[:tmp_path].join(Time.now.to_i.to_s) + env["export.temp_dir"] = @temp_dir + FileUtils.mkpath(env["export.temp_dir"]) + # Just match up a couple environmental variables so that # the superclass will do the right thing. Then, call the # superclass env["package.directory"] = env["export.temp_dir"] + general_call(env) + + # Always call recover to clean up the temp dir + clean_temp_dir + end + + def recover(env) + clean_temp_dir + super + end + + protected + + def clean_temp_dir + if @temp_dir && File.exist?(@temp_dir) + FileUtils.rm_rf(@temp_dir) + end end end end From 3fbaaa5acc2a6caa82109da7531932ab6a1ff99e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Jan 2014 10:10:07 -0800 Subject: [PATCH 2/3] changelog for 1.4.3 --- CHANGELOG.md | 6 ++++++ lib/vagrant/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb132689..8a1ef0557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.4.3 (January 2, 2014) + +BUG FIXES: + + - providers/virtualbox: `vagrant package` works properly again. [GH-2739] + ## 1.4.2 (December 31, 2013) IMPROVEMENTS: diff --git a/lib/vagrant/version.rb b/lib/vagrant/version.rb index 624f40422..df6e1dead 100644 --- a/lib/vagrant/version.rb +++ b/lib/vagrant/version.rb @@ -2,5 +2,5 @@ module Vagrant # This will always be up to date with the current version of Vagrant, # since it is used to generate the gemspec and is also the source of # the version for `vagrant -v` - VERSION = "1.4.2" + VERSION = "1.4.3.dev" end From 4f0eb9504cc786d5a57a43814427e8eb35407a4c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Jan 2014 10:16:06 -0800 Subject: [PATCH 3/3] v1.4.3 --- lib/vagrant/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant/version.rb b/lib/vagrant/version.rb index df6e1dead..849d6b6c0 100644 --- a/lib/vagrant/version.rb +++ b/lib/vagrant/version.rb @@ -2,5 +2,5 @@ module Vagrant # This will always be up to date with the current version of Vagrant, # since it is used to generate the gemspec and is also the source of # the version for `vagrant -v` - VERSION = "1.4.3.dev" + VERSION = "1.4.3" end