diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 1eeaf686f..2f50cc8e7 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -344,6 +344,10 @@ module Vagrant error_key(:plugin_install_bad_entry_point) end + class PluginInstallNotFound < VagrantError + error_key(:plugin_install_not_found) + end + class PluginLoadError < VagrantError status_code(81) error_key(:plugin_load_error) diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index 6f5f30473..88c99b284 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -22,7 +22,13 @@ module VagrantPlugins :name => plugin_name)) installed_gems = env[:gem_helper].with_environment do installer = Gem::DependencyInstaller.new(:document => []) - installer.install(plugin_name) + + begin + installer.install(plugin_name) + rescue Gem::GemNotFoundException + raise Vagrant::Errors::PluginInstallNotFound, + :name => plugin_name + end end # The plugin spec is the last installed gem since RubyGems diff --git a/templates/locales/en.yml b/templates/locales/en.yml index e50f67159..b34e860c8 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -175,6 +175,9 @@ en: the entry point doesn't exist. The entry point attempted was '%{entry_point}'. If this is not correct, please manually specify an `--entry-point` when installing the plugin. + plugin_install_not_found: |- + The plugin '%{name}' could not be found in local or remote + repositories. Please check the name of the plugin and try again. plugin_load_error: |- The plugin "%{plugin}" could not be found. Please make sure that it is properly installed via `vagrant plugin`.