-
Notifications
You must be signed in to change notification settings - Fork 210
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
Final etcd 0.2.0 support #14
Conversation
The client is probably completely broken, if write() doesn't work: Python:
results in this response:
where "node" is unexpected:
Currently allowed keys (which probably don't even need to be mentioned):
There's also a problem with not catching 404s due to non-absolute paths:
Obviously, it's probably better to enforce '/' as the first character rather than catching 404s. |
@dsoprea if you use my branch (or this pull request) write() is not broken; what is actually on master works only with v0.2.0-rc1. I can't say I'm happy with versioning in etcd... About 404s: we may as well catch if a path does not begin with a / and raise an error before performing the request. Can you open a separate issue on that? |
@lavagetto The PR looks good to me. Just a couple of details I miss in it: When executing the tests we get a couple of warnings due to the changed parameters in the server:
Would you change those calls? Another thing I'm missing is some str implementation in EtcdResult so we can do: >>> import etcd
>>> client = etcd.Client()
>>> r = client.write('/nodes/n1', 1)
>>> print r
# The actual result would be something like
<etcd.EtcdResult object at 0x101f85190>
# A better output would be:
({'newKey': None, '_children': [], 'createdIndex': 7, 'modifiedIndex': 7, 'value': u'1', 'expiration': None, 'key': u'/nodes/n1', 'ttl': None, 'action': u'set', 'dir': None, 'prevValue': None}) Probably something like def __str__(self):
return "(%r)" % (self.__dict__) Would be enough, right? That would let new library users initially "play" with etc from the ipython/python console in a easier way. I'm of course open to suggestions, we could just merge this PR without further ado and commit these "cosmetic" changes later. As for @dsoprea problem, AFAIK we can't really know from the client side which 'real' version of the server are we talking to. When I do something like: $ curl http://127.0.0.1:7001/version
2 even when using other rc's. Probably it's a fair request for upstream, get some real server versioning either in the /version endpoint or in a header for every request (which would be even better as we wouldn't need an additional request and we would't have to deal with an avalanche of version requests when new clients are started). On the 404 problem, I'd do both, force "/" AND catch the exception returning something meaningful to the final user, just to be on the safe side. |
I'll use the pull-request, as I don't seem to see a branch that seems to be Would you like some help? It seems like there are things in etcd changing Dustin On Mon, Dec 30, 2013 at 2:01 AM, Giuseppe Lavagetto <
|
@jplana your comments are perfectly sound, I'll wrap something up this evening, and update the pull request. |
I've started working on the lock primitive, based off this branch. Would love some feedback on the API here: #17. |
I fixed the few issues we had. @jplana I think this is mergeable now. We still need to remove "prevValue" as it's been dropped, but I'll just open an issue for that after everything is merged. |
Looks good to me. Merging. |
I had to change a few things, given the different structure of the actual server response.
I created the client.children generator that can parse any directory response, even recursive.
What is still missing is support for lock and leader election primitives; after that, we can release the first client to be completely v2 compliant :)