From aaef5da41d9e26d1a34120f347b037abf10550a4 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sun, 29 May 2016 14:37:37 -0400 Subject: [PATCH] Use a different info message when image changed --- plugins/provisioners/docker/client.rb | 13 +++++++++---- templates/locales/en.yml | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/provisioners/docker/client.rb b/plugins/provisioners/docker/client.rb index ec42543a0..84129a5d4 100644 --- a/plugins/provisioners/docker/client.rb +++ b/plugins/provisioners/docker/client.rb @@ -59,9 +59,14 @@ module VagrantPlugins id = "$(cat #{config[:cidfile]})" if container_exists?(id) - - if container_args_changed?(config) or container_img_changed?(config) - @machine.ui.info(I18n.t("vagrant.docker_restarting_container", + if container_args_changed?(config) + @machine.ui.info(I18n.t("vagrant.docker_restarting_container_args", + name: config[:name], + )) + stop_container(id) + create_container(config) + elsif container_image_changed?(config) + @machine.ui.info(I18n.t("vagrant.docker_restarting_container_image", name: config[:name], )) stop_container(id) @@ -95,7 +100,7 @@ module VagrantPlugins lookup_container(id) end - def container_img_changed?(config) + def container_image_changed?(config) # Returns true if there is a container running with the given :name, # and the container is not using the latest :image. diff --git a/templates/locales/en.yml b/templates/locales/en.yml index eca3759e4..005c88fc5 100755 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -135,8 +135,10 @@ en: Building Docker images... docker_running: |- -- Container: %{name} - docker_restarting_container: |- - -- Detected changes to container '%{name}', restarting... + docker_restarting_container_args: |- + -- Detected changes to container '%{name}' args, restarting... + docker_restarting_container_image: |- + -- Detected newer image for container '%{name}', restarting... docker_starting_containers: |- Starting Docker containers... inserted_key: |-