From fd5ce902422c485cc0dbf78941fcb1d91541d5fb Mon Sep 17 00:00:00 2001 From: d-m-u Date: Tue, 11 Dec 2018 15:55:24 -0500 Subject: [PATCH] Create subtasks for bundled bundles --- app/models/service.rb | 4 ---- app/models/service_retire_task.rb | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/models/service.rb b/app/models/service.rb index df6934320f45..583fd912ba73 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -218,10 +218,6 @@ def composite? children.present? end - def retireable? - type.present? - end - def atomic? children.empty? end diff --git a/app/models/service_retire_task.rb b/app/models/service_retire_task.rb index a9a7435c3cb1..2241f02470f2 100644 --- a/app/models/service_retire_task.rb +++ b/app/models/service_retire_task.rb @@ -25,7 +25,7 @@ def task_active def after_request_task_create update_attributes(:description => get_description) - parent_svc = Service.find_by(:id => options[:src_ids]) + parent_svc = Service.find_by(:id => options[:src_id] || options[:src_ids]) _log.info("- creating service tasks for service <#{self.class.name}:#{id}>") create_retire_subtasks(parent_svc, self) end @@ -42,7 +42,8 @@ def create_retire_subtasks(parent_service, parent_task) # Initial Options[:dialog] to an empty hash so we do not pass down dialog values to child services tasks nh['options'][:dialog] = {} new_task = create_task(svc_rsc, parent_service, nh, parent_task) - create_retire_subtasks(svc_rsc.resource, new_task) if svc_rsc.resource.kind_of?(Service) + create_retire_subtasks(svc_rsc.resource, parent_task) if svc_rsc.resource.kind_of?(Service) + new_task.after_request_task_create miq_request.miq_request_tasks << new_task new_task.tap(&:deliver_to_automate) end.compact!