Page MenuHomeGRNET

No OneTemporary

File Metadata

Created
Mon, Nov 25, 5:06 AM
diff --git a/app/controllers/private_controller.rb b/app/controllers/private_controller.rb
index 7666a40..68b859f 100644
--- a/app/controllers/private_controller.rb
+++ b/app/controllers/private_controller.rb
@@ -1,37 +1,39 @@
class PrivateController < ApplicationController
# This a private trusted API
skip_before_action :verify_authenticity_token
# PUT /replace_ds
def replace_ds
parent, child, ds = replace_ds_params.values_at(:parent, :child, :ds)
Domain.replace_ds(parent, child, ds)
render json: { ok: true }
+ rescue ActiveRecord::RecordNotFound
+ render json: { ok: false, msg: 'Domain not found!' }
end
# PUT /trigger_event
def trigger_event
result = Domain
.find_by_name(action_params[:domain])
.fire_state_event(action_params[:event], params[:args])
render json: { ok: result }
end
private
def action_params
params.require(:domain)
params.require(:event)
params.permit(:domain, :event, args: [])
end
def replace_ds_params
params.require(:parent)
params.require(:child)
params.require(:ds)
params.permit(ds: [])
params
end
end

Event Timeline