Skip to content

Commit

Permalink
Vagrantfile: Remove workarounds for ancient Vagrant bugs.
Browse files Browse the repository at this point in the history
Vagrant 2.2.6 is the earliest version with the Docker usability test
fix, and is also conveniently the version in the Ubuntu 20.04
repository.  Users with older versions will get a friendly error
message from ‘Vagrant.require_version’ (and can install an updated
Vagrant from upstream).

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk authored and timabbott committed Sep 14, 2021
1 parent cc65ed1 commit 19a7e24
Showing 1 changed file with 2 additions and 39 deletions.
41 changes: 2 additions & 39 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,8 @@
# -*- mode: ruby -*-

VAGRANTFILE_API_VERSION = "2"

if Vagrant::VERSION == "1.8.7"
path = `command -v curl`
if path.include?("/opt/vagrant/embedded/bin/curl")
puts "In Vagrant 1.8.7, curl is broken. Please use the latest Vagrant."
puts "See https://github.com/mitchellh/vagrant/issues/7997 for details."
exit
end
end

# Workaround: Vagrant removed the atlas.hashicorp.com to
# vagrantcloud.com redirect in February 2018. The value of
# DEFAULT_SERVER_URL in Vagrant versions less than 1.9.3 is
# atlas.hashicorp.com, which means that removal broke the fetching and
# updating of boxes (since the old URL doesn't work). See
# https://github.com/hashicorp/vagrant/issues/9442
if Vagrant::DEFAULT_SERVER_URL == "atlas.hashicorp.com"
Vagrant::DEFAULT_SERVER_URL.replace("https://vagrantcloud.com")
end

# Monkey patch https://github.com/hashicorp/vagrant/pull/10879 so we
# can fall back to another provider if docker is not installed.
begin
require Vagrant.source_root.join("plugins", "providers", "docker", "provider")
rescue LoadError
else
VagrantPlugins::DockerProvider::Provider.class_eval do
method(:usable?).owner == singleton_class or def self.usable?(raise_error = false)
VagrantPlugins::DockerProvider::Driver.new.execute("docker", "version")
true
rescue Vagrant::Errors::CommandUnavailable, VagrantPlugins::DockerProvider::Errors::ExecuteError
raise if raise_error
return false
end
end
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Vagrant.require_version ">= 2.2.6"

Vagrant.configure("2") do |config|
# The Zulip development environment runs on 9991 on the guest.
host_port = 9991
http_proxy = https_proxy = no_proxy = nil
Expand Down

0 comments on commit 19a7e24

Please sign in to comment.