Bug 1698116

Summary: service bundle retirement initiated by API fails at check_service_retirement on an unknown method error
Product: Red Hat CloudForms Management Engine Reporter: Felix Dewaleyne <fdewaley>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED NOTABUG QA Contact: Parthvi Vala <pvala>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.10.2CC: dmetzger, duhlmann, fdewaley, gekis, gmccullo, gtanzill, jprause, mkanoor, mshriver, obarenbo, pvala, simaishi, tfitzger, vaclav.miller, yrudman
Target Milestone: GAKeywords: Reopened
Target Release: 5.10.5   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-30 20:01:40 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: 1704905    

Description Felix Dewaleyne 2019-04-09 16:09:49 UTC
Description of problem:
when a service retirement is initiated by API the retiremement fails at check_service_retirement on an unknown method error

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

How reproducible:
customer environment

Steps to Reproduce:
1.provision a service
2.issue retirement using an api call
3.

Actual results:
[----] I, [2019-04-09T13:26:12.483126 #5572:900f60]  INFO -- : Updated namespace [miqaedb:/Service/Retirement/StateMachines/Methods/CheckServiceRetired#create  ManageIQ/Service/Retirement/StateMachines]
[----] I, [2019-04-09T13:26:12.586375 #5572:900f60]  INFO -- : Updated namespace [Service/Retirement/StateMachines/Methods/check_service_retired  ManageIQ/Service/Retirement/StateMachines]
[----] I, [2019-04-09T13:26:12.593123 #5572:900f60]  INFO -- : Invoking [inline] method [/ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired] with inputs [{}]
[----] I, [2019-04-09T13:26:12.594178 #5572:900f60]  INFO -- : <AEMethod [/ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired]> Starting 
[----] I, [2019-04-09T13:26:12.995751 #5572:b7a7dc]  INFO -- : <AEMethod check_service_retired> Checking if all service tasks have been retired.
[----] E, [2019-04-09T13:26:12.996947 #5572:b7a7dc] ERROR -- : <AEMethod check_service_retired> The following error occurred during method evaluation:
[----] E, [2019-04-09T13:26:12.997873 #5572:b7a7dc] ERROR -- : <AEMethod check_service_retired>   NoMethodError: undefined method `[]' for nil:NilClass
[----] E, [2019-04-09T13:26:12.999176 #5572:b7a7dc] ERROR -- : <AEMethod check_service_retired>   /ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired:21:in `check_all_service_tasks'
/ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired:14:in `main'
[----] E, [2019-04-09T13:26:13.008777 #5572:b7a7dc] ERROR -- : Method STDERR: /ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired:21:in `check_all_service_tasks': undefined method `[]' for nil:NilClass (NoMethodError)
[----] E, [2019-04-09T13:26:13.009180 #5572:b7a7dc] ERROR -- : Method STDERR:   from /ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired:14:in `main'
[----] E, [2019-04-09T13:26:13.009656 #5572:b7a7dc] ERROR -- : Method STDERR:   from /ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired:54:in `<main>'
[----] I, [2019-04-09T13:26:13.038960 #5572:900f60]  INFO -- : <AEMethod [/ManageIQ/Service/Retirement/StateMachines/Methods/check_service_retired]> Ending
[----] E, [2019-04-09T13:26:13.039459 #5572:900f60] ERROR -- : Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]]
[----] E, [2019-04-09T13:26:13.039944 #5572:900f60] ERROR -- : State=<CheckServiceRetired> running  raised exception: <Method exited with rc=Unknown RC: [1]>
[----] W, [2019-04-09T13:26:13.040121 #5572:900f60]  WARN -- : Error in State=[CheckServiceRetired]
[----] I, [2019-04-09T13:26:13.040315 #5572:900f60]  INFO -- : In State=[CheckServiceRetired], invoking [on_error] method=[update_service_retirement_status(status => 'Error Checking Service retirement')]
[----] I, [2019-04-09T13:26:13.195715 #5572:900f60]  INFO -- : Updated namespace [Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status  ManageIQ/Service/Retirement/StateMachines]
[----] I, [2019-04-09T13:26:13.507689 #5572:900f60]  INFO -- : Invoking [inline] method [/ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status] with inputs [{"status"=>"Error Checking Service retirement"}]
[----] I, [2019-04-09T13:26:13.509050 #5572:900f60]  INFO -- : <AEMethod [/ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status]> Starting 
[----] E, [2019-04-09T13:26:13.987415 #5572:ac0bf98] ERROR -- : <AEMethod update_service_retirement_status> The following error occurred during method evaluation:
[----] E, [2019-04-09T13:26:13.989840 #5572:ac0bf98] ERROR -- : <AEMethod update_service_retirement_status>   NoMethodError: undefined method `miq_request' for nil:NilClass
[----] E, [2019-04-09T13:26:13.992815 #5572:ac0bf98] ERROR -- : <AEMethod update_service_retirement_status>   /ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status:19:in `main'
[----] E, [2019-04-09T13:26:14.002042 #5572:ac0bf98] ERROR -- : Method STDERR: /ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status:19:in `main': undefined method `miq_request' for nil:NilClass (NoMethodError)
[----] E, [2019-04-09T13:26:14.002547 #5572:ac0bf98] ERROR -- : Method STDERR:  from /ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status:49:in `<main>'
[----] I, [2019-04-09T13:26:14.030307 #5572:900f60]  INFO -- : <AEMethod [/ManageIQ/Service/Retirement/StateMachines/ServiceRetirement/update_service_retirement_status]> Ending
[----] E, [2019-04-09T13:26:14.030687 #5572:900f60] ERROR -- : State=<CheckServiceRetired> running on_error raised exception: <Method exited with rc=Unknown RC: [1]>



Expected results:
retirement proceeds as normal

Additional info:
does not affect retirements started from the UI.
API retirements started with 
POST POST /api/services/<<id>>
{
	"action" : "retire"
}

Comment 4 Tina Fitzgerald 2019-04-09 16:45:52 UTC
Hi Felix,

It looks the customer is using the old api call.  Could you ask them to use the action request_retire as shown below:

POST POST /api/services/<<id>>
{
	"action" : "request_retire"
}

Thanks,
Tina

Comment 5 Felix Dewaleyne 2019-04-10 09:18:40 UTC
the customer reports that the new api isn't in any documentation and believes that calls to the previous api should return a warning that this is depredicated and end without doing anything else.

I'll open a bug for the documentation side. two documents are affected.

Comment 7 dmetzger 2019-04-10 17:07:03 UTC
Closing this bug as the issue is documentation and a separate BZ was opened for that.

Comment 8 Felix Dewaleyne 2019-04-11 10:30:13 UTC
I would argue that the "retire" action is still exposed and should be removed.

Comment 9 Tina Fitzgerald 2019-04-15 10:35:53 UTC
Hi Felix,

The 'retire' action is still valid, and needed for customers using custom Automation code.

Thanks,
Tina

Comment 10 Felix Dewaleyne 2019-04-15 11:25:31 UTC
(In reply to Tina Fitzgerald from comment #9)
> Hi Felix,
> 
> The 'retire' action is still valid, and needed for customers using custom
> Automation code.
> 
> Thanks,
> Tina

in the case of this customer, using retire caused retirements to fail. they stopped failing when using request_retire.
see the opening message for details

Comment 15 drew uhlmann 2019-05-23 15:10:58 UTC
Tina says comment 13 is resolved by https://github.com/ManageIQ/manageiq-content/pull/530

Comment 16 Tina Fitzgerald 2019-05-28 16:17:38 UTC
PR referenced in Comment 15 has been merged and back ported to Hammer.

Comment 18 Tina Fitzgerald 2019-05-29 15:26:33 UTC
Hi Satoe, Felix,

I dont think we need to open a new bug, since the problem and solution are covered here: https://bugzilla.redhat.com/show_bug.cgi?id=1698480 

My vote would be to close this ticket. Felix, are you okay with that?

Thanks,
Tina

Comment 19 Felix Dewaleyne 2019-05-30 08:40:59 UTC
I think so yeah. in fact the case might be one we can close too, same customer...