2013-11-26 21:48:51 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module Docker
|
|
|
|
class DockerInstaller
|
|
|
|
def initialize(machine, version)
|
|
|
|
@machine = machine
|
|
|
|
@version = version
|
|
|
|
end
|
|
|
|
|
|
|
|
# This handles verifying the Docker installation, installing it if it was
|
|
|
|
# requested, and so on. This method will raise exceptions if things are
|
|
|
|
# wrong.
|
|
|
|
def ensure_installed
|
|
|
|
if !@machine.guest.capability?(:docker_installed)
|
|
|
|
@machine.ui.warn(I18n.t("vagrant.docker_cant_detect"))
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if !@machine.guest.capability(:docker_installed)
|
2013-12-03 22:39:32 +00:00
|
|
|
@machine.ui.info(I18n.t("vagrant.docker_installing", version: @version.to_s))
|
2013-11-26 21:48:51 +00:00
|
|
|
@machine.guest.capability(:docker_install, @version)
|
|
|
|
|
|
|
|
if !@machine.guest.capability(:docker_installed)
|
2013-11-26 22:09:20 +00:00
|
|
|
raise DockerError, :install_failed
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if @machine.guest.capability?(:docker_configure_auto_start)
|
|
|
|
@machine.guest.capability(:docker_configure_auto_start)
|
|
|
|
else
|
|
|
|
@machine.env.ui.warn I18n.t('vagrant.docker_auto_start_not_available')
|
|
|
|
end
|
|
|
|
|
|
|
|
if @machine.guest.capability?(:docker_configure_vagrant_user)
|
|
|
|
@machine.guest.capability(:docker_configure_vagrant_user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|