From f5a0c3ed5bd201a084bb4c4410813c99a48d73bf Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 19 Nov 2015 17:45:16 -0800 Subject: [PATCH] Deprecate docker.version --- .../docker/cap/debian/docker_install.rb | 2 +- .../docker/cap/fedora/docker_install.rb | 6 +----- .../docker/cap/redhat/docker_install.rb | 7 +------ plugins/provisioners/docker/config.rb | 16 ++++++++++------ plugins/provisioners/docker/installer.rb | 7 +++---- plugins/provisioners/docker/provisioner.rb | 2 +- templates/locales/en.yml | 8 +------- .../plugins/provisioners/docker/config_test.rb | 13 ++++--------- .../docs/source/v2/provisioning/docker.html.md | 3 --- 9 files changed, 22 insertions(+), 42 deletions(-) diff --git a/plugins/provisioners/docker/cap/debian/docker_install.rb b/plugins/provisioners/docker/cap/debian/docker_install.rb index 11f748632..7b81df0f9 100644 --- a/plugins/provisioners/docker/cap/debian/docker_install.rb +++ b/plugins/provisioners/docker/cap/debian/docker_install.rb @@ -3,7 +3,7 @@ module VagrantPlugins module Cap module Debian module DockerInstall - def self.docker_install(machine, version) + def self.docker_install(machine) machine.communicate.tap do |comm| comm.sudo("apt-get update -qq -y") comm.sudo("apt-get install -qq -y --force-yes curl") diff --git a/plugins/provisioners/docker/cap/fedora/docker_install.rb b/plugins/provisioners/docker/cap/fedora/docker_install.rb index 16377f410..8feb5b0e2 100644 --- a/plugins/provisioners/docker/cap/fedora/docker_install.rb +++ b/plugins/provisioners/docker/cap/fedora/docker_install.rb @@ -3,11 +3,7 @@ module VagrantPlugins module Cap module Fedora module DockerInstall - def self.docker_install(machine, version) - if version != :latest - machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported")) - end - + def self.docker_install(machine) machine.communicate.tap do |comm| if dnf?(machine) comm.sudo("dnf -y install docker") diff --git a/plugins/provisioners/docker/cap/redhat/docker_install.rb b/plugins/provisioners/docker/cap/redhat/docker_install.rb index 4f1756df9..9324c8f5b 100644 --- a/plugins/provisioners/docker/cap/redhat/docker_install.rb +++ b/plugins/provisioners/docker/cap/redhat/docker_install.rb @@ -3,11 +3,7 @@ module VagrantPlugins module Cap module Redhat module DockerInstall - def self.docker_install(machine, version) - if version != :latest - machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported")) - end - + def self.docker_install(machine) machine.communicate.tap do |comm| comm.sudo("yum -q -y update") comm.sudo("yum -q -y remove docker-io*") @@ -15,7 +11,6 @@ module VagrantPlugins end case machine.guest.capability("flavor") - when :rhel_7 docker_enable_rhel7(machine) else diff --git a/plugins/provisioners/docker/config.rb b/plugins/provisioners/docker/config.rb index bcf4cf672..8e9de55da 100644 --- a/plugins/provisioners/docker/config.rb +++ b/plugins/provisioners/docker/config.rb @@ -4,11 +4,18 @@ module VagrantPlugins module DockerProvisioner class Config < Vagrant.plugin("2", :config) attr_reader :images - attr_accessor :version + + def version=(value) + STDOUT.puts <<-EOH +[DEPRECATED] The configuration `docker.version' has been deprecated. Docker no +longer allows you to specify the version of Docker you want installed and will +automatically choose the best version for your guest. Please remove this option +from your Vagrantfile. +EOH + end def initialize - @images = Set.new - @version = UNSET_VALUE + @images = Set.new @__build_images = [] @__containers = Hash.new { |h, k| h[k] = {} } @@ -65,9 +72,6 @@ module VagrantPlugins end def finalize! - @version = "latest" if @version == UNSET_VALUE - @version = @version.to_sym - @__containers.each do |name, params| params[:image] ||= name params[:auto_assign_name] = true if !params.key?(:auto_assign_name) diff --git a/plugins/provisioners/docker/installer.rb b/plugins/provisioners/docker/installer.rb index b144ec1e6..da71ed1a5 100644 --- a/plugins/provisioners/docker/installer.rb +++ b/plugins/provisioners/docker/installer.rb @@ -1,9 +1,8 @@ module VagrantPlugins module DockerProvisioner class Installer - def initialize(machine, version) + def initialize(machine) @machine = machine - @version = version end # This handles verifying the Docker installation, installing it if it was @@ -15,8 +14,8 @@ module VagrantPlugins return end - @machine.ui.detail(I18n.t("vagrant.docker_installing", version: @version.to_s)) - @machine.guest.capability(:docker_install, @version) + @machine.ui.detail(I18n.t("vagrant.docker_installing")) + @machine.guest.capability(:docker_install) if !@machine.guest.capability(:docker_installed) if !@machine.guest.capability(:docker_installed) diff --git a/plugins/provisioners/docker/provisioner.rb b/plugins/provisioners/docker/provisioner.rb index 8b9d609a3..aa4aca27e 100644 --- a/plugins/provisioners/docker/provisioner.rb +++ b/plugins/provisioners/docker/provisioner.rb @@ -11,7 +11,7 @@ module VagrantPlugins def initialize(machine, config, installer = nil, client = nil) super(machine, config) - @installer = installer || Installer.new(@machine, config.version) + @installer = installer || Installer.new(@machine) @client = client || Client.new(@machine) end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 10fee4f09..3367c500a 100755 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -123,14 +123,8 @@ en: installed and attempt to continue. docker_configure_autostart: |- Configuring Docker to autostart containers... - docker_install_with_version_not_supported: |- - Vagrant is not capable of installing a specific version of Docker - onto the guest machine and the latest version will be installed. - This is a limitation of Vagrant knowing how to interact with this - operating system. This isn't a bug, but if you know how to fix this - please report it to Vagrant. docker_installing: |- - Installing Docker (%{version}) onto machine... + Installing Docker onto machine... docker_pulling_images: Pulling Docker images... docker_pulling_single: |- diff --git a/test/unit/plugins/provisioners/docker/config_test.rb b/test/unit/plugins/provisioners/docker/config_test.rb index e12f883c4..ba2b6836d 100644 --- a/test/unit/plugins/provisioners/docker/config_test.rb +++ b/test/unit/plugins/provisioners/docker/config_test.rb @@ -139,15 +139,10 @@ describe VagrantPlugins::DockerProvisioner::Config do end describe "#version" do - it "defaults to latest" do - subject.finalize! - expect(subject.version).to eql(:latest) - end - - it "converts to a symbol" do - subject.version = "v27" - subject.finalize! - expect(subject.version).to eql(:v27) + it "is removed in Vagrant 1.9" do + if Vagrant::VERSION >= "1.9" + raise "Remove deprecated option" + end end end end diff --git a/website/docs/source/v2/provisioning/docker.html.md b/website/docs/source/v2/provisioning/docker.html.md index 0e03ec660..cb0d526fd 100644 --- a/website/docs/source/v2/provisioning/docker.html.md +++ b/website/docs/source/v2/provisioning/docker.html.md @@ -42,9 +42,6 @@ for you (if it isn't already installed). can also use the `pull_images` function. See the example below this section for more information. -* `version` (string) - The version of Docker to install. This defaults to - "latest" and will install the latest version of Docker. - In addition to the options that can be set, various functions are available and can be called to configure other aspects of the Docker provisioner. Most of these functions have examples in more detailed sections below.