-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Invalid Hawkular Endpoints #14990
Conversation
aa3b963
to
2d32ab0
Compare
Endpoint.where( | ||
:resource_type => "ExtManagementSystem", | ||
:role => 'hawkular', | ||
:hostname => nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it also be blank string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nil in the bug description[1] but it's a good idea to test both options
ExtManagementSystem.where( | ||
:type => %w(ManageIQ::Providers::Openshift::ContainerManager ManageIQ::Providers::Kubernetes::ContainerManager) | ||
).each do |ems| | ||
Endpoint.create!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about providers that have both endpoints?
wouldn't this create a 3rd one going back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the Authentication associated with hawkular?
I believe we should delete it too, to preserve 1:1 correspondence we had till now.
@miq-bot add_label fine/yes |
isn't fine schema frozen? |
1169423
to
2f44340
Compare
I hope this will be considered for the next zstream, especially since It is an update and not a schema change(ddl). If it is rejected we will have a separate change for fine (probably in manageiq-ui-classic) and this one for master |
52c81d1
to
09791d2
Compare
@moolitayer @cben currently my vote is to have no migrations (of any kind) in z-stream. I'll leave to @Fryguy to approve a special exception if he thinks otherwise. |
def up | ||
Endpoint.where( | ||
:resource_type => "ExtManagementSystem", | ||
:role => 'hawkular', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure say middleware providers don't use this role?
perhaps constrain EMS types like you did in down
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are using only the default[1].
Since it saves a join I prefer it.
Code looks plausible, but see comment above about Authentication. Have you tested by actually creating providers on old releases and migrating forward? I've done that before, can help. |
4783a56
to
faa2ee4
Compare
Yes I have, added a spec |
faa2ee4
to
4d79179
Compare
@Fryguy please review this change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ♻️
I'm really glad that you're digging us out of the "unofficially optional hawkular" mess...
:resource_id => ems.id | ||
) | ||
migrate | ||
expect(endpoint_stub.count).to eq(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really expect it to remove the wrong one, but still maybe test which one got removed...
E.g. expect(endpoint_stub.pluck(:role)).to contain_exactly("default")
LGTM 👍 |
@Fryguy please reivew |
@Fryguy please review |
4d79179
to
2456338
Compare
a2d968d
to
6bcc22b
Compare
:resource_id => ems_container_ids, | ||
:role => "hawkular", | ||
) | ||
create_ids = ems_container_ids - ems_with_hawkular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does [ids] - [records] work?
Id add .pluck(:id)
anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually ems_with_hawkular will be Endpoint, so pluck :resource_id ?
6bcc22b
to
f0849f4
Compare
f0849f4
to
865b040
Compare
Checked commit moolitayer@865b040 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
LGTM |
@Fryguy bump |
@Fryguy please review |
@miq-bot add_label fine/no |
def down | ||
ems_containers_by_id = ExtManagementSystem.where( | ||
:type => %w(ManageIQ::Providers::Openshift::ContainerManager ManageIQ::Providers::Kubernetes::ContainerManager) | ||
).map { |ems| [ems.id, ems] }.to_h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but .map { |ems| [ems.id, ems] }.to_h
can be shortened to .index_by(&:id)
Depends on: ManageIQ/manageiq-ui-classic#1205
Before this migration a disabled hawkular is expressed by an endpoint with a nil hostname.
After, a provider with a disabled hawkular will only have the default endpoint.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1437138