lib/vagrant-rimu/actions/create.rb in vagrant-rimu-0.0.3 vs lib/vagrant-rimu/actions/create.rb in vagrant-rimu-0.0.4

- old
+ new

@@ -54,13 +54,20 @@ root_pass = Digest::SHA2.new.update(@machine.provider_config.api_key).to_s end if params.has_key?(:instantiation_options) params[:instantiation_options][:password] = root_pass end - result = client.servers.create(params) + + begin + result = client.servers.create(params) + rescue ::Rimu::RimuAPI::RimuRequestError, ::Rimu::RimuAPI::RimuResponseError => e + raise Errors::ApiError, {:stderr=>e} + end + @machine.id = result.order_oid env[:ui].info I18n.t('vagrant_rimu.ip_address', {:ip => result.allocated_ips["primary_ip"]}) + switch_user = @machine.provider_config.setup? user = @machine.config.ssh.username if switch_user @machine.config.ssh.username = 'root' @machine.config.ssh.password = root_pass @@ -70,9 +77,10 @@ next if env[:interrupted] raise 'not ready' if !@machine.communicate.ready? end end @machine.config.ssh.username = user + @app.call(env) end # rubocop:enable Metrics/AbcSize def recover(env)