Vagrant: Remove `Custom Vagrant server` warning on EACH command

Created on 17 Oct 2018  路  4Comments  路  Source: hashicorp/vagrant

Please note that the Vagrant issue tracker is in priority reserved for bug reports and enhancements. For general usage questions, please use the Vagrant mailing list:
https://groups.google.com/forum/#!forum/vagrant-up. Thank you!

Tip: Before submitting your issue, don't hesitate to remove the above introductory text, possible empty sections (e.g. References), and this tip.

Vagrant version

Run vagrant -v to show the version. If you are not running the latest version
of Vagrant, please upgrade before submitting an issue.

Vagrant 2.1.2

Host operating system

This is the operating system that you run locally.

Win 10

Guest operating system

This is the operating system you run in the virtual machine.

Ubuntu 16.04

Vagrantfile

# Copy-paste your Vagrantfile here (but don't include sensitive information such as passwords, authentication tokens, or email addresses)
# setup artifactory authentication

ENV['VAGRANT_SERVER_URL'] = "https://DOMAIN.COM/artifactory/api/vagrant/vagrant-local"
ENV['ATLAS_TOKEN'] = "SOME ACCESS TOKEN"

Vagrant.configure(2) do |config|
    config.vm.box = "vagrant-default"
    config.vm.box_url = "https://DOMAIN.COM/artifactory/api/vagrant/vagrant-local/vagrant-default"
end

Please note, if you are using Homestead or a different Vagrantfile format, we
may be unable to assist with your issue. Try to reproduce the issue using a
vanilla Vagrantfile first.

Debug output

Provide a link to a GitHub Gist containing the complete debug output:
https://www.vagrantup.com/docs/other/debugging.html. The debug output should
be very long. Do NOT paste the debug output in the issue, just paste the
link to the Gist.

Expected behavior

What should have happened?

On the download of the box and maybe the up command there should be a promt that there is another server used. There should not be any wait!

Actual behavior

What actually happened?

On every often used command (up, status, reload, provision) there is a warning prompted and a short wait. This is very annoying!

Vagrant has detected a custom Vagrant server in use for downloading
box files. An authentication token is currently set which will be
added to the box request. If the custom Vagrant server should not
be receiving the authentication token, please unset it.

  Known Vagrant server:  vagrantcloud.com
  Custom Vagrant server: artifactory.DOMAIN.COM

Steps to reproduce

1.
2.
3.

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

  • GH-1234
  • ...
core enhancement track-internal

Most helpful comment

@chrisroberts Ah perfect! Thank you for that quickfix.

It would be great to have one of these options:

  • A Host-global whitelist with allowed server_urls
  • A (global) config option
  • Only prompt this on up, not on more used commands like ssh, which breaks the flow and slows down working...

All 4 comments

Hi there,

This is done to prevent accidental leakage of the access token to a different location. We are discussing ways to support non Vagrant Cloud tokens to suppress the warning and delay. To prevent the delay now, you can just provide the token in the URL:

ENV['VAGRANT_SERVER_URL'] = "https://DOMAIN.COM/artifactory/api/vagrant/vagrant-local?access_token=SOME_ACCESS_TOKEN"

Cheers!

@chrisroberts Ah perfect! Thank you for that quickfix.

It would be great to have one of these options:

  • A Host-global whitelist with allowed server_urls
  • A (global) config option
  • Only prompt this on up, not on more used commands like ssh, which breaks the flow and slows down working...

@chrisroberts - Just wanted to echo the need for this again; It makes sense to have the warning/delay for commands which actually need to reach out to the server (e.g. box update), but for more frequently called local commands like ssh/ssh-config this just painfully slows down a user's CLI workflow as well as in tools like JetBrains which interact with vagrant to run tests.

The suggested query string workaround doesn't work, because the access token isn't automatically added to other URLs vagrant makes requests to (such as metadata fetches during box updates).

The lag time is very unsettling.

I went into /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/plugins/commands/cloud/auth/middleware/add_authentication.rb

and commented out the sleep around line 58 -

              if server_uri.host != TARGET_HOST && !self.class.custom_host_notified?
                env[:ui].warn(I18n.t("cloud_command.middleware.authentication.different_target",
                  custom_host: server_uri.host, known_host: TARGET_HOST) + "\n")
                #sleep CUSTOM_HOST_NOTIFY_WAIT
                self.class.custom_host_notified!
              end
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomhking picture tomhking  路  3Comments

rhencke picture rhencke  路  3Comments

jazzfog picture jazzfog  路  3Comments

luispabon picture luispabon  路  3Comments

bbaassssiiee picture bbaassssiiee  路  3Comments