providers/docker: allow multiple links to same backend (different aliases).

This commit is contained in:
Julien Pervillé 2014-09-29 18:46:01 +02:00
parent bddca42bcb
commit 97341c3234
2 changed files with 6 additions and 4 deletions

View File

@ -96,10 +96,10 @@ module VagrantPlugins
image = @env[:create_image]
image ||= @provider_config.image
links = {}
links = []
@provider_config._links.each do |link|
parts = link.split(":", 2)
links[parts[0]] = parts[1]
links << parts
end
{

View File

@ -17,7 +17,7 @@ describe VagrantPlugins::DockerProvider::Driver do
ports: '8080:80',
volumes: '/host/path:guest/path',
detach: true,
links: {janis: 'joplin'},
links: [[:janis, 'joplin'], [:janis, 'janis']],
env: {key: 'value'},
name: cid,
hostname: 'jimi-hendrix',
@ -43,7 +43,9 @@ describe VagrantPlugins::DockerProvider::Driver do
end
it 'links containers' do
expect(cmd_executed).to match(/--link #{params[:links].to_a.flatten.join(':')} .+ #{Regexp.escape params[:image]}/)
params[:links].each do |link|
expect(cmd_executed).to match(/--link #{link.join(':')} .+ #{Regexp.escape params[:image]}/)
end
end
it 'sets environmental variables' do