Vagrant box does not see new box_url even after reloading

263 views Asked by At

I updated my Vagrantfile's confg.vm.box_url to a new URL (the box is hosted on a server who's IP changed) and no amount of vagrant reloading will make Vagrant see the new URL. When I run vagrant reload --debug, I see it attempt to fetch metadata from the old URL.

The relevant debug output:

==> default: Checking if box 'tute_development' is up to date...
 INFO downloader: Downloader starting download: 
 INFO downloader:   -- Source: http://10.0.1.36/vagrant/tute_development/tute_development.json

Here's the relevant part of the vagrant file:

config.vm.box_url = "http://192.168.1.104/vagrant/tute_development/tute_development.json"

How do I make the vagrant box see the new box_url?

2

There are 2 answers

1
ccnokes On BEST ANSWER

This is unfortunately the intended behavior of Vagrant. To quote this Github issue (https://github.com/mitchellh/vagrant/issues/4235):

The box URL in the config is only meant to be used if the box doesn't exist (by its logical name) in the local box registry (vagrant box list). To force a new box to be downloaded you'd have to update the name, or point the URL to a metadata JSON with a higher version.

The metadata JSON being referred to is the JSON file that the config.vm.box_url property points to. In my case, it was pointing to an internal network IP address that had changed, so I edited the metadata_url file in ~/.vagrant.d/boxes/{boxname}/metadata_url.

0
Guillaume Fache On

Another way I would suggest is deleting the default base Vagrant downloaded the first time (on Windows at something like : C:\Users\[Username]\.vagrant.d\boxes\[YourBoxName]). When reloading, Vagrant will look for it, won't find it, and download it again, using the URL you changed.

Hope this helps.