From 0d27cd5bcb3553e15ec15a031c793135efa738d5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 28 Jan 2013 13:39:56 -0800 Subject: [PATCH] Warn if Vagrant is run outside of installers --- bin/vagrant | 3 +++ lib/vagrant.rb | 8 ++++++++ templates/locales/en.yml | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/bin/vagrant b/bin/vagrant index 1373face2..0cd730b68 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -41,6 +41,9 @@ begin logger.debug("Creating Vagrant environment") env = Vagrant::Environment.new(opts) + # If we're not in the installer, warn. + env.ui.warn(I18n.t("vagrant.general.not_in_installer")) if !Vagrant.in_installer? + # Execute the CLI interface, and exit with the proper error code exit(env.cli(ARGV)) rescue Vagrant::Errors::VagrantError => e diff --git a/lib/vagrant.rb b/lib/vagrant.rb index 992168cf5..412bcc320 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -103,6 +103,14 @@ module Vagrant c.register([:"2", :provisioner]) { Plugin::V2::Provisioner } end + # This returns a true/false showing whether we're running from the + # environment setup by the Vagrant installers. + # + # @return [Boolean] + def self.in_installer? + !!ENV["VAGRANT_INSTALLER_ENV"] + end + # The source root is the path to the root directory of # the Vagrant gem. def self.source_root diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 8eeda9804..5703ebbb0 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -18,6 +18,13 @@ en: Old: %{old} New: %{new} + not_in_installer: |- + You appear to be running Vagrant outside of the official installers. + Note that the installers are what ensure that Vagrant has all required + dependencies, and Vagrant assumes that these dependencies exist. By + running outside of the installer environment, Vagrant may not function + properly. To remove this warning, install Vagrant using one of the + official packages from vagrantup.com. upgraded_v1_dotfile: |- A Vagrant 1.0.x state file was found for this environment. Vagrant has gone ahead and auto-upgraded this to the latest format. Everything