Adds missing implementation of etcd-proxy #32

Merged
merged 2 commits into from Jul 7, 2016

Conversation

Projects
None yet
3 participants
Collaborator

chuckbutler commented Jun 30, 2016

The proxy relation now properly sends cluster peer details, and client connection credentials.

Adds missing implementation of etcd-proxy
The proxy relation now properly sends cluster peer details, and client connection credentials.
Contributor

neiljerram commented Jun 30, 2016

Thanks - LGTM.

Syntax error
Fixing the iterator identifier, and properly scoping calls to find keys/data.
+ peers = etcdctl.member_list()
+ cluster = []
+ for peer in peers:
+ thispeer = peers[peer]
@mbruzek

mbruzek Jul 1, 2016

Contributor

Isn't "peer" the same as "thispeer" in this case? Or am I missing a subtlety?

@chuckbutler

chuckbutler Jul 1, 2016

Collaborator

peer becomes the string key of the dict.

'etcd0', so i use it as a scope operator for the dict. We can revise that for better clarity, as i had the same incorrect assumption initially

@mbruzek

mbruzek Jul 7, 2016

Contributor

for peer in peers: will create an iterator that makes the peer variable every member of the peers list.
thispeer = peers[peer] is the same thing as peer is it not?

@chuckbutler

chuckbutler Jul 7, 2016

Collaborator

I encourage you to run that, debug it, and tell me what you see. I'm consistently seeing it evaluate to the key, and not the dict of values contained at that key.

Collaborator

chuckbutler commented Jul 5, 2016

@mbruzek was there something we wanted to do with this implementation? @neiljerram has given me a sign off in IRC that it works for their purposes.

Contributor

mbruzek commented Jul 7, 2016

@chuckbutler I have no problems with this change, the for loop looks a little strange to me, I still think peer and thispeer are equivalent and I don't understand the difference. That looks like unnecessary code to me, but if there is a subtlety that I am missing, a comment would clear that up.

Contributor

mbruzek commented Jul 7, 2016

OK I am finally +1 to this change.

etcdctl.member_list() actually returns a dictionary (not a list as the method name would imply), so the iterator is on the keys and you need to get the peer member by the key name.

@mbruzek mbruzek merged commit da7aaed into juju-solutions:master Jul 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment