Bug 1718833 - EC2 Key pairs without public key filled cannot be removed
Summary: EC2 Key pairs without public key filled cannot be removed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.10.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.11.0
Assignee: Julian Cheal
QA Contact: Matouš Mojžíš
Red Hat CloudForms Documentation
URL:
Whiteboard: cloud:key_pair
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-10 11:00 UTC by Matouš Mojžíš
Modified: 2019-12-12 13:36 UTC (History)
5 users (show)

Fixed In Version: 5.11.0.16
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-12 13:36:36 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:4199 0 None None None 2019-12-12 13:36:48 UTC

Description Matouš Mojžíš 2019-06-10 11:00:48 UTC
Description of problem:
EC2 key pairs that don't have filled public key during creation cannot be removed from inventory.

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

How reproducible:
Always

Steps to Reproduce:
1. Add ec2 provider
2. Create key pair without filling in public key
3. Remove key pair from inventory

Actual results:
ERROR -- : MIQ(auth_key_pair_cloud_controller-button): Couldn't initiate deletion of Key Pair "fE8hdixDkC":

Expected results:


Additional info:

Comment 2 Alexander Zagaynov 2019-07-12 14:57:52 UTC
Matouš, can you please attach logs / post more log lines? Maybe there is more details present?

"Create key pair" - how do you create them? In MiQ or in AWS?
"Remove key pair" - same, can you please provide some steps?

Comment 5 Matouš Mojžíš 2019-07-13 11:25:21 UTC
Alex,

added evm.log/production.log starting from creating key_pair to deleting keypair.
I create key pair in CFME and only fill in the name. Public key is not filled. When I create keypair in AWS deleting always works.
For removing keypairs I go to Compute -> Cloud -> Keypairs -> Select a key pair -> In configuration bar there is remove item from inventory.

I think it has something to do with CFME creating/saving public key for future download, because not filling public key is the only way to reproduce it.

Comment 6 Alexander Zagaynov 2019-07-16 13:24:46 UTC
Matous, there is no any error in this log :(
Where did you take the "Couldn't initiate deletion" line from?

Comment 7 Matouš Mojžíš 2019-07-17 15:28:51 UTC
Alex,
second last line in evm.log there is that error.

Comment 8 Alexander Zagaynov 2019-07-17 15:32:38 UTC
Thank you, I was looking in production.log :)

Comment 9 Julian Cheal 2019-07-22 12:37:43 UTC
So in testing,

I created a Key Pair with just a title.

Tried to delete via CFME UI and got the same error.

Using the console wrote the code line by line from `raw_delete_key_pair` https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/app/models/manageiq/providers/amazon/cloud_manager/auth_key_pair.rb#L28

Finding the key pair with `kp = ec2.key_pair("Julian_kp_test")` then deleting the key pair with `kp.delete`. This was successful.

So the error is somewhere before this code. I'm thinking in the UI.

Comment 10 Julian Cheal 2019-07-22 12:55:24 UTC
So the problem isn't the UI, it's coming from https://github.com/ManageIQ/manageiq-ui-classic/blob/6b6e0047ad9f7333c4219a5042a28adc50cc6a5c/app/controllers/auth_key_pair_cloud_controller.rb#L169

`if key_pair.is_available?(:delete_key_pair)` in the UI

If a key pair has a key, that returns true, without a key returns false.

Comment 11 Julian Cheal 2019-07-22 13:21:06 UTC
Solved it.

If a key pair is created without a key, we get AWS to generate us a key (I believe) https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/app/models/manageiq/providers/amazon/cloud_manager/auth_key_pair.rb#L4-L10

And any keys imported from AWS cannot be deleted in CFME.

So I'm not sure what the next step is.

Comment 12 Julian Cheal 2019-07-22 15:03:12 UTC
PR fixes this issue https://github.com/ManageIQ/manageiq-providers-amazon/pull/547

Comment 13 Matouš Mojžíš 2019-07-25 13:28:39 UTC
Verified in 5.11.0.16. Key pairs created in AWS, created in CFME without public key set and created in CFME with public key set can be all deleted.

Comment 15 errata-xmlrpc 2019-12-12 13:36:36 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/RHBA-2019:4199


Note You need to log in before you can comment on or make changes to this bug.