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

client object instantiates with a bad url #18

Closed
juliedavila opened this issue Jul 20, 2015 · 4 comments
Closed

client object instantiates with a bad url #18

juliedavila opened this issue Jul 20, 2015 · 4 comments
Labels
waiting-reply waiting for more information (probably for a while)

Comments

@juliedavila
Copy link

With hvac 0.2.3 on OSX

Currently, passing in a bad url doesn't throw any error or exception

Doing:

client = hvac.Client(url='http:https://234.244.22.2:8200', token='sometoken')

Successfully creates the client object. I think it should probably be validated in __init__ and throw a ConnectionError exception.

I'll get around to submitting a PR sometime this week if you agree with me.

@ianunruh
Copy link
Member

How would you propose to validate the URL? I'd like to avoid doing an HTTP request in __init__ if possible.

@juliedavila
Copy link
Author

My initial idea was to make a request. If not a request then we could do smth with urlparse + regex. It's not easy without resorting to a HTTP request.

The other issue is b/c the object can be instantiated, calling something like is_authenticated() makes the code hang indefinitely when the object is created with a bad endpoint.

I agree it's not pretty to do it within __init__, though do you think it is better for there to be no error/exception when a specified endpoint is invalid? Perhaps we could make a is_valid_endpoint() method (or smth along those lines).

@ianunruh
Copy link
Member

If it is hanging indefinitely, that is an issue. Have you experienced this? requests should eventually timeout.

@ianunruh ianunruh added the waiting-reply waiting for more information (probably for a while) label Jul 24, 2015
@ianunruh
Copy link
Member

I'm going to go ahead and close this. Please feel free to reopen if this problem still affects you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-reply waiting for more information (probably for a while)
Projects
None yet
Development

No branches or pull requests

2 participants