Use get_relation_ip for database access

This commit is contained in:
James Page 2017-08-01 15:56:27 +01:00
parent 5db00732c3
commit a5ae220b78
1 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import os
import collections
import subprocess
import charmhelpers.contrib.network.ip as ch_ip
import charmhelpers.core.hookenv as hookenv
import charmhelpers.core.host as host
@ -34,6 +35,8 @@ CEPH_CONF = '/etc/ceph/ceph.conf'
CEPH_POOL_NAME = 'gnocchi'
DB_INTERFACE = 'shared-db'
# TODO(jamespage): charms.openstack
class StorageCephRelationAdapter(adapters.OpenStackRelationAdapter):
@ -167,7 +170,7 @@ class GnocchiCharm(charms_openstack.charm.HAOpenStackCharm):
return [{
'database': 'gnocchi',
'username': 'gnocchi',
'hostname': hookenv.unit_private_ip()}, ]
'hostname': ch_ip.get_relation_ip(DB_INTERFACE)}, ]
def disable_services(self):
'''Disable all services related to gnocchi'''