-
Notifications
You must be signed in to change notification settings - Fork 33
Create cert_store if it's not created before validation #101
Conversation
@aljesusg Please link the dependent/related PRs in the descriptions. |
Tested with: ManageIQ/manageiq-ui-classic#2577 and revert ManageIQ/manageiq-ui-classic#2643 and it's working with hawkular server, ssl and CA |
@israel-hdez please review |
@@ -102,7 +102,11 @@ def self.raw_connect(host, port, username, password, security_protocol, cert_sto | |||
options = { | |||
:tenant => 'hawkular', | |||
:verify_ssl => verify_ssl_mode(security_protocol), | |||
:ssl_cert_store => cert_store | |||
:ssl_cert_store => if cert_store.kind_of?(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.
Functional-wise I'm glad the change is that simple, though stylistically I would prefer a bit different way, something like:
if cert_store.kind_of?(String)
cert_store = Endpoint.new(:certificate_authority => cert_store).ssl_cert_store
options = {
...
:ssl_cert_store => cert_store
...
}
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 prefer cert_store.kind_of?(String) ? Endpoint.new(:certificate_authority => cert_store).ssl_cert_store : cert_store ^^ Vote community !!!
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.
Ternary operators before if
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 like the ternary operator, but I don't like that the line will become loooong. So, I would vote for @tumido suggestion to have a balance between style and readability.
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.
@tumido wins...I'll change the code ^^ thanks
is this ready for merge? or does it have to be merged with the other related PRs? |
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.
Please adjust it as we agreed on above.
Not that I know of but it could always happen. I'd recommend putting a WIP PR in to ui-classic that adds it to the list of ems_types that we do validate as an umbrella PR that can link to all the dependencies. That way if we do backport that we make sure to include everything it depends on. |
@agrare, good idea. Here it is ;) ManageIQ/manageiq-ui-classic#2660 |
❤️ thanks @tumido |
c8ff15b
to
95ad312
Compare
@@ -99,6 +99,9 @@ def self.raw_connect(host, port, username, password, security_protocol, cert_sto | |||
:username => username, | |||
:password => password | |||
} | |||
if cert_store.kind_of?(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.
Please add line breaks before and after the block.
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.
Also, is there a way this can be tested? Since it broke something, I think we should have regression tests for it.
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.
Also, what do you think on moving this to Endpoint
and have it default to cert_store
if provided? I prefer to have it there, so we could remove conditionals on foreign data.
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.
@cfcosta linre breaks throw a rubocop error :(
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's not the line break that throws the rubocop errors, it's the whitespaces in the blank line :)
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 was cleaning whitespaces and still got error It was confused ^^Fixed !!!
Hi, what's the status of this PR? I see a related PR was merged a few days ago, but here some review changes were requested? |
It was pending from the PR merged yesterday and make this changes but I was thinking about make the move of the function to endpoint or not like @cfcosta requested I am gonna make the changes today and add a test for merge this but I think that is not a good idea to move this to the endpoint because this is only happening to this provider. |
it can wait for tomorrow, and it sounds like there is some more discussion needed if certain things sound like not a good idea to you :) |
I think so, maybe we can merge it after me changes and after we can discuss about move it to Endpoint , What do you think @cfcosta? |
@aljesusg I agree with @cfcosta, it makes a much more sense to have this handled on the |
Not necessary, and I'd argue stability is more important at this point. |
@agrare yes, I agree, I asked the gaprindashvili question a month ago. it has been marked as "no" for quite some time now. |
I don't agree "too much"... Even when I suggested this code to fix the related issue, |
Yes...In my experience, they don't merge in core something for a specific provider but we can try it. |
95ad312
to
066af83
Compare
So @cfcosta, @tumido, @israel-hdez What should I do? I can try to move this to the Endpoint or me can merge this. |
@aljesusg Since |
066af83
to
12c24bd
Compare
12c24bd
to
4fc514b
Compare
Checked commit aljesusg@4fc514b with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@israel-hdez is ready now. Thanks |
This fix the cert store if it's not created before call the validation method, create the endpoint and assign the certificate_authority
Related with : #100
Related with: UI ManageIQ/manageiq-ui-classic#2577
Related with: UI ManageIQ/manageiq-ui-classic#2660
cc @tumido , @israel-hdez