UtahDave / salt-vagrant-demo

Demo of Salt in Vagrant. 1 master and 2 minions
Apache License 2.0
247 stars 191 forks source link

Forcing the vagrant cloud server url to https://vagrantcloud.com #42

Closed wixyvir closed 5 years ago

wixyvir commented 6 years ago

Instead of atlas.hashicorp.com

Without this patch, you'll get this error:

cyprien.diot@techCyp:~/salt-vagrant-demo$ vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
    master: Box Provider: virtualbox
    master: Box Version: >= 0
The box 'bento/ubuntu-16.04' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/bento/ubuntu-16.04"]
Error: The requested URL returned error: 404 Not Found
UtahDave commented 6 years ago

What the output of vagrant --version on your machine?

I just tested and it downloaded the box from https://vagrantcloud.com just fine.

wixyvir commented 6 years ago

@UtahDave You're right, looks like it works with Vagrant >= 2.0 but not with Vagrant < 2.0.0.

Where I got this issue:

cyprien.diot@techCyp:~/salt-vagrant-demo$ vagrant --version
Vagrant 1.9.2

But it works with Vagrant 2.0.4:

[root@021071bf715f work]# vagrant box add bento/ubuntu-16.04
==> box: Loading metadata for box 'bento/ubuntu-16.04'
    box: URL: https://vagrantcloud.com/bento/ubuntu-16.04
^[[1;7BThis box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) hyperv
2) parallels
3) virtualbox
4) vmware_desktop

Enter your choice: ==> box: Waiting for cleanup before exiting...
==> box: Exiting immediately, without cleanup!
[root@021071bf715f work]# vagrant --version
Vagrant 2.0.4

On debian based distributions (like Ubuntu 17), Vagrant 2.0.4 is not yet available, so I still think this Pull Request is useful.

Thank you;

darkn3rd commented 5 years ago

This works without any problems on Mac OS X 10.3.5, Vagrant 2.1.2, VirtualBox 5.2.16r123759.

Segue: I didn't know about Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com'), not needed, but cool to know you wanted to use Artifactory or other custom repository.

UtahDave commented 5 years ago

@wixyvir

I'm getting this error:

[salt-vagrant-demo (wixyvir-fix_vagrant_server_url)]$ vagrant up
Vagrant failed to initialize at a very early stage:

There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: /home/me/repos/salt-vagrant-demo/Vagrantfile
Line number: 5
Message: RuntimeError: can't modify frozen String

My version of vagrant:

$ vagrant --version
Vagrant 2.1.5
wixyvir commented 5 years ago

Yes this is not compatible with Vagrant 2 anymore and all supported OS are now packaging Vagrant 2