How do I list all the relation variables and debug them interactively?

Posted by mfisch on Ask Ubuntu See other posts from Ask Ubuntu or by mfisch
Published on 2012-11-24T19:15:26Z Indexed on 2012/11/25 17:20 UTC
Read the original article Hit count: 207

Filed under:

I'm writing a charm that requires a mysql database, I found from looking at other charms that this (below) is how I get the info about the database:

user=`relation-get user`
password=`relation-get password`
mysqlhost=`relation-get private-address` 

But I just found that from reading the wordpress charm example, is there a way to show all the relation variables that I can use?

Also, while debugging my db-relation-changed script, I wanted to ssh into my host and interactively run those commands, for example relation-get user, but it didn't work. I resorted to having to restart everything and use juju log to print them out. This wasted a lot of time. Is there a way to print out these relations, either from my dev box or from the instance running my charm? (Below is what happens when I tried to interactively run relation-get):

ubuntu@mfisch-local-tracks-0:~$ relation-get user
usage: relation-get [-h] [-o OUTPUT] [-s SOCKET] [--client-id CLIENT_ID]
                    [--format FORMAT] [--log-file FILE]
                    [--log-level CRITICAL|DEBUG|INFO|ERROR|WARNING]
                    [-r RELATION ID]
                    [settings_name] [unit_name]
No JUJU_AGENT_SOCKET/-s option found

I tried juju debug-hooks tracks/0 -e local, that dropped me into a shell and relation-get still failed.

© Ask Ubuntu or respective owner

Related posts about juju