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
|
||||
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('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
|
||||
|
|
|
@ -20,13 +20,15 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
|
|||
end
|
||||
|
||||
subject.stub(recover: true) # Prevents files from being removed on specs
|
||||
subject.call(env)
|
||||
end
|
||||
|
||||
after do
|
||||
FileUtils.rm_rf(tmp_path.to_s)
|
||||
end
|
||||
|
||||
context 'when all files exist' do
|
||||
before { subject.call(env) }
|
||||
|
||||
it 'copies box lxc-template to package directory' do
|
||||
env['package.directory'].join('lxc-template').should be_file
|
||||
end
|
||||
|
@ -43,4 +45,15 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
|
|||
env['package.directory'].join(rootfs_path.basename).should be_file
|
||||
env['package.rootfs'].should_not be_file
|
||||
end
|
||||
end
|
||||
|
||||
context 'when lxc.conf file is not present' do
|
||||
before do
|
||||
box.directory.join('lxc.conf').delete
|
||||
end
|
||||
|
||||
it 'does not blow up' do
|
||||
expect { subject.call(env) }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue