Fix some undefined error constants in commands

This commit is contained in:
Mitchell Hashimoto 2010-09-29 23:31:21 -07:00
parent 171f4184c0
commit 990908c3ed
4 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,6 @@
## 0.6.4 (unreleased)
- Fix some issues with undefined constants in command errors.
- Replaced `Kernel#system` calls with custom `Vagrant::Util::Sh` method to
fix strange error issues.

View File

@ -11,14 +11,14 @@ module Vagrant
desc "remove NAME", "Remove a box from the system"
def remove(name)
b = env.boxes.find(name)
raise BoxNotFound.new(:name => name) if !b
raise Errors::BoxNotFound.new(:name => name) if !b
b.destroy
end
desc "repackage NAME", "Repackage an installed box into a `.box` file."
def repackage(name)
b = env.boxes.find(name)
raise BoxNotFound.new(:name => name) if !b
raise Errors::BoxNotFound.new(:name => name) if !b
b.repackage
end

View File

@ -24,14 +24,14 @@ module Vagrant
end
def ssh_connect
raise VMNotCreatedError.new if !ssh_vm.created?
raise Errors::VMNotCreatedError.new if !ssh_vm.created?
ssh_vm.ssh.connect
end
def ssh_vm
@ssh_vm ||= begin
vm = self.name.nil? && env.multivm? ? env.primary_vm : nil
raise MultiVMTargetRequired.new(:command => "ssh") if !vm && target_vms.length > 1
raise Errors::MultiVMTargetRequired.new(:command => "ssh") if !vm && target_vms.length > 1
vm = target_vms.first if !vm
vm
end

View File

@ -5,9 +5,9 @@ module Vagrant
register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
def execute
raise MultiVMTargetRequired.new(:command => "ssh_config") if target_vms.length > 1
raise Errors::MultiVMTargetRequired.new(:command => "ssh_config") if target_vms.length > 1
vm = target_vms.first
raise VMNotCreatedError.new if !vm.created?
raise Errors::VMNotCreatedError.new if !vm.created?
env.ui.info(Util::TemplateRenderer.render("ssh_config", {
:host_key => options[:host] || "vagrant",