Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Create cert_store if it's not created before validation #101

Merged
merged 1 commit into from
Dec 7, 2017

Conversation

aljesusg
Copy link
Member

@aljesusg aljesusg commented Nov 7, 2017

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

@tumido
Copy link
Member

tumido commented Nov 7, 2017

@aljesusg Please link the dependent/related PRs in the descriptions.

@aljesusg
Copy link
Member Author

aljesusg commented Nov 7, 2017

@miq-bot assign @abonas

@aljesusg
Copy link
Member Author

aljesusg commented Nov 7, 2017

Tested with:

ManageIQ/manageiq-ui-classic#2577
#100
#101

and revert

ManageIQ/manageiq-ui-classic#2643

and it's working with hawkular server, ssl and CA

@tumido
Copy link
Member

tumido commented Nov 7, 2017

@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)
Copy link
Member

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
  ...
}

Copy link
Member Author

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 !!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary operators before if

Copy link
Member

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.

Copy link
Member Author

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

@abonas
Copy link
Member

abonas commented Nov 7, 2017

is this ready for merge? or does it have to be merged with the other related PRs?
should/can we have this in gaprindashvili?

@abonas abonas added the bug label Nov 7, 2017
Copy link
Member

@tumido tumido left a 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.

@tumido
Copy link
Member

tumido commented Nov 7, 2017

@abonas, not yet, there's a change suggestion which was promised to be adjusted by @aljesusg.

@tumido
Copy link
Member

tumido commented Nov 7, 2017

@abonas, it should be merged together with the other PRs.

The gaprindashvili thing - I'm not sure. Is there a plan to have the new queue validation available for Hawkular in this release @agrare? If yes, it needs to land there, if not it doesn't matter.

@agrare
Copy link
Member

agrare commented Nov 7, 2017

Is there a plan to have the new queue validation available for Hawkular in this release @agrare? If yes, it needs to land there, if not it doesn't matter.

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.

@tumido
Copy link
Member

tumido commented Nov 7, 2017

@agrare, good idea. Here it is ;) ManageIQ/manageiq-ui-classic#2660

@agrare
Copy link
Member

agrare commented Nov 7, 2017

❤️ thanks @tumido

@aljesusg
Copy link
Member Author

aljesusg commented Nov 8, 2017

Sorry @abonas I forgot update this PR ^^ is ready now, review @tumido . Thanks

@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member Author

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 :(

Copy link
Member

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 :)

Copy link
Member Author

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 !!!

@abonas
Copy link
Member

abonas commented Dec 3, 2017

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?

@aljesusg
Copy link
Member Author

aljesusg commented Dec 3, 2017

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.

@abonas
Copy link
Member

abonas commented Dec 3, 2017

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 :)

@aljesusg
Copy link
Member Author

aljesusg commented Dec 3, 2017

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?

@tumido
Copy link
Member

tumido commented Dec 4, 2017

@aljesusg I agree with @cfcosta, it makes a much more sense to have this handled on the Endpoint part and I would suggest to change this PR to do so instead of merging and fixing later... This PR is not intended for gaprindashvili so we have plenty of time to do it right. Also just a reminder this PR belongs under changes in ManageIQ/manageiq-ui-classic#2660 (please add the link into the description).

@agrare
Copy link
Member

agrare commented Dec 4, 2017

The gaprindashvili thing - I'm not sure. Is there a plan to have the new queue validation available for Hawkular in this release

Not necessary, and I'd argue stability is more important at this point.

@aljesusg
Copy link
Member Author

aljesusg commented Dec 4, 2017

I updated the description @tumido, ok so I'll do the PR for the Endpoint like @cfcosta requested. Thanks

@abonas
Copy link
Member

abonas commented Dec 4, 2017

@agrare yes, I agree, I asked the gaprindashvili question a month ago. it has been marked as "no" for quite some time now.

@israel-hdez
Copy link
Member

@aljesusg I agree with @cfcosta, it makes a much more sense to have this handled on the Endpoint part and I would suggest to change this PR to do so instead of merging and fixing later...

I don't agree "too much"... Even when I suggested this code to fix the related issue, Endpoint is being used as a helper and an instance is created just to re-use ssl_cert_store method. Perhaps the code to create certificate stores should be extracted to a module under lib/ in core-repo. But given that Endpoint is part if the core repo, you could try to place a PR and see if the core team accepts.

@aljesusg
Copy link
Member Author

aljesusg commented Dec 4, 2017

Yes...In my experience, they don't merge in core something for a specific provider but we can try it.

@aljesusg
Copy link
Member Author

aljesusg commented Dec 6, 2017

So @cfcosta, @tumido, @israel-hdez What should I do? I can try to move this to the Endpoint or me can merge this.

@israel-hdez
Copy link
Member

@aljesusg Since Endpoint is in core repo, my vote is to merge now while you check if core team accepts you PR. If they do, just place another PR here. If not... well, we've already made progress.
Just fix the rubocop warning ;)

@miq-bot
Copy link
Member

miq-bot commented Dec 6, 2017

Checked commit aljesusg@4fc514b with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@aljesusg
Copy link
Member Author

aljesusg commented Dec 6, 2017

@israel-hdez is ready now. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants