Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1164035 - [RFE] Need ability to properly override service request message.
[RFE] Need ability to properly override service request message.
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.3.0
Unspecified Unspecified
unspecified Severity high
: GA
: 5.3.2
Assigned To: Tina Fitzgerald
Dave Johnson
: FutureFeature, ZStream
Depends On: 1161253
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-13 19:16 EST by Dave Johnson
Modified: 2015-03-23 10:51 EDT (History)
11 users (show)

See Also:
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.
Story Points: ---
Clone Of: 1161253
Environment:
Last Closed: 2015-01-14 14:43:31 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0028 normal SHIPPED_LIVE Important: cfme security, bug fix, and enhancement update 2015-01-14 19:41:27 EST

  None (edit)
Comment 2 Tina Fitzgerald 2014-11-18 14:52:55 EST
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 15:00:51 EST
Commit: 1d5424c381572f63236f80834fcb07fdc67d94df [1d5424c]
Parents: b396899abd
Author: Tina Fitzgerald <tfitzger@redhat.com>
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@redhat.com>
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 17:14:14 EST
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 11:32:11 EST
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 13:23:12 EST
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 14:43:31 EST
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.