Bug 1164035 - [RFE] Need ability to properly override service request message.
Summary: [RFE] Need ability to properly override service request message.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: GA
: 5.3.2
Assignee: Tina Fitzgerald
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On: 1161253
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-14 00:16 UTC by Dave Johnson
Modified: 2022-07-09 06:59 UTC (History)
11 users (show)

Fixed In Version: 5.3.2
Doc Type: Enhancement
Doc Text:
This user message enhancement enables custom messages to be set for the progression of the state machine and its success or failure. Currently, the automation engine provides default messaging for the progression of the state machine and its success or failure. The default messaging is used if the user_message is not specified. If the user_message is specified at any point in the state machine, the user determines either to supply the user_messages from that point forward, or to clear the user_message field and revert back to the default messaging behavior.
Clone Of: 1161253
Environment:
Last Closed: 2015-01-14 19:43:31 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0028 0 normal SHIPPED_LIVE Important: cfme security, bug fix, and enhancement update 2015-01-15 00:41:27 UTC

Comment 2 Tina Fitzgerald 2014-11-18 19:52:55 UTC
You can override the "last message" for the service request by setting the user_message as shown below:

......
stp_task                 = $evm.root['service_template_provision_task']
miq_request              = stp_task.miq_request
miq_request.user_message = "This message will appear as the last message for the service request"

The user_message can be used for the following:

A service state machine has failed with MIQ_ABORT for whatever reason, and the user would like to customize the service request last message.

The user would like customize the messages at each step of the state machine.  They could set the user_message at each step.

The default messaging will be used if the user_message is not specified.
If the user_message is specified at any point in the state machine, it will be up to the user to either supply the user_messages from that point forward, or to clear the user_message field to revert back to the default messaging behavior.

Comment 3 Tina Fitzgerald 2014-11-18 20:00:51 UTC
Commit: 1d5424c381572f63236f80834fcb07fdc67d94df [1d5424c]
Parents: b396899abd
Author: Tina Fitzgerald <tfitzger>
Date: November 10, 2014 at 3:30:20 PM EST
Commit Date: November 18, 2014 at 10:05:10 AM EST

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.


Commit: f4889b45d7c10841d86a19fb8ca86d08f3a6036c [f4889b4]
Parents: 1d5424c381
Author: Tina Fitzgerald <tfitzger>
Date: November 10, 2014 at 3:36:37 PM EST
Commit Date: November 18, 2014 at 10:06:41 AM EST
Labels: 5.3.z

Added tests.

Comment 5 Shveta 2015-01-05 22:14:14 UTC
To test an unsuccessful service provision:
=========================================
1. Create a service
2. Modify service statemachine /service/provisioning/statemachines/method/provision method as follows:
   add these lines.
   stp_task                 = $evm.root['service_template_provision_task']
   miq_request              = stp_task.miq_request
   miq_request.user_message = "This message will appear as the last message for the service request"
   exit MIQ_ABORT

   before this line
   $evm.root["service_template_provision_task"].execute
3. Provision Service.
4. Request page will show that provision failed and will the show the message above.
*************************************************
To test a successful service provision:
====================================
1. Create a service
2. Modify service statemachine /service/provisioning/statemachines/method/check_provisioned method as follows:

case result
when 'error'
  $evm.root['ae_result'] = 'error'
  reason = $evm.root['service_template_provision_task'].message
  reason = reason[7..-1] if reason[0..6] == 'Error: '
  $evm.root['ae_reason'] = reason
when 'retry'
  $evm.root['ae_result']         = 'retry'
  $evm.root['ae_retry_interval'] = '1.minute'
when 'ok'
  # Bump State
  $evm.root['ae_result'] = 'ok'
   miq_request              = task.miq_request
   miq_request.user_message = "Put some message here"
end

3. Provision Service.
4. Request page will show that provision succeeded and will the show the message above.


Verified with above steps in 5.3.2.5.20141218144833_50406a5

Comment 7 Tina Fitzgerald 2015-01-06 16:32:11 UTC
Documentation should be added for this enhancement.  

Currently, the automation engine provides default messaging for the progression of the state machine and its success or failure.

The user message enhancement was created to allow custom messages to be set for the progression of the state machine and its success or failure.

The default messaging will be used if the user_message is not specified.
If the user_message is specified at any point in the state machine, it will be up to the user to either supply the user_messages from that point forward, or to clear the user_message field to revert back to the default messaging behavior.

Some examples:

A service state machine has failed with MIQ_ABORT for whatever reason, and the user would like to customize the service request last message.

The user would like customize the messages at each step of the state machine.  The user_message could be set at at each state.

code snippet from above:
 
   stp_task                 = $evm.root['service_template_provision_task']
   miq_request              = stp_task.miq_request
   miq_request.user_message = "This message will appear as the last message for the service request"

Comment 8 Shveta 2015-01-06 18:23:12 UTC
One more test : 

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.
Verified

Comment 10 errata-xmlrpc 2015-01-14 19:43:31 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/RHSA-2015-0028.html


Note You need to log in before you can comment on or make changes to this bug.