From 8d6cac959f0d3c69f3cef2df6f76393896e633ed Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Dec 2013 14:35:56 -0800 Subject: [PATCH] provisioners/docker: only allow 'args' special --- plugins/provisioners/docker/docker_client.rb | 30 +------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/plugins/provisioners/docker/docker_client.rb b/plugins/provisioners/docker/docker_client.rb index 16af2e028..9c10e627c 100644 --- a/plugins/provisioners/docker/docker_client.rb +++ b/plugins/provisioners/docker/docker_client.rb @@ -65,41 +65,13 @@ module VagrantPlugins end def create_container(config) - # DISCUSS: Does this really belong here? - ensure_bind_mounts_exist(config) - args = "-cidfile=#{config[:cidfile]} -d " - args << prepare_run_arguments(config) + args << config[:args] if config[:args] @machine.communicate.sudo %[ rm -f #{config[:cidfile]} docker run #{args} #{config[:image]} #{config[:cmd]} ] end - - private - - def ensure_bind_mounts_exist(config) - Array(config[:volumes]).each do |volume| - if volume =~ /(.+):.+/ - guest_vm_path = $1 - @machine.communicate.sudo "mkdir -p #{guest_vm_path}" - end - end - end - - def prepare_run_arguments(config) - args = [] - - args << "-dns=#{config[:dns]}" if config[:dns] - args << "-name=#{config[:name]}" if config[:name] - args << "#{config[:additional_run_args]}" if config[:additional_run_args] - - args += Array(config[:volumes]).map { |volume| "-v #{volume}" } - args += Array(config[:ports]).map { |port| "-p #{port}" } - args += Array(config[:links]).map { |link| "-link #{link}" } - - args.compact.flatten.join ' ' - end end end end