Skip to content
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

move exception into Kubeclient namespace #195

Merged
merged 1 commit into from
Apr 18, 2017

Conversation

grosser
Copy link
Contributor

@grosser grosser commented Oct 1, 2016

@abonas @simon3z

seems weird that it got defined in the top-level namespace ...

@grosser grosser force-pushed the grosser/exception branch 3 times, most recently from e1841fd to f9787c4 Compare October 3, 2016 17:58
@simon3z
Copy link
Collaborator

simon3z commented Oct 4, 2016

IIUC this is not backward-compatible. We may have to properly schedule this because we just released a major version. @moolitayer can you review?

@grosser
Copy link
Contributor Author

grosser commented Oct 4, 2016

... made it backwards compatible by defining the constant ...

@grosser grosser force-pushed the grosser/exception branch 2 times, most recently from 4ed385a to e8481bd Compare October 4, 2016 16:40
@moolitayer
Copy link
Collaborator

Generally agree. Should not merge until we mean to version bump.

@moolitayer
Copy link
Collaborator

This would need a line in Readme in the Upgrading section

@grosser
Copy link
Contributor Author

grosser commented Oct 5, 2016

it is backwards compatible now ... so can merge ? ... also added a line to the upgrading section

@moolitayer
Copy link
Collaborator

This does not appear to be backward compatible, you are changing tests code to handle the new exception class. Please squash the change and have it ready to merge once we agree on a bump.

I will create an issue to track all of our non backward compatible changes

@grosser
Copy link
Contributor Author

grosser commented Oct 5, 2016

It is backwards compatible because the old constant still exists.
I updated the tests to use the new constant so we are not using a deprecated feature.

+class KubeException < Kubeclient::HttpException

@grosser
Copy link
Contributor Author

grosser commented Oct 5, 2016

build has same errors as on master ... added a minor cleanup to avoid defining a global method

@grosser
Copy link
Contributor Author

grosser commented Oct 11, 2016

@moolitayer ok to merge ?

@grosser
Copy link
Contributor Author

grosser commented Oct 27, 2016

@moolitayer ok to merge or what do you want changed ?


def config_file(name)
File.new(File.join(File.dirname(__FILE__), 'config', name))
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this change for (test_config_file => config_file)?

Copy link
Collaborator

@moolitayer moolitayer Oct 30, 2016

Choose a reason for hiding this comment

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

please add a test for the backward compatibility you are maintaining. Then I'm good with this change. @simon3z please review, are we going to merge anything before the integration problem is fixed or should that be fixed first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

things that start with test_ are tests, so I found this confusing/dangerous ... so changing to config_file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... and it was a global method ... moving it inside the test where it belongs caused it to run as test

Copy link
Collaborator

@moolitayer moolitayer Mar 14, 2017

Choose a reason for hiding this comment

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

👍 for this change, but things usually have a better change of being review if they are as restricted as possible...

@grosser
Copy link
Contributor Author

grosser commented Oct 30, 2016

test added!

@moolitayer
Copy link
Collaborator

LGTM @simon3z please review

@@ -0,0 +1,20 @@
# TODO: remove this on next major version bump
class KubeException < StandardError
Copy link
Collaborator

Choose a reason for hiding this comment

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

@grosser don't you need the body here? (initialize, etc.)

Technically I suppose it works because you throw a Kubeclient::HttpException which contains the relevant attributes. Although to be strict, just by how this is defined, there could be KubeException with no :error_code, :message, :response, which is not backward compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@grosser grosser force-pushed the grosser/exception branch 2 times, most recently from fa5ad97 to 1b54fc2 Compare November 7, 2016 18:25
@grosser
Copy link
Contributor Author

grosser commented Nov 7, 2016

ready!

error_message = 'certificate verify failed'

