Commit c30f8753 authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Correctly use throw(:abort) to return false when uid is missing to start

a deployment
parent 338c3d50
...@@ -120,10 +120,8 @@ class DeploymentsController < ApplicationController ...@@ -120,10 +120,8 @@ class DeploymentsController < ApplicationController
dpl.transform_blobs_into_files!(Rails.tmp, files_base_uri) dpl.transform_blobs_into_files!(Rails.tmp, files_base_uri)
begin begin
unless dpl.launch dpl.launch || raise(ServerError,
raise(ServerError, "#{dpl.errors.full_messages.join("; ")}") "#{dpl.errors.full_messages.join("; ")}")
throw :abort
end
rescue Exception => e rescue Exception => e
raise ServerError, "Cannot launch deployment: #{e.message}" raise ServerError, "Cannot launch deployment: #{e.message}"
end end
......
...@@ -34,7 +34,10 @@ module Grid5000 ...@@ -34,7 +34,10 @@ module Grid5000
before_save do before_save do
self.updated_at = Time.now.to_i self.updated_at = Time.now.to_i
errors.add(:uid, "must be set") if uid.nil? if uid.nil?
errors.add(:uid, "must be set")
throw(:abort)
end
errors.empty? errors.empty?
end end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment