From 7187556b6a2a23c3c51330bd0f14ac389cbddaa7 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Tue, 9 Apr 2013 23:33:30 -0300 Subject: [PATCH] Remove dependency on Config object to start containers --- lib/vagrant-lxc/action/boot.rb | 2 +- lib/vagrant-lxc/driver.rb | 4 ++-- spec/unit/driver_spec.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/vagrant-lxc/action/boot.rb b/lib/vagrant-lxc/action/boot.rb index 90d700f..1268e22 100644 --- a/lib/vagrant-lxc/action/boot.rb +++ b/lib/vagrant-lxc/action/boot.rb @@ -12,7 +12,7 @@ module Vagrant config = env[:machine].provider_config env[:ui].info I18n.t("vagrant.actions.vm.boot.booting") - env[:machine].provider.driver.start(config) + env[:machine].provider.driver.start(config.customizations) raise Vagrant::Errors::VMFailedToBoot if !wait_for_boot @app.call env diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 75e691f..643b950 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -60,14 +60,14 @@ module Vagrant end end - def start(config) + def start(customizations) @logger.info('Starting container...') if ENV['LXC_START_LOG_FILE'] extra = ['-o', ENV['LXC_START_LOG_FILE'], '-l', 'DEBUG'] end - @cli.transition_to(:running) { |c| c.start(config.customizations, (extra || nil)) } + @cli.transition_to(:running) { |c| c.start(customizations, (extra || nil)) } end def halt diff --git a/spec/unit/driver_spec.rb b/spec/unit/driver_spec.rb index 6f8e984..e91528e 100644 --- a/spec/unit/driver_spec.rb +++ b/spec/unit/driver_spec.rb @@ -70,9 +70,9 @@ describe Vagrant::LXC::Driver do end describe 'start' do - let(:name) { 'container-name' } - let(:config) { fire_double('Vagrant::LXC::Config', customizations: [['a', '1'], ['b', '2']]) } - let(:cli) { fire_double('Vagrant::LXC::Driver::CLI', start: true) } + let(:name) { 'container-name' } + let(:customizations) { [['a', '1'], ['b', '2']] } + let(:cli) { fire_double('Vagrant::LXC::Driver::CLI', start: true) } subject { described_class.new(name, cli) } @@ -81,13 +81,13 @@ describe Vagrant::LXC::Driver do end it 'starts container with configured lxc settings' do - cli.should_receive(:start).with(config.customizations, nil) - subject.start(config) + cli.should_receive(:start).with(customizations, nil) + subject.start(customizations) end it 'expects a transition to running state to take place' do cli.should_receive(:transition_to).with(:running) - subject.start(config) + subject.start(customizations) end end