-
Notifications
You must be signed in to change notification settings - Fork 386
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
KazooClient hosts list should accept a list of multiple endpoints. #424
KazooClient hosts list should accept a list of multiple endpoints. #424
Conversation
Looks fantastic, nice job. I'm not super excited about a list supporting both strings and tuples as formats, but OTOH while the strings are extremely common format for most libraries the tuples are very explicit, so it is handy to have both. So I support your decision to support both formats. Could you add two more test cases where the hostname is an IP address and not a domain name? |
@jeffwidman Thanks for the comment, very insightful. Gonna add more test cases. 👍 |
Some test failures. The python 2.6 failure is probably acceptable breakage as it doesn't support ipv6, that's up to the maintainers, but the inconsistent use of tabs/spaces should get fixed before merging. |
@jeffwidman Thanks, gonna fix the inconsistency asap. Even on python 2.7, I've found that |
@jeffwidman Hi, I tried to fix the inconsistencies between tabs/spaces. Hope everything is fine now, but let me know if something skipped, please 😃 @harlowja Does this PR makes sense? Any other file to change? Please, let me know. Best regards! |
LGTM. Spot-checked a few test failures and they are python 2.6 choking on IPv6. Personally, I think this lib should solve that by dropping support for python 2, but I'm not one of the maintainers, so that's up them. |
@harlowja Any comment on this? |
We can't drop support for Python 2, though I would like to drop support for Python 2.6 as that should be long dead. Can this be made to work for Python 2.6? |
@jeffwidman you seem most active on github and this PR, would you be up for fixing this to work on Python 2.6? If so I can include it in the next release. As is, I'm closing this for now, but please re-open it if changes are made that allow this to be merged. |
@bbangert Thanks for looking at this. Like the other PR's that you just closed that I commented on, I do think it's a bit premature to close this one as well. There was zero feedback on this from any of the maintainers until last night, so I don't blame @eribeiro for not spending any time on this until he knew whether it actually had a chance of getting merged. I've literally never seen another project where a PR in process is marked as closed like this when the maintainers are interested in it, but just requesting further updates. Typically my experience is that marking something as Personally, I'd prefer to help @eribeiro finish this by giving feedback etc rather than me finishing it as it's better in the long run to encourage someone new to open source, plus he deserves the credit as he already did the brunt of the work. So @eribeiro if you want to work on this, I'm happy to help you with reviews or answering any questions so that this is in a place that it can be merged. |
Sorry about that, due to the backlog of PR's kazoo ended up in a bad situation where there's just so many PR's I have no way to track which ones people are interested in updating, and which ones people aren't. The longer the PR list, the less anyone wanted to maintain Kazoo at all, so clearing them out so that it was clear what was actionable and what wasn't feels like the only sane UX hack around a bad usability issue. (If only Github would let me 'snooze' a PR so that it can easily be filtered out). If you have any suggestions for alternative ways to filter out PR's that are desired but out-of-date, I'd love to use that as it wasn't my intention at all to insult/annoy anyone. This was the most immediate and obvious way to filter the list of actionable PR's that I could see, so I went that route. Sorry again about not being able to look into this earlier. |
Regarding 2.6 support, I'm fine ignoring that now that we'll be dropping Python 2.6 support. I think the PR only needs a rebase and it'll be good to go. I'll re-open it and see if GH can automatically rebase 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.
👍
I completely understand. I help maintain a number of projects that accumulate this kind of crufty backlog, and I myself go through and close old PR's that have been sitting idle longer than 6-12 months, it's just that I try to give folks a gentle nudge first, especially if it looks like they're first-time contributors to open source. |
Oh, the only other update this needs is the commit needs to be altered to the style in the CONTRIBUTING doc. Otherwise the change won't be included in the CHANGES.md file. If the original author needs any help updating the commit and force pushing I'd be happy to help, a rebase and commit update should also remove the need for my merge commit. |
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.
Needs to have the commit updated per the CONTRIBUTING guidelines. I can update if desired, but I'd like @eribeiro to retain credit for this, so if you're still interested @eribeiro I'd be happy to help you update the commit as needed. I've re-opened this so that we can verify the tests pass now that Python 2.6 was dropped and it looks good!
This is what I'd expect the commit to look like:
feat(core): allow multiple endpoints in KazooClient hosts arg
The hosts arg to KazooClient now supports a list of multiple endpoints.
Closes #411
@eribeiro Did you want to update this? |
I haven't forgotten about this either, and if @eribeiro doesn't drop in, I am happy to update this as well. |
kazoo/tests/test_hosts.py
Outdated
self.assertEquals(expected2, chroot) | ||
|
||
|
||
hosts, chroot = collect_hosts(['zk01:2181', 'zk02:2181', 'zk03:2181', '/test']) |
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.
too many blank lines (2)
line too long (87 > 79 characters)
kazoo/tests/test_hosts.py
Outdated
self.assertEquals(None, chroot) | ||
|
||
|
||
hosts, chroot = collect_hosts(['zk01:2181', 'zk02:2181', 'zk03:2181']) |
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.
too many blank lines (2)
kazoo/tests/test_hosts.py
Outdated
def test_hosts_list(self): | ||
|
||
hosts, chroot = collect_hosts('zk01:2181, zk02:2181, zk03:2181') | ||
expected1 = [('zk01',2181), ('zk02', 2181), ('zk03', 2181)] |
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.
missing whitespace after ','
kazoo/tests/test_hosts.py
Outdated
self.assertEquals(None, chroot) | ||
|
||
|
||
def test_hosts_list(self): |
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.
too many blank lines (2)
kazoo/tests/test_hosts.py
Outdated
self.assertEquals(None, chroot) | ||
|
||
|
||
def test_ipv6(self): |
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.
too many blank lines (2)
kazoo/tests/test_hosts.py
Outdated
self.assertEquals([('127.0.0.1', 2181), ('192.168.1.2', 2181), ('132.254.111.10', 2181)], hosts) | ||
self.assertEquals(None, chroot) | ||
|
||
hosts, chroot = collect_hosts(['127.0.0.1:2181', '192.168.1.2:2181', '132.254.111.10:2181']) |
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.
line too long (100 > 79 characters)
kazoo/tests/test_hosts.py
Outdated
|
||
def test_ipv4(self): | ||
hosts, chroot = collect_hosts('127.0.0.1:2181, 192.168.1.2:2181, 132.254.111.10:2181') | ||
self.assertEquals([('127.0.0.1', 2181), ('192.168.1.2', 2181), ('132.254.111.10', 2181)], hosts) |
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.
line too long (104 > 79 characters)
kazoo/tests/test_hosts.py
Outdated
class HostsTestCase(TestCase): | ||
|
||
def test_ipv4(self): | ||
hosts, chroot = collect_hosts('127.0.0.1:2181, 192.168.1.2:2181, 132.254.111.10:2181') |
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.
line too long (94 > 79 characters)
kazoo/tests/test_hosts.py
Outdated
@@ -0,0 +1,48 @@ | |||
import sys |
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.
'sys' imported but unused
kazoo/hosts.py
Outdated
"""Collect a set of hosts and an optional chroot from a string.""" | ||
host_ports, chroot = hosts.partition("/")[::2] | ||
chroot = "/" + chroot if chroot else None | ||
"""Collect a set of hosts and an optional chroot from a string or a list of strings. |
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.
line too long (84 > 79 characters)
@jeffwidman @bbangert Hey, thanks for taking your time to discuss and instruct me on improving this PR. It is really appreciated! 😃 Well, I have changed the commit message to the one indicated by bbangert as well as rebased the branch to the master. Please, let me know if there's any other pending work on this PR. I am glad to make any required changes. |
kazoo/tests/test_hosts.py
Outdated
self.assertEquals(expected2, chroot) | ||
|
||
|
||
hosts, chroot = collect_hosts(['zk01:2181', |
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.
too many blank lines (2)
kazoo/hosts.py
Outdated
host_ports, chroot = hosts.partition("/")[::2] | ||
chroot = "/" + chroot if chroot else None | ||
""" | ||
Collect a set of hosts and an optional chroot from |
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.
trailing whitespace
The hosts arg to KazooClient now supports a list of multiple endpoints. Closes #411
@eribeiro thanks! nice work! |
@jeffwidman @bbangert Thanks a lot for your support and patience. It meant a lot to me. 👍 |
Closes #411