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