Bug 1161253

Summary: [RFE] Need ability to properly override service request message.
Product: Red Hat CloudForms Management Engine Reporter: Bill Helgeson <bhelgeso>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED ERRATA QA Contact: Pete Savage <psavage>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.3.0CC: bascar, jocarter, lachen, mfeifer, obarenbo, psavage, ssainkar, sshveta, tfitzger, vnarayan, xlecauch
Target Milestone: GAKeywords: FutureFeature
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Enhancement
Doc Text:
In the previous version of CloudForms Management Engine, status values did not set correctly when set from an automation method on a service_request or task. This version of CloudForms now adds the ability to override service request message successfully.
Story Points: ---
Clone Of:
: 1164035 (view as bug list) Environment:
Last Closed: 2015-06-16 12:44:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1164035    

Comment 2 CFME Bot 2014-11-17 14:55:58 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/850d84866f2f68a64873263e9443f4d460cebbb2

commit 850d84866f2f68a64873263e9443f4d460cebbb2
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Nov 10 15:30:20 2014 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Fri Nov 14 13:42:09 2014 -0500

    Add the ability to override the service request message.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1161253
    
    Allow automate method to override the default request status message
    displayed as "last message".
    Added automate service model user_message helper methods.
    Changed service_template_provision_task after_ae_delivery method for
    reload and user_message override.

 vmdb/app/models/miq_request.rb                                   | 2 +-
 vmdb/app/models/miq_request_task.rb                              | 2 +-
 vmdb/app/models/mixins/miq_request_mixin.rb                      | 9 +++++++++
 vmdb/app/models/service_template_provision_task.rb               | 5 +++--
 .../service_models/mixins/miq_ae_service_miq_request_mixin.rb    | 4 ++++
 5 files changed, 18 insertions(+), 4 deletions(-)

Comment 3 CFME Bot 2014-11-20 16:37:29 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=1d5424c381572f63236f80834fcb07fdc67d94df

commit 1d5424c381572f63236f80834fcb07fdc67d94df
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Nov 10 15:30:20 2014 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Tue Nov 18 10:05:10 2014 -0500

    Add the ability to override the service request message.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1161253
    
    Allow automate method to override the default request status message
    displayed as "last message".
    Added automate service model user_message helper methods.
    Changed service_template_provision_task after_ae_delivery method for
    reload and user_message override.

 vmdb/app/models/miq_request.rb                                   | 2 +-
 vmdb/app/models/miq_request_task.rb                              | 2 +-
 vmdb/app/models/mixins/miq_request_mixin.rb                      | 9 +++++++++
 vmdb/app/models/service_template_provision_task.rb               | 5 +++--
 .../service_models/mixins/miq_ae_service_miq_request_mixin.rb    | 4 ++++
 5 files changed, 18 insertions(+), 4 deletions(-)

Comment 6 Tina Fitzgerald 2015-02-18 18:58:59 UTC
Could you provide more detail about the service?  This enhancement was specifically designed for services. Additional changes would be necessary to enable it for vm provisioning.

Comment 8 Shveta 2015-03-23 22:26:07 UTC
Please mention the steps to verify this bug .
Thanks

Comment 9 Tina Fitzgerald 2015-04-02 19:06:08 UTC
Hi Shveta,

Create a very simple service and provision it. Notice that the "Last Message" field contains the default messaging.

Next, modify one, or more of the service state machine automate methods to set the user_message to override the default message.

Note, the automate methods differ in how they define the local attribute used for $evm.root['service_template_provision_task'] 

Set the user_message text on whatever attribute is used for the "task" 

example: 
task = $evm.root['service_template_provision_task']
task.miq_request.user_message = "test user_message override"

Provision the service again and notice that the "Last Message" field contains the last user_message you specified.

Next, intentionally ABORT one of the service provision state machine automate methods by adding an abort immediately after setting the user_message. Then 
provision again to see the new "error" user_message.

example:
task = $evm.root['service_template_provision_task']
task.miq_request.user_message = "test user_message error message"
exit MIQ_ABORT 

Let me know if you have any questions.

Thanks,
Tina

Comment 10 Pete Savage 2015-04-17 09:12:05 UTC
Verified in 5.4.0.0.19

Added 

task = $evm.root['service_template_provision_task']
task.miq_request.user_message = "test user_message error message"
exit MIQ_ABORT 

And saw it in logs

Added a message just before provision in the statemachine and saw two things
1) The message was set, but nothing showed in the logs
2) The message was no longer updated at all during the provision process, I presume this is desired, that if the user_message is present, it always just shows that?

Comment 11 Tina Fitzgerald 2015-04-17 13:57:04 UTC
There is nothing to be validated in the logs. 

One more test performed on related issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1164035

Is to set the user_message to nil so that it would revert to the default messaging. 

stp_task                 = $evm.root['service_template_provision_task']
   miq_request              = stp_task.miq_request
   miq_request.user_message = nil
   exit MIQ_ABORT

Default message should be set in provision request since the user message is nil.

Let me know if you have any questions.

Comment 12 Shveta 2015-04-22 22:29:12 UTC
Verified in 5.4.0.0.22.20150420163946_26004d1

Comment 14 errata-xmlrpc 2015-06-16 12:44:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1100.html