From 4c293b4e7999daf2f13c2b27ade8c667415dcb3c Mon Sep 17 00:00:00 2001
From: Tina Fitzgerald <tfitzger@redhat.com>
Date: Thu, 2 Feb 2017 14:08:54 -0500
Subject: [PATCH] Add service_action.

---
 app/models/service_template.rb       | 4 +++-
 spec/models/service_template_spec.rb | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/models/service_template.rb b/app/models/service_template.rb
index db96092bd67..eda45aef09a 100644
--- a/app/models/service_template.rb
+++ b/app/models/service_template.rb
@@ -330,7 +330,9 @@ def create_resource_actions(ae_endpoints)
                  ae_endpoint[:fqname]
                end
 
-      build_options = {:action => action[:name], :fqname => fqname}
+      build_options = {:action        => action[:name],
+                       :fqname        => fqname,
+                       :ae_attributes => {:service_action => action[:name]}}
       build_options.merge!(ae_endpoint.slice(:dialog,
                                              :dialog_id,
                                              :configuration_template,
diff --git a/spec/models/service_template_spec.rb b/spec/models/service_template_spec.rb
index fdc21ebcd8d..9cd58077bb0 100644
--- a/spec/models/service_template_spec.rb
+++ b/spec/models/service_template_spec.rb
@@ -483,6 +483,7 @@
       expect(service_template.service_resources.first.resource_type).to eq('MiqRequest')
       expect(service_template.dialogs.first).to eq(service_dialog)
       expect(service_template.resource_actions.pluck(:action)).to include('Provision', 'Retirement')
+      expect(service_template.resource_actions.pluck(:ae_attributes)).to include({:service_action=>"Provision"}, {:service_action=>"Retirement"})
       expect(service_template.resource_actions.first.dialog).to eq(service_dialog)
       expect(service_template.resource_actions.last.dialog).to eq(service_dialog)
     end