From 1006ba488eb60ed81152a10b140e204ed8301543 Mon Sep 17 00:00:00 2001 From: Aparna Karve Date: Mon, 27 Aug 2018 15:51:39 -0700 Subject: [PATCH] emit notifications when a request completes --- .../service_template_transformation_plan_request.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/service_template_transformation_plan_request.rb b/app/models/service_template_transformation_plan_request.rb index 53d22b034f7e..5d92b2635bf3 100644 --- a/app/models/service_template_transformation_plan_request.rb +++ b/app/models/service_template_transformation_plan_request.rb @@ -28,4 +28,13 @@ def cancel update_attributes(:cancelation_status => MiqRequest::CANCEL_STATUS_REQUESTED) miq_request_tasks.each(&:cancel) end + + def update_request_status + super + if request_state == 'finished' && status == 'Ok' + call_automate_event_queue("request_completed_with_success") + elsif request_state == 'finished' && status != 'Ok' + call_automate_event_queue("request_completed_with_failure") + end + end end