Bug 1818172

Summary: Inconsistent behaviour between Cloud and Infra providers regarding sending emails about Pending request
Product: Red Hat CloudForms Management Engine Reporter: Jaroslav Henner <jhenner>
Component: ProvisioningAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED ERRATA QA Contact: Jaroslav Henner <jhenner>
Severity: low Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.15CC: dmetzger, jhardy, obarenbo, simaishi, wfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.11.6Flags: pm-rhel: cfme-5.11.z+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 5.11.6.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-10 13:39:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Jaroslav Henner 2020-03-27 21:48:46 UTC
Description of problem:
When using OpenStack provider and the approval is required to fulfil the request (for example when more than one VM is requried), the email about pending request is sent.

The email address of current user (In access control in CFME configuration) is used in the subject of the email about request pending status, no matter what is set in the request dialog. This is in the evm.log:

[----] I, [2020-03-27T17:28:33.931559 #7241:2ad49864e5b4]  INFO -- : MIQ(GenericMailer#prepare_generic_email) options: {:to=>"evmadmin", :from=>"evmadmin", :cc=>nil, :bcc=>nil, :subject=>"Request ID 10 - Virtual Machine Request from changed-email-cloud-vm Pending Approval.", :content_type=>nil, :body=>"Approver, <br/><br/>A Virtual Machine Request received from changed-email-cloud-vm is Pending.<br/><br/>Request was not auto-approved for the following reasons: (Requested VMs 2 limit is 1) .<br/><br/>Approvers notes : <br/><br/>For more information you can go to : <a href=https://XXX.redhat.com/miq_request/show/10>https://XXX.rdu2.redhat.com/miq_request/show/10</a><br/><br/> Thank you,<br/> Virtualization Infrastructure Team", :sent_on=>2020-03-27 17:28:33 -0400, :attachment=>[]}


Indeed, on our SMTP server I can see messages like:
Request ID 1 - Instance Request from Pending Approval.


When Infra Provider (I tested RHEV), the email from the provisioning request seems to be used for the email subject. I can see this in evm.log:

[----] E, [2020-03-27T17:28:34.509724 #7241:2ad49864e5b4] ERROR -- : MIQ(GenericMailer.deliver) method: automation_notification options: {:to=>"evmadmin", :from=>"evmadmin", :cc=>nil, :bcc=>nil, :subject=>"Request ID 10 - Virtual Machine Request from changed-email-cloud-vm Pending Approval.", :content_type=>nil, :body=>"Approver, <br/><br/>A Virtual Machine Request received from changed-email-cloud-vm is Pending.<br/><br/>Request was not auto-approved for the following reasons: (Requested VMs 2 limit is 1) .<br/><br/>Approvers notes : <br/><br/>For more information you can go to : <a href=https://XXX.rdu2.redhat.com/miq_request/show/10>https://XXX.rdu2.redhat.com/miq_request/show/10</a><br/><br/> Thank you,<br/> Virtualization Infrastructure Team", :sent_on=>2020-03-27 17:28:33 -0400, :attachment=>[]} delivery-error 450 4.1.8 <evmadmin>: Sender address rejected: Malformed DNS server reply


Version-Release number of selected component (if applicable):
5.11.4.2


How reproducible:
always


Steps to Reproduce:
0. Enable Notifier role.
1. Configure SMTP on CFME to working smtp server as it seems to be required for a log message to appear.
2. Verify the configuration is right
3. Verify the current user's email address is empty in the Access control in Configuration.
4. Create request for 2 VM on OpenStack provider (or any other that doesn't get auto-approved).
Crate similar request wiht RHEV provider.

fill all the items as you need, remember what you have set as  Request Information email

Actual results:
 * Email about pending request with missing noun in subject sent for Cloud provisioning request
 * Email about pending request with info filled on provisioning dialog in subject sent for RHEV provisioning request



Expected results:
Email sent and content uses the email set in the provisioning dialog no matter which provider is used.


Additional info:
I found no way to set the email recipient. I am sure it is hidden somewhere in Automate. I feel like this feature of sending emails probably has never been really in use by customer as it is not working well and it seems too unclear how to configure it.

Note that there was this bug about the same, but probably fixed for the Infra providers only:
https://bugzilla.redhat.com/show_bug.cgi?id=1672690

Comment 2 William Fitzgerald 2020-03-31 15:33:44 UTC
Jaroslav,

Do you have a reproducer ?

Did you copy and update Configuration\Email\Default ?
The from and default_recipient fields should have valid email values.

Comment 4 William Fitzgerald 2020-04-01 16:32:23 UTC
I worked with Jaroslav and know what the problem is.   Fix coming soon.

Thank you Jaroslav for your help on this.

Billy

Comment 5 Jaroslav Henner 2020-04-01 21:19:09 UTC
I didn't find any information how to set the recipient in https://access.redhat.com/documentation/en-us/red_hat_cloudforms/5.0/html-single/methods_available_for_automation/index.  When this bug is resolved a Doc BZ probably needs to be opened so it is clear how to set CFME in order for the emails to be sent.

The docs will probably need contain info about copying and updating Configuration\Email\Default... The from and default_recipient fields should have valid email values. And enabling the Notification.

Comment 7 CFME Bot 2020-05-13 15:05:39 UTC
New commit detected on ManageIQ/manageiq-content/jansa:

https://github.com/ManageIQ/manageiq-content/commit/02ff41485dbc2d502b2e531caaf2a87590bc07f4
commit 02ff41485dbc2d502b2e531caaf2a87590bc07f4
Author:     tina <tfitzger>
AuthorDate: Thu Apr 23 15:15:54 2020 +0000
Commit:     tina <tfitzger>
CommitDate: Thu Apr 23 15:15:54 2020 +0000

    Merge pull request #652 from billfitzgerald0120/email_cloud_miqprovision_requests

    Fixes Email owner value in Cloud provisioning mail's subject and body.

    (cherry picked from commit 755226c6034d81790cbdbf6490ba84efa48bbcba)

    https://bugzilla.redhat.com/show_bug.cgi?id=1818172

 content/automate/ManageIQ/System/Notification/Email.class/cloudmiqprovisionrequestapproverapproved.yaml | 6 +-
 content/automate/ManageIQ/System/Notification/Email.class/cloudmiqprovisionrequestapproverdenied.yaml | 4 +-
 content/automate/ManageIQ/System/Notification/Email.class/cloudmiqprovisionrequestapproverpending.yaml | 4 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

Comment 8 Jaroslav Henner 2020-06-04 16:31:31 UTC
I tested this with RHV, OpenStack and GCE and it seems this is fixed

Comment 11 errata-xmlrpc 2020-06-10 13:39:10 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://access.redhat.com/errata/RHSA-2020:2480