database-relation-join not invoked

Giuseppe Attardi giuseppe.attardi at garr.it
Thu May 25 16:59:52 UTC 2017


I have written a charm for OpenStack Gnocchi.
The service requires a postgresql database relation.

The start hook fails, of course, because the relation is not set.

I expected that, but I expected that when I issue

	juju add-relation gnocchi postgresql:db

it will invoke the database-relation-joined hook, which does set the required parameter and then start would work.
However the hook is not invoked: as a sanity check I set a juju-log message in it and it does not run at all.

Is it correct to assume that add-relation will always trigger database-relation-join?

A second question, I would like to avoid to start the service until the relation has been joined.
What is the best way to test for the relation to be present?

I tried with

	db=`relation-get -r database host`

but it fails with:
	
	INFO start error: invalid value "database" for flag -r: invalid relation id

I am using juju-2.1.2

Thanks for the help.

— Beppe Attardi


More information about the Juju mailing list