From 33d3c2808646f0a9c0e1ed99a6b14828079459fc Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Dec 2013 14:33:13 -0800 Subject: [PATCH] provisioners/docker: simplify run, output which are running --- plugins/provisioners/docker/config.rb | 18 ++++-------------- plugins/provisioners/docker/docker_client.rb | 5 ++++- templates/locales/en.yml | 2 ++ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/plugins/provisioners/docker/config.rb b/plugins/provisioners/docker/config.rb index bd8ec5140..b4a2d57c5 100644 --- a/plugins/provisioners/docker/config.rb +++ b/plugins/provisioners/docker/config.rb @@ -20,22 +20,12 @@ module VagrantPlugins @images += images.map(&:to_s) end - def run(*args) - container_name = args.shift - params = {} - - if args.empty? - params[:image] = container_name - elsif args.first.is_a?(String) - params[:image] = args.shift - params[:cmd] = container_name - else - params = args.shift - params[:cmd] ||= container_name - end + def run(name, **options) + params = options.dup + params[:image] = name # TODO: Validate provided parameters before assignment - @containers[container_name.to_s] = params + @containers[name.to_s] = params end def finalize! diff --git a/plugins/provisioners/docker/docker_client.rb b/plugins/provisioners/docker/docker_client.rb index 895d21ce1..16af2e028 100644 --- a/plugins/provisioners/docker/docker_client.rb +++ b/plugins/provisioners/docker/docker_client.rb @@ -30,8 +30,11 @@ module VagrantPlugins cids_dir = "/var/lib/vagrant/cids" config[:cidfile] ||= "#{cids_dir}/#{Digest::SHA1.hexdigest name}" + @machine.ui.info(I18n.t("vagrant.docker_running", name: name)) @machine.communicate.sudo("mkdir -p #{cids_dir}") - run_container({name: name}.merge config) + run_container({ + name: name + }.merge(config)) end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 0f0dfedbd..97b596e9e 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -47,6 +47,8 @@ en: Installing Docker onto machine... docker_pulling_images: Pulling Docker images... + docker_running: |- + -- Container: %{name} docker_starting_containers: Starting Docker containers... docker_auto_start_not_available: |-