`vagrant package --base`

This commit is contained in:
Mitchell Hashimoto 2012-01-13 17:55:01 -08:00
parent 7f10c05b5b
commit 8f5232c5cf
2 changed files with 11 additions and 5 deletions

View File

@ -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)

View File

@ -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)
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!