Sha256: 3706f39236e1ce41b6ff7427d94cbb1b2097a4969d3dbcf62809f199aa0c373a

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require_relative "errors"

module VagrantPlugins
  module Vocker
    class DockerInstaller
      def initialize(machine)
        @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.
      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)
          @machine.ui.info(I18n.t("vagrant.docker_installing"))
          @machine.guest.capability(:docker_install)

          if !@machine.guest.capability(:docker_installed)
            raise Errors::DockerInstallFailed
          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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vocker-0.3.1 lib/vocker/docker_installer.rb