From edec52f004f1b3c35278b21f0b1e90a5d07b38d8 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 30 Mar 2013 19:23:06 -0300 Subject: [PATCH] HACK: Redirect rootfs extraction stderr to /dev/null as repackaged containers will output a lot of stuff (but it will still work fine :) --- lib/vagrant-lxc/action/handle_box_metadata.rb | 3 ++- spec/unit/action/handle_box_metadata_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/action/handle_box_metadata.rb b/lib/vagrant-lxc/action/handle_box_metadata.rb index a6198c3..92f1dad 100644 --- a/lib/vagrant-lxc/action/handle_box_metadata.rb +++ b/lib/vagrant-lxc/action/handle_box_metadata.rb @@ -29,7 +29,8 @@ module Vagrant system(%Q[sudo su root -c "cp #{lxc_template_src} #{dest}"]) @logger.debug('Extracting rootfs') - system(%Q[sudo su root -c "cd #{box.directory} && tar xfz rootfs.tar.gz -C #{rootfs_cache}"]) + # TODO: Ideally the compressed rootfs should not output errors... + system(%Q[sudo su root -c "cd #{box.directory} && tar xfz rootfs.tar.gz -C #{rootfs_cache} 2>/dev/null"]) box.metadata.merge!( 'template-name' => template_name, diff --git a/spec/unit/action/handle_box_metadata_spec.rb b/spec/unit/action/handle_box_metadata_spec.rb index 7a76015..18c81aa 100644 --- a/spec/unit/action/handle_box_metadata_spec.rb +++ b/spec/unit/action/handle_box_metadata_spec.rb @@ -39,6 +39,6 @@ describe Vagrant::LXC::Action::HandleBoxMetadata do it 'extracts rootfs into a tmp folder' do subject.should have_received(:system). - with(%Q[sudo su root -c "cd #{box_directory} && tar xfz rootfs.tar.gz -C #{tmpdir}"]) + with(%Q[sudo su root -c "cd #{box_directory} && tar xfz rootfs.tar.gz -C #{tmpdir} 2>/dev/null"]) end end