Trying to understand relation scope

Andreas Hasenack andreas at canonical.com
Sat Jun 1 18:39:18 UTC 2013


Hi,

in trying to understand relation scope, I came up with two simple charms
which basically just set a value in a relation (the "server") and the
clients who read it back.

The charms are at:

andreas-server: http://pastebin.ubuntu.com/5723757/
andreas-client: http://pastebin.ubuntu.com/5723759/

When I join them first, one unit of each, all is fine. The "server" sets
the token and the client sees it:
2013/06/01 18:01:01 INFO andreas-server/0 tokenizer:0: Checking if
token_andreas-client_0 exists
2013/06/01 18:01:01 INFO andreas-server/0 tokenizer:0: Setting
token_andreas-client_0 to 3802e3ac-cae5-11e2-ad5e-4382496fe885

The client:
1st changed hook call, right after joined: value is not there yet, which I
understand:
2013/06/01 18:00:57 INFO andreas-client/0 tokenizer:0: Token
token_andreas-client_0 empty

changed called again as a result of the server's relation-set, now we have
the value:
2013/06/01 18:01:02 INFO andreas-client/0 tokenizer:0: I haz token!
token_andreas-client_0=3802e3ac-cae5-11e2-ad5e-4382496fe885

Full client log from this first add-relation:
http://pastebin.ubuntu.com/5723785/

Now, I add a server unit. Unfortunately the client gets a new token:
2013/06/01 18:04:12 INFO andreas-client/0 tokenizer:0: I haz token!
token_andreas-client_0=a8078310-cae5-11e2-8a77-43a47a7fcb73


These are the new server unit logs, running the joined hook ("All tokens:"
is just a call to relation-get, which should show everything in that
relation)
2013/06/01 18:04:08 INFO andreas-server/1 tokenizer:0: All tokens:
private-address: 10.55.60.21
2013/06/01 18:04:08 INFO andreas-server/1 tokenizer:0: Checking if
token_andreas-client_0 exists
2013/06/01 18:04:09 INFO andreas-server/1 tokenizer:0: Setting
token_andreas-client_0 to a8078310-cae5-11e2-8a77-43a47a7fcb73


Now, my question: why did the unit, in the relation_joined hook, not see
the token that was already set in the relation by server/0 before and read
by client/0?

I actually loop over all available units and even call this specifically:
2013/06/01 18:04:08 INFO worker/uniter/jujuc: running hook tool
"relation-get" ["-r" "tokenizer:0" "-" "andreas-client/0"]
But all it gets back is "private-address: 10.55.60.21". No sign of the
token. Why?

Full logs from server/1: http://pastebin.ubuntu.com/5723777/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20130601/f81a0b26/attachment.html>


More information about the Juju mailing list