Use a different info message when image changed

This commit is contained in:
Seth Vargo 2016-05-29 14:37:37 -04:00
parent d8c56be510
commit aaef5da41d
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
2 changed files with 13 additions and 6 deletions

View File

@ -59,9 +59,14 @@ module VagrantPlugins
id = "$(cat #{config[:cidfile]})" id = "$(cat #{config[:cidfile]})"
if container_exists?(id) if container_exists?(id)
if container_args_changed?(config)
if container_args_changed?(config) or container_img_changed?(config) @machine.ui.info(I18n.t("vagrant.docker_restarting_container_args",
@machine.ui.info(I18n.t("vagrant.docker_restarting_container", 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], name: config[:name],
)) ))
stop_container(id) stop_container(id)
@ -95,7 +100,7 @@ module VagrantPlugins
lookup_container(id) lookup_container(id)
end end
def container_img_changed?(config) def container_image_changed?(config)
# Returns true if there is a container running with the given :name, # Returns true if there is a container running with the given :name,
# and the container is not using the latest :image. # and the container is not using the latest :image.

View File

@ -135,8 +135,10 @@ en:
Building Docker images... Building Docker images...
docker_running: |- docker_running: |-
-- Container: %{name} -- Container: %{name}
docker_restarting_container: |- docker_restarting_container_args: |-
-- Detected changes to container '%{name}', restarting... -- Detected changes to container '%{name}' args, restarting...
docker_restarting_container_image: |-
-- Detected newer image for container '%{name}', restarting...
docker_starting_containers: |- docker_starting_containers: |-
Starting Docker containers... Starting Docker containers...
inserted_key: |- inserted_key: |-