package: Nicely handle optional lxc-template
on base boxes when packaging
This commit is contained in:
parent
44ad630db7
commit
164afc7839
2 changed files with 13 additions and 1 deletions
|
@ -43,8 +43,10 @@ module Vagrant
|
||||||
|
|
||||||
def copy_box_files_to_pkg_dir
|
def copy_box_files_to_pkg_dir
|
||||||
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('metadata.json').to_s, @env['package.directory'].to_s
|
FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s
|
||||||
|
if (template = box_dir.join('lxc-template')).exist?
|
||||||
|
FileUtils.cp template.to_s, @env['package.directory'].to_s
|
||||||
|
end
|
||||||
if (conf = box_dir.join('lxc.conf')).exist?
|
if (conf = box_dir.join('lxc.conf')).exist?
|
||||||
FileUtils.cp conf.to_s, @env['package.directory'].to_s
|
FileUtils.cp conf.to_s, @env['package.directory'].to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,6 +51,16 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when lxc-template file is not present' do
|
||||||
|
before do
|
||||||
|
box.directory.join('lxc-template').delete
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not blow up' do
|
||||||
|
expect { subject.call(env) }.to_not raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when lxc.conf file is not present' do
|
context 'when lxc.conf file is not present' do
|
||||||
before do
|
before do
|
||||||
box.directory.join('lxc.conf').delete
|
box.directory.join('lxc.conf').delete
|
||||||
|
|
Loading…
Reference in a new issue