Example #1
0
def pgsql_db_joined():
    if hookenv.is_relation_made('shared-db'):
        # raise error
        e = ('Attempting to associate a postgresql database when'
             ' there is already associated a mysql one')
        log(e, level=hookenv.ERROR)
        raise Exception(e)

    hookenv.relation_set(database=config('database'))
Example #2
0
def db_joined(rid=None):
    if hookenv.is_relation_made('pgsql-db'):
        # error, postgresql is used
        e = ('Attempting to associate a mysql database when there is already '
             'associated a postgresql one')
        log(e, level=hookenv.ERROR)
        raise Exception(e)

    hookenv.relation_set(relation_id=rid,
                         nova_database=config('database'),
                         nova_username=config('database-user'),
                         nova_hostname=hookenv.unit_get('private-address'))