hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.01k stars 4.42k forks source link

Vagrant Box Outdated not showing latest version of box from locally hosted versions file #13376

Open wfuzzer opened 3 months ago

wfuzzer commented 3 months ago

Debug output

https://gist.github.com/wfuzzer/1532a7a966ada228a828d2f7d9fab9ea

Expected behavior

It should have found an updated box version.

Actual behavior

It did not detect an updated box version.

Reproduction information

Vagrant version

2.4.0

Host operating system

RHEL8

Guest operating system

RHEL8

Steps to reproduce

  1. First remove the .vagrant.d/boxes/mybox2/3.1.175/virtualbox/box_update_check file (if this is not removed, it will always skip the version check. Tested this over the course of many days - this parenthetical may be a separate bug because the throttle is only supposed to be something like 1 hour (according to https://github.com/hashicorp/vagrant/issues/11228), but in my case, it always skips unless I manually remove this file).
  2. Run the "vagrant box outdated mymachine3" command
  3. The only output is, "Checking if box 'mybox2' version '3.1.175' is up to date..." with nothing after that.

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'yaml'

servers = YAML.load_file('servers.yml')

servers.each do |opts|
   if opts["name"].nil? or
      opts["enable"].nil? or
      opts["box"].nil? or
      opts["mem"].nil? or
      opts["vram"].nil? or
      opts["cpus"].nil?
      print "Error: malformed servers.yml file\n\n"
      exit 1
   end
end

VAGRANT_API_VERSION = 2
Vagrant.configure("#{VAGRANT_API_VERSION}") do |config|
   servers.each_with_index do |opts, iServer|
      if not opts["enable"]
         next
      end

      config.vm.define opts["name"], autostart:false, primary:false do |server|
         server.vm.box = opts["box"]
         server.vm.box_url = "file:///mydir/vagrant/#{opts["box"]}.json"

         # SSH configuration
         server.ssh.username = "myusername"
         server.ssh.password = "mypassword"
      end
   end
end