-
Notifications
You must be signed in to change notification settings - Fork 898
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
Fix defaults for immutability of MiddlewareServers #14822
Fix defaults for immutability of MiddlewareServers #14822
Conversation
@miq-bot add_label bug, providers/hawkular |
@miq-bot assign @Jiri-Kremser |
@mtho11 @Jiri-Kremser please review |
app/models/middleware_server.rb
Outdated
# reimplement this method if necessary. | ||
def immutable? | ||
true | ||
false |
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.
Changing the hard-coded value from true
to false
will result in another issue. Running the power ops on dockerized servers. But agent doesn't allow that, so the MiQ ui will allow that but it fails. Why is the value hard-coded and not read from the properties? The idea is that all the hawkular servers running in the docker container have the immutable flag and they told it about themselves in the properties.
I don't get why there is always true
or false
, or is this method overriden somewhere?
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.
It is overwritten here: https://github.com/ManageIQ/manageiq-providers-hawkular/blob/master/app/models/manageiq/providers/hawkular/middleware_manager/middleware_server.rb
As of now I'm tracking what might be the error where this class is not being instantiated on miq-core, so this change would only change the default if the provider does not have a different implementation.
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 see, I was doing the grep
only over this repo
Thats right, but actually that has never been the case 😟 So while you can So, to fix this, you'll have to move the method implementation over here. like: def immutable?
if properties.has_key? 'Immutable'
properties['Immutable'] == 'true'
else
true
end
end |
@cfcosta you should probably use the factory in the specs for |
@durandom thanks a lot for investigating this.
the above should be done after 'fine' release as the fine branch no longer receives db changes.
the below should be done now in order to fix it in 'fine'.
|
When you are doing the follow up PR, maybe you want to lead the way and namespace all I see that could be of use for containers and storage and other models too. |
This commit backports the change extracted to manageiq-providers-hawkular, for use with the 5.8 release of CloudForms. It is meant to be replaced later with a type column in the affected models, allowing the proper use of STI.
9cb08a9
to
be1592d
Compare
Checked commit cfcosta@be1592d with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@miq-bot assign @blomquisg |
@@ -42,11 +42,11 @@ def in_domain? | |||
|
|||
# Returns whether a server is immutable or not. | |||
# | |||
# By default, we define all servers as being immutable, so that power | |||
# operations are not allowed, and it is the provider responsability to | |||
# By default, we define all servers as being mutable, so that power |
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.
The changed code in this method looks fine, but the comment here seems wrong.
It doesn't look like it's defaulting to mutable. It looks like it's defaulting to whatever the properties are.
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.
too much boolean logic here.
the default is an empty {}, which does not have the property and hence returns false which is not immutable which is mutable
so the comment is right... once you meditate long enough 😄
maybe drop or rephrase it in a later pr
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.
Ha! K, thanks for the logic test @durandom :)
Fix defaults for immutability of MiddlewareServers (cherry picked from commit 16c4345) https://bugzilla.redhat.com/show_bug.cgi?id=1446387
Fine backport details:
|
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1443094, and is a followup to ManageIQ#14822. It adds a type column to all classes related to Middleware, thus enabling Single Table Inheritance from Rails.
This fixes BZ https://bugzilla.redhat.com/show_bug.cgi?id=1443881 by providing a saner default for server mutability.