Fix some undefined error constants in commands
This commit is contained in:
parent
171f4184c0
commit
990908c3ed
|
@ -1,5 +1,6 @@
|
||||||
## 0.6.4 (unreleased)
|
## 0.6.4 (unreleased)
|
||||||
|
|
||||||
|
- Fix some issues with undefined constants in command errors.
|
||||||
- Replaced `Kernel#system` calls with custom `Vagrant::Util::Sh` method to
|
- Replaced `Kernel#system` calls with custom `Vagrant::Util::Sh` method to
|
||||||
fix strange error issues.
|
fix strange error issues.
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,14 @@ module Vagrant
|
||||||
desc "remove NAME", "Remove a box from the system"
|
desc "remove NAME", "Remove a box from the system"
|
||||||
def remove(name)
|
def remove(name)
|
||||||
b = env.boxes.find(name)
|
b = env.boxes.find(name)
|
||||||
raise BoxNotFound.new(:name => name) if !b
|
raise Errors::BoxNotFound.new(:name => name) if !b
|
||||||
b.destroy
|
b.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "repackage NAME", "Repackage an installed box into a `.box` file."
|
desc "repackage NAME", "Repackage an installed box into a `.box` file."
|
||||||
def repackage(name)
|
def repackage(name)
|
||||||
b = env.boxes.find(name)
|
b = env.boxes.find(name)
|
||||||
raise BoxNotFound.new(:name => name) if !b
|
raise Errors::BoxNotFound.new(:name => name) if !b
|
||||||
b.repackage
|
b.repackage
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,14 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssh_connect
|
def ssh_connect
|
||||||
raise VMNotCreatedError.new if !ssh_vm.created?
|
raise Errors::VMNotCreatedError.new if !ssh_vm.created?
|
||||||
ssh_vm.ssh.connect
|
ssh_vm.ssh.connect
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssh_vm
|
def ssh_vm
|
||||||
@ssh_vm ||= begin
|
@ssh_vm ||= begin
|
||||||
vm = self.name.nil? && env.multivm? ? env.primary_vm : nil
|
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 = target_vms.first if !vm
|
||||||
vm
|
vm
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,9 +5,9 @@ module Vagrant
|
||||||
register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
|
register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
|
||||||
|
|
||||||
def execute
|
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
|
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", {
|
env.ui.info(Util::TemplateRenderer.render("ssh_config", {
|
||||||
:host_key => options[:host] || "vagrant",
|
:host_key => options[:host] || "vagrant",
|
||||||
|
|
Loading…
Reference in New Issue