Deprecate docker.version

This commit is contained in:
Seth Vargo 2015-11-19 17:45:16 -08:00
parent 7076d192c9
commit f5a0c3ed5b
9 changed files with 22 additions and 42 deletions

View File

@ -3,7 +3,7 @@ module VagrantPlugins
module Cap module Cap
module Debian module Debian
module DockerInstall module DockerInstall
def self.docker_install(machine, version) def self.docker_install(machine)
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
comm.sudo("apt-get update -qq -y") comm.sudo("apt-get update -qq -y")
comm.sudo("apt-get install -qq -y --force-yes curl") comm.sudo("apt-get install -qq -y --force-yes curl")

View File

@ -3,11 +3,7 @@ module VagrantPlugins
module Cap module Cap
module Fedora module Fedora
module DockerInstall module DockerInstall
def self.docker_install(machine, version) def self.docker_install(machine)
if version != :latest
machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported"))
end
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
if dnf?(machine) if dnf?(machine)
comm.sudo("dnf -y install docker") comm.sudo("dnf -y install docker")

View File

@ -3,11 +3,7 @@ module VagrantPlugins
module Cap module Cap
module Redhat module Redhat
module DockerInstall module DockerInstall
def self.docker_install(machine, version) def self.docker_install(machine)
if version != :latest
machine.ui.warn(I18n.t("vagrant.docker_install_with_version_not_supported"))
end
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
comm.sudo("yum -q -y update") comm.sudo("yum -q -y update")
comm.sudo("yum -q -y remove docker-io*") comm.sudo("yum -q -y remove docker-io*")
@ -15,7 +11,6 @@ module VagrantPlugins
end end
case machine.guest.capability("flavor") case machine.guest.capability("flavor")
when :rhel_7 when :rhel_7
docker_enable_rhel7(machine) docker_enable_rhel7(machine)
else else

View File

@ -4,11 +4,18 @@ module VagrantPlugins
module DockerProvisioner module DockerProvisioner
class Config < Vagrant.plugin("2", :config) class Config < Vagrant.plugin("2", :config)
attr_reader :images 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 def initialize
@images = Set.new @images = Set.new
@version = UNSET_VALUE
@__build_images = [] @__build_images = []
@__containers = Hash.new { |h, k| h[k] = {} } @__containers = Hash.new { |h, k| h[k] = {} }
@ -65,9 +72,6 @@ module VagrantPlugins
end end
def finalize! def finalize!
@version = "latest" if @version == UNSET_VALUE
@version = @version.to_sym
@__containers.each do |name, params| @__containers.each do |name, params|
params[:image] ||= name params[:image] ||= name
params[:auto_assign_name] = true if !params.key?(:auto_assign_name) params[:auto_assign_name] = true if !params.key?(:auto_assign_name)

View File

@ -1,9 +1,8 @@
module VagrantPlugins module VagrantPlugins
module DockerProvisioner module DockerProvisioner
class Installer class Installer
def initialize(machine, version) def initialize(machine)
@machine = machine @machine = machine
@version = version
end end
# This handles verifying the Docker installation, installing it if it was # This handles verifying the Docker installation, installing it if it was
@ -15,8 +14,8 @@ module VagrantPlugins
return return
end end
@machine.ui.detail(I18n.t("vagrant.docker_installing", version: @version.to_s)) @machine.ui.detail(I18n.t("vagrant.docker_installing"))
@machine.guest.capability(:docker_install, @version) @machine.guest.capability(:docker_install)
if !@machine.guest.capability(:docker_installed) if !@machine.guest.capability(:docker_installed)
if !@machine.guest.capability(:docker_installed) if !@machine.guest.capability(:docker_installed)

View File

@ -11,7 +11,7 @@ module VagrantPlugins
def initialize(machine, config, installer = nil, client = nil) def initialize(machine, config, installer = nil, client = nil)
super(machine, config) super(machine, config)
@installer = installer || Installer.new(@machine, config.version) @installer = installer || Installer.new(@machine)
@client = client || Client.new(@machine) @client = client || Client.new(@machine)
end end

View File

@ -123,14 +123,8 @@ en:
installed and attempt to continue. installed and attempt to continue.
docker_configure_autostart: |- docker_configure_autostart: |-
Configuring Docker to autostart containers... 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: |- docker_installing: |-
Installing Docker (%{version}) onto machine... Installing Docker onto machine...
docker_pulling_images: docker_pulling_images:
Pulling Docker images... Pulling Docker images...
docker_pulling_single: |- docker_pulling_single: |-

View File

@ -139,15 +139,10 @@ describe VagrantPlugins::DockerProvisioner::Config do
end end
describe "#version" do describe "#version" do
it "defaults to latest" do it "is removed in Vagrant 1.9" do
subject.finalize! if Vagrant::VERSION >= "1.9"
expect(subject.version).to eql(:latest) raise "Remove deprecated option"
end end
it "converts to a symbol" do
subject.version = "v27"
subject.finalize!
expect(subject.version).to eql(:v27)
end end
end end
end end

View File

@ -42,9 +42,6 @@ for you (if it isn't already installed).
can also use the `pull_images` function. See the example below this can also use the `pull_images` function. See the example below this
section for more information. 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 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 and can be called to configure other aspects of the Docker provisioner. Most
of these functions have examples in more detailed sections below. of these functions have examples in more detailed sections below.