-
Notifications
You must be signed in to change notification settings - Fork 125
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
Renamed foreman features to ems_configuration and adjusted roles #464
Conversation
146a0cf
to
780eaa0
Compare
@Fryguy this is how far I could get, I am totally unsure why that one case is failing 😕 |
@bdunne Can you also lend some eyes to this? |
The reason the specs are failing is because data migrations should leave a previously empty database empty afterwards. This is the base case for a brand new installation, where the database is completely empty and when you migrate up it should still be empty. This is important for things like the test database. The way to ensure this is to see if there are existing records that need to be migrated before migrating anything. If there are no records, there's nothing to "fix", so you can skip the rest. |
@Fryguy I understand what's wrong with the specs, but I don't really understand what should I do to fix them. |
6af46eb
to
ace9d1e
Compare
@skateman Oh, just add this as a first line in both the
|
ace9d1e
to
2567294
Compare
@Fryguy ok, now it makes sense what you wrote before, thanks. |
2567294
to
211df78
Compare
211df78
to
b65e48e
Compare
Found one last thing, otherwise LGTM |
b65e48e
to
8fdeba8
Compare
@h-kataria found some issues, moving this back to WIP |
8fdeba8
to
7662d7f
Compare
tested, LGTM. |
f46f070
to
c6ffacf
Compare
return if MiqProductFeature.none? | ||
|
||
say_with_time 'Renaming new ems configuration features to old foreman explorer ones' do | ||
FEATURE_MAPPING.each do |to, from| |
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.
There a handful of query-in-a-loop patterns here that can be really inefficient, but we're not talking a ton of identifiers here, so maybe its not really an issue, and the code is pretty elegant to read as is. I'll leave it up to you. I think the alternative would look something like...
features = MiqProductFeature.all.index_by(&:identifier)
...
FEATURE_MAPPING.each do |from, to|
features[from]&.update!(...)
end
...
ROLES_FEATURE_MAPPING.each do |from, to|
from_feature = (features[from] ||= MiqProductFeature.create!(...)
to_features = to.map { |identifier| (features[to] ||= MiqProductFeature.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.
I'd like to leave it as it is, for readability. We don't really have millions of features.
This PR is awesome...just a couple more minor comments. |
Also seems the Travis issues are legit. |
c6ffacf
to
0269302
Compare
fd5b70f
to
97518e4
Compare
97518e4
to
b4a8b33
Compare
Checked commit skateman@b4a8b33 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint |
Renamed foreman features to ems_configuration and adjusted roles (cherry picked from commit e3e5907)
Jansa backport details:
|
Adjusting the user roles to the renamed foreman features. This isn't the final form yet as the name of the features might change in the core PR.
Core PR: ManageIQ/manageiq#19949
UI PR: ManageIQ/manageiq-ui-classic#6782