stub_request(:get, 'http://localhost:8080/api')
.to_raise(OpenSSL::SSL::SSLError.new(error_message))
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this exception is caught by rest-client and translated to a rest client error(since we only catch those afaik)?
Can you make it more straight forward (like the test above?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

see above please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this test to say "if an ssl error happens, kubeclient should react this way" ... I it wanted it to not matter what plumbing layer is in-between.

@moolitayer
Copy link
Collaborator

moolitayer commented Mar 14, 2017

@simon3z is this direction desired? (I think this is generally good for us)

@simon3z
Copy link
Collaborator

simon3z commented Mar 14, 2017

I am OK with this change in general. @cben please review.
@grosser can you rebase?

@cben
Copy link
Collaborator

cben commented Apr 18, 2017

@grosser could you fix the conflicts?

@grosser
Copy link
Contributor Author

grosser commented Apr 18, 2017

updated

@simon3z
Copy link
Collaborator

simon3z commented Apr 18, 2017

@cben con you review the (minor) change/rebase and re-approve? I think we can merge this.

Copy link
Collaborator

@cben cben left a comment

Choose a reason for hiding this comment

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

thanks!

@simon3z simon3z merged commit 745a510 into ManageIQ:master Apr 18, 2017
@kirs
Copy link
Contributor

kirs commented Apr 18, 2017

🎉

grosser added a commit to zendesk/samson that referenced this pull request Nov 21, 2017
grosser added a commit to zendesk/samson that referenced this pull request Nov 21, 2017
@cben cben added the v2.x/yes label Jan 14, 2018
@cben
Copy link
Collaborator

cben commented Jan 14, 2018

@moolitayer @grosser This is safe for next 2.x release we're assembling, but we need to fix README note (on master too) to use correct class name and speak of 3.0 not 2.0 (?)

@grosser grosser deleted the grosser/exception branch January 15, 2018 04:08
@grosser grosser restored the grosser/exception branch January 15, 2018 04:10
@grosser
Copy link
Contributor Author

grosser commented Jan 15, 2018

so you are planing to remove KubeException in v3 ?
not really sure what needs to be done, can you whip up a PR or just change the docs ?

cben added a commit to cben/kubeclient that referenced this pull request Jan 22, 2018
move exception into Kubeclient namespace
# Conflicts:
#	README.md
#	lib/kubeclient/common.rb
cben added a commit to cben/kubeclient that referenced this pull request Jan 22, 2018
Reverts parts of commit 263ff40
from ManageIQ#271 that restored KubeException - no longer needed
after backporting ManageIQ#195 and ManageIQ#233, we now have
Kubeclient::HttpError and Kubeclient::ResourceNotFoundError.

In other words, v2.x branch is now closer to original ManageIQ#262.
cben added a commit to cben/kubeclient that referenced this pull request Jan 22, 2018
Reverts parts of commit 263ff40
from ManageIQ#271 that restored KubeException - no longer needed
after backporting ManageIQ#195 and ManageIQ#233, we now have
Kubeclient::HttpError and Kubeclient::ResourceNotFoundError.

In other words, v2.x branch is now closer to original ManageIQ#262.
cben added a commit to cben/kubeclient that referenced this pull request Jan 22, 2018
This reverts commit 263ff40 from ManageIQ#271.
Those backport changes are no longer needed:
- after backporting ManageIQ#195 and ManageIQ#233, v2.x now has
  Kubeclient::HttpError and Kubeclient::ResourceNotFoundError.
- after backporting ManageIQ#247, v2.x now tests with webmock 2.x,
  it takes `basic_auth` rather than user:pw in URL.
- ns/namespace change was just cosmetic.

In other words, v2.x branch is now closer to original ManageIQ#262.
cben added a commit to cben/kubeclient that referenced this pull request Jan 25, 2018
move exception into Kubeclient namespace
# Conflicts:
#	README.md
#	lib/kubeclient/common.rb
cben added a commit to cben/kubeclient that referenced this pull request Jan 25, 2018
This reverts commit 263ff40 from ManageIQ#271.
Those backport changes are no longer needed:
- after backporting ManageIQ#195 and ManageIQ#233, v2.x now has
  Kubeclient::HttpError and Kubeclient::ResourceNotFoundError.
- after backporting ManageIQ#247, v2.x now tests with webmock 2.x,
  it takes `basic_auth` rather than user:pw in URL.
- ns/namespace change was just cosmetic.

In other words, v2.x branch is now closer to original ManageIQ#262.
@moolitayer
Copy link
Collaborator

@grosser #293

@grosser grosser deleted the grosser/exception branch January 30, 2018 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants