Check the status returned by Azure SDK and gracefully handle the
exceptions.
This commit is contained in:
Ramakrishnan 2014-04-22 15:42:09 +05:30
Родитель 5486220b50
Коммит 62e6e18c88
3 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -9,7 +9,7 @@ module VagrantPlugins
module WinAzure
lib_path = Pathname.new(File.expand_path('../vagrant-azure', __FILE__))
autoload :Action, lib_path.join('action')
autoload :Error, lib_path.join('errors')
autoload :Errors, lib_path.join('errors')
autoload :Driver, lib_path.join('driver')
require lib_path.join('provisioner/puppet')

Просмотреть файл

@ -94,11 +94,16 @@ module VagrantPlugins
params, options, add_role
)
# TODO: Exception/Error Handling
if server.nil?
raise Errors::CreateVMFailure
end
# The Ruby SDK returns any exception encountered on create virtual
# machine as a string.
if server.instance_of? String
env[:ui].info "Server not created. Error is: #{server}"
raise "#{server}"
raise Errors::CreateVMError, message: "#{server}"
end
env[:machine].id = "#{server.vm_name}@#{server.cloud_service_name}"

Просмотреть файл

@ -14,3 +14,10 @@ en:
VM '%{name}' has been started
vm_stopped: |-
VM '%{name}' has been stopped
errors:
create_vm_failure: |-
There was some error in creating the VM, this could be due to some network latency.
Generally the next vagrant up command should fix this error.
create_vm_error: |-
Failed to create a VM in azure cloud with the following message.
%{message}