Sha256: f4bc8c641077f0baca237365bf683853a8c1b06d4561dd6a2e64c8dc3dfb8720

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

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 Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0')
          @machine.guest.capability(:docker_configure_auto_start)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vocker-0.3.0 lib/vocker/docker_installer.rb
vocker-0.2.1 lib/vocker/docker_installer.rb