Bug 1733587

Summary: Unable to delete container provider
Product: Red Hat CloudForms Management Engine Reporter: Felix Dewaleyne <fdewaley>
Component: ProvidersAssignee: Yaacov Zamir <yzamir>
Status: CLOSED CURRENTRELEASE QA Contact: juwatts
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.6CC: agrare, fdewaley, gekis, jfrey, jhardy, mshriver, obarenbo, simaishi, yzamir
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.11.0.18 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1763857 (view as bug list) Environment:
Last Closed: 2019-12-13 14:55:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Container Management Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1763857    

Description Felix Dewaleyne 2019-07-26 16:20:14 UTC
Description of problem:
After initiating the removal from inventory of a container provider, the deletion seems stopped

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

How reproducible:
all the time in the customer environment

Steps to Reproduce:
1. go to compute > containers > provider
2. select provider
3. use "remove from inventory"

Actual results:
a trace appears in the logs after the operation starts :
[----] I, [2019-07-26T12:09:50.859273 #14217:c12f50]  INFO -- : MIQ(MiqQueue#deliver) Message id: [1000006083418], Delivering...
[----] I, [2019-07-26T12:09:50.863051 #14217:c12f50]  INFO -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager#disable!) Disabling EMS [RefContainer] id [1000000000003].
[----] E, [2019-07-26T12:09:50.883910 #14217:c12f50] ERROR -- : MIQ(MiqQueue#deliver) Message id: [1000006083418], Error: [undefined method `ipaddress?' for nil:NilClass]
[----] E, [2019-07-26T12:09:50.884502 #14217:c12f50] ERROR -- : [NoMethodError]: undefined method `ipaddress?' for nil:NilClass  Method:[block (2 levels) in <class:LogProxy>]
[----] E, [2019-07-26T12:09:50.884672 #14217:c12f50] ERROR -- : /var/www/miq/vmdb/app/models/ext_management_system.rb:111:in `hostname_format_valid?'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:382:in `block in make_lambda'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:546:in `catch'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:546:in `block in default_terminator'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `block in call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `each'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:101:in `__run_callbacks__'

Expected results:
the deletion from inventory goes through

Additional info:
a reproducer is available

Comment 3 Adam Grare 2019-07-29 13:03:06 UTC
Hey Felix, it looks like somehow this provided ended up without a default endpoint which is where we get the hostname/ipaddress from for the EMS...the only endpoint I see is for hawkular.

We will have to set a default endpoint before deleting it, when I try to do this through the UI I just get a blank page so we'll have to do it from the rails console.

I don't know how the default endpoint got deleted, or why the UI won't let us edit the provider in thise case.  Both should be investigated.

Comment 6 Yaacov Zamir 2019-07-30 12:59:28 UTC
submitted upstream:
https://github.com/ManageIQ/manageiq/pull/19077

Comment 9 Yaacov Zamir 2019-07-31 11:26:39 UTC
Waiting for feedback about fix

Comment 10 CFME Bot 2019-08-06 16:15:34 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/1dd63780d70590671376547848420d53999e80d6
commit 1dd63780d70590671376547848420d53999e80d6
Author:     Adam Grare <agrare>
AuthorDate: Tue Jul 30 09:20:52 2019 -0400
Commit:     Adam Grare <agrare>
CommitDate: Tue Jul 30 09:20:52 2019 -0400

    Merge pull request #19077 from yaacov/do-not-get-stuck-on-destroy

    Do not get stuck on destroy

    (cherry picked from commit 23750927bd53c88c249dd0c7f0abc0bc2155afaf)

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

 app/models/ext_management_system.rb | 7 +-
 1 file changed, 4 insertions(+), 3 deletions(-)

Comment 11 juwatts 2019-09-04 19:38:08 UTC
Verified in 5.11.0.22.20190827200559_e618ece

Successfully added and removed a container provider multiple times.