2013-11-26 21:48:51 +00:00
|
|
|
module VagrantPlugins
|
2014-03-26 23:32:31 +00:00
|
|
|
module DockerProvisioner
|
2013-12-12 19:54:20 +00:00
|
|
|
class Installer
|
2015-11-20 01:45:16 +00:00
|
|
|
def initialize(machine)
|
2013-11-26 21:48:51 +00:00
|
|
|
@machine = machine
|
|
|
|
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.
|
2017-06-23 23:32:36 +00:00
|
|
|
# @return [Boolean] - false if docker cannot be detected on machine, else
|
|
|
|
# true if docker installs correctly or is installed
|
2013-11-26 21:48:51 +00:00
|
|
|
def ensure_installed
|
|
|
|
if !@machine.guest.capability?(:docker_installed)
|
|
|
|
@machine.ui.warn(I18n.t("vagrant.docker_cant_detect"))
|
2017-06-23 23:32:36 +00:00
|
|
|
return false
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
|
2015-11-20 02:25:28 +00:00
|
|
|
if !@machine.guest.capability(:docker_installed)
|
|
|
|
@machine.ui.detail(I18n.t("vagrant.docker_installing"))
|
|
|
|
@machine.guest.capability(:docker_install)
|
|
|
|
end
|
2013-11-26 21:48:51 +00:00
|
|
|
|
2015-08-07 17:44:08 +00:00
|
|
|
if !@machine.guest.capability(:docker_installed)
|
2015-11-20 02:25:28 +00:00
|
|
|
raise DockerError, :install_failed
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if @machine.guest.capability?(:docker_configure_vagrant_user)
|
|
|
|
@machine.guest.capability(:docker_configure_vagrant_user)
|
|
|
|
end
|
2017-06-23 23:32:36 +00:00
|
|
|
|
|
|
|
true
|
2013-11-26 21:48:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|