Bug 1638502

Summary: Retirement Requester not populated after retirement
Product: Red Hat CloudForms Management Engine Reporter: Ryan Spagnola <rspagnol>
Component: ReportingAssignee: drew uhlmann <duhlmann>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact:
Priority: high    
Version: 5.9.4CC: dmetzger, duhlmann, gmccullo, mfeifer, obarenbo, pvala, rovalent, rspagnol, simaishi, tfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.10.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.10.0.31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1641812 (view as bug list) Environment:
Last Closed: 2019-02-07 23:03:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1641812    
Attachments:
Description Flags
screenshot from report output
none
DB OUTPUT on 5.10.0.25
none
VM Retire Report YAML none

Description Ryan Spagnola 2018-10-11 18:28:01 UTC
Created attachment 1493019 [details]
screenshot from report output

Description of problem:
The Retirement Requester field is not being populated in the db

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

How reproducible:
Always

Steps to Reproduce:
1. Retire a vm
2. check db for retirement_requester (note the field is blank)
vmdb_production=# select name, retirement_requester, retirement_state, updated_on, retires_on from vms where retirement_state='retired';

Actual results:
retirement_requester field is blank

Expected results:
retirement_requester field should be populated with an identifier of the user/account that retired the vm

Additional info:
Customer's environment:
vmdb_production=# select id,name,retirement_requester from vms where name = 'rovalent-retire-test-1';
 id  |          name          | retirement_requester 
-----+------------------------+----------------------
 255 | rovalent-retire-test-1 | 
(1 row)

Test machine:
vmdb_production=# select name, retirement_requester, retirement_state, updated_on, retires_on from vms where retirement_state='retired';
     name      | retirement_requester | retirement_state |         updated_on         |         retires_on         
---------------+----------------------+------------------+----------------------------+----------------------------
 joshpitney    |                      | retired          | 2018-10-11 14:09:12.504495 | 2018-10-11 14:09:12.495141
 tuanpitney2   |                      | retired          | 2018-10-11 14:10:55.165838 | 2018-10-11 14:10:55.157481
 joshpitney    |                      | retired          | 2018-10-11 14:08:45.957654 | 2018-10-11 14:08:45.949449
 tuanpitney    |                      | retired          | 2018-10-11 14:10:16.275354 | 2018-10-11 14:10:16.265689
 yoderpitney   |                      | retired          | 2018-10-11 14:11:21.554975 | 2018-10-11 14:11:21.545749
 change_me0002 |                      | retired          | 2018-10-11 14:11:44.081028 | 2018-10-11 14:11:44.063414
 change_me0001 |                      | retired          | 2018-10-11 14:08:09.968484 | 2018-10-11 14:08:09.961166
 davidpitney   |                      | retired          | 2018-10-11 14:08:50.666189 | 2018-10-11 14:08:50.656435
(8 rows)

Comment 2 drew uhlmann 2018-10-17 18:06:11 UTC
I know this is for 5.9, but could you please retest it on latest dev env (not an appliance, I don't know when anything will get built that includes those changes)? There's a change that got in here: https://github.com/ManageIQ/manageiq/pull/17951 that should have fixed this.

Comment 3 Ryan Spagnola 2018-10-18 17:28:56 UTC
Drew,

Retested on Hammer, retirement_requester field is still blank.

Comment 5 drew uhlmann 2018-10-22 18:25:31 UTC
https://github.com/ManageIQ/manageiq/pull/18113

Comment 6 drew uhlmann 2018-10-22 19:41:44 UTC
https://github.com/ManageIQ/manageiq/pull/18117

Comment 7 drew uhlmann 2018-10-22 20:06:17 UTC
These've both been merged so I'm moving this to post. 

I'll need to have this cloned, and different PRs for that, since the code is drastically different for these versions...

Comment 9 CFME Bot 2018-10-22 21:00:59 UTC
New commit detected on ManageIQ/manageiq/hammer:

https://github.com/ManageIQ/manageiq/commit/c7715ec2ef78f24933420868fa2c1dc2fb2e4711
commit c7715ec2ef78f24933420868fa2c1dc2fb2e4711
Author:     Keenan Brock <keenan>
AuthorDate: Mon Oct 22 14:39:22 2018 -0400
Commit:     Keenan Brock <keenan>
CommitDate: Mon Oct 22 14:39:22 2018 -0400

    Merge pull request #18113 from d-m-u/adding_object_retirement_requester

    Add object retirement_requester

    (cherry picked from commit aaf424f04def8ce40be7e639730782c9f8f38042)

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

 app/models/mixins/retirement_mixin.rb | 11 +
 spec/models/orchestration_stack/retirement_management_spec.rb | 1 +
 spec/models/service/retirement_management_spec.rb | 13 +-
 spec/models/vm/retirement_management_spec.rb | 10 +-
 4 files changed, 25 insertions(+), 10 deletions(-)


https://github.com/ManageIQ/manageiq/commit/4c11b0d164b08aa881dea893cb0dd7733895b991
commit 4c11b0d164b08aa881dea893cb0dd7733895b991
Author:     Keenan Brock <keenan>
AuthorDate: Mon Oct 22 15:43:24 2018 -0400
Commit:     Keenan Brock <keenan>
CommitDate: Mon Oct 22 15:43:24 2018 -0400

    Merge pull request #18117 from d-m-u/fixing_red_master

    Don't need the name, since it's mixed in...

    (cherry picked from commit 1544ad2adc38c985d0af2db283a92f88c0310cde)

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

 app/models/mixins/retirement_mixin.rb | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

Comment 11 Parthvi Vala 2018-11-27 13:20:25 UTC
Created attachment 1508829 [details]
DB OUTPUT on 5.10.0.25

Comment 12 Parthvi Vala 2018-11-27 13:20:55 UTC
Created attachment 1508830 [details]
VM Retire Report YAML

Comment 13 drew uhlmann 2018-11-28 20:15:00 UTC
https://github.com/ManageIQ/manageiq/pull/18242

Comment 14 drew uhlmann 2018-12-20 17:22:18 UTC
Please ignore comment 13, it's wrong.

Comment 17 drew uhlmann 2019-01-03 17:39:03 UTC
https://github.com/ManageIQ/manageiq/pull/18325

Comment 18 Tina Fitzgerald 2019-01-03 18:25:15 UTC
Hi Marianne,

Drew created a PR for this issue, and it's currently under review.

We feel good about getting it merged before the build next week, and will update the ticket with our test results.

Thanks,
Tina

Comment 19 Parthvi Vala 2019-01-10 13:47:28 UTC
FIXED. Verified on 5.10.0.31.20190108221820_a0968c8.

Retirement requester appears in both reports and database query even after the VM has retired.

Comment 20 errata-xmlrpc 2019-02-07 23:03:44 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-2019:0212