Remove dependency on Config object to start containers
This commit is contained in:
parent
c53f9456b7
commit
7187556b6a
3 changed files with 9 additions and 9 deletions
|
@ -12,7 +12,7 @@ module Vagrant
|
||||||
config = env[:machine].provider_config
|
config = env[:machine].provider_config
|
||||||
|
|
||||||
env[:ui].info I18n.t("vagrant.actions.vm.boot.booting")
|
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
|
raise Vagrant::Errors::VMFailedToBoot if !wait_for_boot
|
||||||
|
|
||||||
@app.call env
|
@app.call env
|
||||||
|
|
|
@ -60,14 +60,14 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def start(config)
|
def start(customizations)
|
||||||
@logger.info('Starting container...')
|
@logger.info('Starting container...')
|
||||||
|
|
||||||
if ENV['LXC_START_LOG_FILE']
|
if ENV['LXC_START_LOG_FILE']
|
||||||
extra = ['-o', ENV['LXC_START_LOG_FILE'], '-l', 'DEBUG']
|
extra = ['-o', ENV['LXC_START_LOG_FILE'], '-l', 'DEBUG']
|
||||||
end
|
end
|
||||||
|
|
||||||
@cli.transition_to(:running) { |c| c.start(config.customizations, (extra || nil)) }
|
@cli.transition_to(:running) { |c| c.start(customizations, (extra || nil)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def halt
|
def halt
|
||||||
|
|
|
@ -70,9 +70,9 @@ describe Vagrant::LXC::Driver do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'start' do
|
describe 'start' do
|
||||||
let(:name) { 'container-name' }
|
let(:name) { 'container-name' }
|
||||||
let(:config) { fire_double('Vagrant::LXC::Config', customizations: [['a', '1'], ['b', '2']]) }
|
let(:customizations) { [['a', '1'], ['b', '2']] }
|
||||||
let(:cli) { fire_double('Vagrant::LXC::Driver::CLI', start: true) }
|
let(:cli) { fire_double('Vagrant::LXC::Driver::CLI', start: true) }
|
||||||
|
|
||||||
subject { described_class.new(name, cli) }
|
subject { described_class.new(name, cli) }
|
||||||
|
|
||||||
|
@ -81,13 +81,13 @@ describe Vagrant::LXC::Driver do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'starts container with configured lxc settings' do
|
it 'starts container with configured lxc settings' do
|
||||||
cli.should_receive(:start).with(config.customizations, nil)
|
cli.should_receive(:start).with(customizations, nil)
|
||||||
subject.start(config)
|
subject.start(customizations)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'expects a transition to running state to take place' do
|
it 'expects a transition to running state to take place' do
|
||||||
cli.should_receive(:transition_to).with(:running)
|
cli.should_receive(:transition_to).with(:running)
|
||||||
subject.start(config)
|
subject.start(customizations)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue