Update Container#create to use the provided rootfs tarball

This commit is contained in:
Fabio Rehm 2013-04-04 22:34:30 -03:00
parent efdcf035c3
commit a23d38e263
2 changed files with 4 additions and 4 deletions

View file

@ -46,7 +46,7 @@ module Vagrant
public_key = Vagrant.source_root.join('keys', 'vagrant.pub').expand_path.to_s public_key = Vagrant.source_root.join('keys', 'vagrant.pub').expand_path.to_s
meta_opts = metadata.fetch('template-opts', {}).merge( meta_opts = metadata.fetch('template-opts', {}).merge(
'--auth-key' => public_key, '--auth-key' => public_key,
'--cache' => metadata.fetch('rootfs-cache-path') '--tarball' => metadata.fetch('rootfs-tarball').to_s
) )
@cli.name = @name @cli.name = @name

View file

@ -36,7 +36,7 @@ describe Vagrant::LXC::Container do
let(:base_name) { 'container-name' } let(:base_name) { 'container-name' }
let(:suffix) { 'random-suffix' } let(:suffix) { 'random-suffix' }
let(:template_name) { 'template-name' } let(:template_name) { 'template-name' }
let(:rootfs_cache) { '/path/to/cache' } let(:rootfs_tarball) { '/path/to/cache/rootfs.tar.gz' }
let(:target_rootfs) { '/path/to/rootfs' } let(:target_rootfs) { '/path/to/rootfs' }
let(:public_key_path) { Vagrant.source_root.join('keys', 'vagrant.pub').expand_path.to_s } let(:public_key_path) { Vagrant.source_root.join('keys', 'vagrant.pub').expand_path.to_s }
let(:cli) { fire_double('Vagrant::LXC::Container::CLI', :create => true, :name= => true) } let(:cli) { fire_double('Vagrant::LXC::Container::CLI', :create => true, :name= => true) }
@ -45,7 +45,7 @@ describe Vagrant::LXC::Container do
before do before do
SecureRandom.stub(hex: suffix) SecureRandom.stub(hex: suffix)
subject.create base_name, target_rootfs, 'template-name' => template_name, 'rootfs-cache-path' => rootfs_cache, 'template-opts' => { '--foo' => 'bar'} subject.create base_name, target_rootfs, 'template-name' => template_name, 'rootfs-tarball' => rootfs_tarball, 'template-opts' => { '--foo' => 'bar'}
end end
it 'creates container with the right arguments' do it 'creates container with the right arguments' do
@ -54,7 +54,7 @@ describe Vagrant::LXC::Container do
template_name, template_name,
target_rootfs, target_rootfs,
'--auth-key' => public_key_path, '--auth-key' => public_key_path,
'--cache' => rootfs_cache, '--tarball' => rootfs_tarball,
'--foo' => 'bar' '--foo' => 'bar'
) )
end end