package: lxc-config should be included when repackaging boxes

This commit is contained in:
Fabio Rehm 2014-03-12 23:47:52 -03:00
parent 100d5223ce
commit 38ae9441fc
3 changed files with 9 additions and 3 deletions

View file

@ -52,5 +52,5 @@ on knowing what makes a base box for vagrant-lxc, here's what's needed:
| --- | --- | --- |
| `provider` | Yes | Required by Vagrant |
| `version` | Yes | Tracks backward incompatibilities |
| `built-on` | No | Date / time when the box was packaged |
| `built-on` | No | Date / time when the box was packaged for the first time |
| `template-opts` | No | Extra options to be passed to the `lxc-template` script provided with the .box package |

View file

@ -45,10 +45,12 @@ 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
# TODO: Update built-on metadata.json
if (conf = box_dir.join('lxc.conf')).exist?
FileUtils.cp conf.to_s, @env['package.directory'].to_s
end
if (conf = box_dir.join('lxc-config')).exist?
FileUtils.cp conf.to_s, @env['package.directory'].to_s
end
end
end
end

View file

@ -14,7 +14,7 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
before do
box.directory.mkdir
files = %w( lxc-template metadata.json lxc.conf ).map { |f| box.directory.join(f) }
files = %w( lxc-template metadata.json lxc.conf lxc-config ).map { |f| box.directory.join(f) }
(files + [rootfs_path]).each do |file|
file.open('w') { |f| f.puts file.to_s }
end
@ -41,6 +41,10 @@ describe Vagrant::LXC::Action::SetupPackageFiles do
env['package.directory'].join('lxc-template').should be_file
end
it 'copies box lxc-config to package directory' do
env['package.directory'].join('lxc-config').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