Fix LXC_START_LOG_FILE support

This commit is contained in:
Fabio Rehm 2013-03-12 15:29:18 -03:00
parent fa49c75eb8
commit 6dcb118f86
4 changed files with 8 additions and 10 deletions

View file

@ -94,8 +94,7 @@ if you are working on a mac or windows host ;)
## Development
If you know what you'll be doing and want to develop from your physical machine,
just sing that same old song:
If want to develop from your physical machine, just sing that same old song:
```
git clone git://github.com/fgrehm/vagrant-lxc.git --recurse
@ -104,7 +103,7 @@ bundle install
bundle exec rake # to run all specs
```
To rebuild and add the provided quantal64 box:
To build the provided quantal64 box:
```
bundle exec rake boxes:quantal64:build

View file

@ -44,7 +44,6 @@ module Vagrant
end
def create(metadata = {})
# FIXME: Ruby 1.8 users dont have SecureRandom
@logger.debug('Creating container using lxc-create...')
@name = SecureRandom.hex(6)
@ -72,7 +71,6 @@ module Vagrant
end
end
# http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/
config.start_opts << "lxc.mount.entry=#{folder[:hostpath]} #{guestpath} none bind 0 0"
end
end
@ -82,10 +80,10 @@ module Vagrant
opts = config.start_opts.dup
if ENV['LXC_START_LOG_FILE']
opts.merge!('-o' => ENV['LXC_START_LOG_FILE'], '-l' => 'DEBUG')
extra = ['-o', ENV['LXC_START_LOG_FILE'], '-l', 'DEBUG']
end
@cli.transition_to(:running) { |c| c.start(opts) }
@cli.transition_to(:running) { |c| c.start(opts, (extra || nil)) }
end
def halt

View file

@ -46,8 +46,9 @@ module Vagrant
run :destroy, '--name', @name
end
def start(configs = [])
def start(configs = [], extra_opts = [])
configs = configs.map { |conf| ["-s", conf] }.flatten
configs += extra_opts if extra_opts
run :start, '-d', '--name', @name, *configs
end

View file

@ -70,7 +70,7 @@ describe Vagrant::LXC::Container do
end
describe 'start' do
let(:config) { mock(:config, start_opts: {'a' => '1', 'b' => '2'}) }
let(:config) { mock(:config, start_opts: ['a=1', 'b=2']) }
let(:name) { 'container-name' }
let(:cli) { fire_double('Vagrant::LXC::Container::CLI', start: true) }
@ -81,7 +81,7 @@ describe Vagrant::LXC::Container do
end
it 'starts container with configured lxc settings' do
cli.should_receive(:start).with('a' => '1', 'b' => '2')
cli.should_receive(:start).with(['a=1', 'b=2'], nil)
subject.start(config)
end