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 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")

View File

@ -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")

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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: |-

View File

@ -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

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
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.