Unclear how to use relation-get when outside relation hooks

I am implementing two charms to relate to one another, I have a tmux session now in one of the two charms, and I am trying to explore how to check in update-status incase Charm 1 can update some of it’s relation-set data… however…

I cannot figure out what I am supposed to do, to query the relation when outside the relation hooks

am I just missing something here ?

My status

edit: Thanks to an obscure post on github… I found out you have to add a random dash ?


relation-get -r ibsocket:31 - sample-thrift-charm/44

this seems not really clear, to me reading the MAN page

1 Like

The output of relation-get --help includes:

relation-get prints the value of a unit’s relation setting, specified by key.
If no key is given, or if the key is “-”, all keys and values will be printed.

While that’s mostly straightforward, the “if not key is given” bit definitely seems misleading, as the - is obviously required. It would be nice if that requirement were dropped and the tool would notice if you don’t specify a key and not assume that the unit name is the key.

1 Like

Thanks Cory,

I printed the output of relation-get --help for the very reason that it is not showing any dashes … and so I never knew to add one until I went to a random github gist … or am I just blind and there is a dash somewhere ?

All I see pertinent to this was the

relation-get [options] <key> <unit id>

no single dashes are present there, or maybe I am just misinterpreting what <key> is ?

Juju is/has got a new subcommand:

juju show-unit

… that will assist in introspection like this.

1 Like