Prevent vagrant package
from blowing up
This commit is contained in:
parent
51d26b00cd
commit
8512c5ace7
2 changed files with 29 additions and 14 deletions
|
@ -45,7 +45,9 @@ module Vagrant
|
||||||
box_dir = @env[:machine].box.directory
|
box_dir = @env[:machine].box.directory
|
||||||
FileUtils.cp box_dir.join('lxc-template').to_s, @env['package.directory'].to_s
|
FileUtils.cp box_dir.join('lxc-template').to_s, @env['package.directory'].to_s
|
||||||
FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s
|
FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s
|
||||||
FileUtils.cp box_dir.join('lxc.conf').to_s, @env['package.directory'].to_s
|
if (conf = box_dir.join('lxc.conf')).exist?
|
||||||
|
FileUtils.cp conf.to_s, @env['package.directory'].to_s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,27 +20,40 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
|
||||||
end
|
end
|
||||||
|
|
||||||
subject.stub(recover: true) # Prevents files from being removed on specs
|
subject.stub(recover: true) # Prevents files from being removed on specs
|
||||||
subject.call(env)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
FileUtils.rm_rf(tmp_path.to_s)
|
FileUtils.rm_rf(tmp_path.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'copies box lxc-template to package directory' do
|
context 'when all files exist' do
|
||||||
env['package.directory'].join('lxc-template').should be_file
|
before { subject.call(env) }
|
||||||
|
|
||||||
|
it 'copies box lxc-template to package directory' do
|
||||||
|
env['package.directory'].join('lxc-template').should be_file
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'copies metadata.json to package directory' do
|
||||||
|
env['package.directory'].join('metadata.json').should be_file
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'copies box lxc.conf to package directory' do
|
||||||
|
env['package.directory'].join('lxc-template').should be_file
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'moves the compressed rootfs to package directory' do
|
||||||
|
env['package.directory'].join(rootfs_path.basename).should be_file
|
||||||
|
env['package.rootfs'].should_not be_file
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'copies metadata.json to package directory' do
|
context 'when lxc.conf file is not present' do
|
||||||
env['package.directory'].join('metadata.json').should be_file
|
before do
|
||||||
end
|
box.directory.join('lxc.conf').delete
|
||||||
|
end
|
||||||
|
|
||||||
it 'copies box lxc.conf to package directory' do
|
it 'does not blow up' do
|
||||||
env['package.directory'].join('lxc-template').should be_file
|
expect { subject.call(env) }.to_not raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'moves the compressed rootfs to package directory' do
|
|
||||||
env['package.directory'].join(rootfs_path.basename).should be_file
|
|
||||||
env['package.rootfs'].should_not be_file
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue