From 8f5232c5cf57ac20074a1b0821f51be7b2cd4c33 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 13 Jan 2012 17:55:01 -0800 Subject: [PATCH] `vagrant package --base` --- lib/vagrant/command/package.rb | 2 +- lib/vagrant/vm.rb | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/vagrant/command/package.rb b/lib/vagrant/command/package.rb index 349c576b0..5662f8a7d 100644 --- a/lib/vagrant/command/package.rb +++ b/lib/vagrant/command/package.rb @@ -44,7 +44,7 @@ module Vagrant protected def package_base(options) - vm = VM.find(options[:base], @env) + vm = VM.new(options[:base], @env, @env.config.global, :base => true) raise Errors::BaseVMNotFound, :name => options[:base] if !vm.created? @logger.debug("Packaging base VM: #{vm.name}") package_vm(vm, options) diff --git a/lib/vagrant/vm.rb b/lib/vagrant/vm.rb index d9f88a63f..83ddccd66 100644 --- a/lib/vagrant/vm.rb +++ b/lib/vagrant/vm.rb @@ -12,7 +12,7 @@ module Vagrant attr_reader :config attr_reader :driver - def initialize(name, env, config) + def initialize(name, env, config, opts=nil) @logger = Log4r::Logger.new("vagrant::vm") @name = name @@ -21,9 +21,15 @@ module Vagrant @config = config @box = env.boxes.find(config.vm.box) - # Load the UUID if its saved. - active = env.local_data[:active] || {} - @uuid = active[@name.to_s] + opts ||= {} + if opts[:base] + # The name is the ID we use. + @uuid = name + else + # Load the UUID if its saved. + active = env.local_data[:active] || {} + @uuid = active[@name.to_s] + end # Reload ourselves to get the state reload!