[freyes,r=hopem]
Ensure that get_mon_hosts() uses provided ceph-public-address not private-address from ceph relation. Closes-Bug: 1449279
This commit is contained in:
commit
e1de91f338
@ -199,11 +199,9 @@ def get_mon_hosts():
|
||||
hosts = []
|
||||
for relid in relation_ids('mon'):
|
||||
for unit in related_units(relid):
|
||||
hosts.append(
|
||||
'{}:6789'.format(get_host_ip(
|
||||
relation_get('private-address',
|
||||
unit, relid)))
|
||||
)
|
||||
host_ip = get_host_ip(relation_get('ceph-public-address',
|
||||
unit, relid))
|
||||
hosts.append('{}:6789'.format(host_ip))
|
||||
|
||||
hosts.sort()
|
||||
return hosts
|
||||
|
@ -213,8 +213,13 @@ class CephRadosGWTests(CharmTestCase):
|
||||
def test_get_mon_hosts(self):
|
||||
self.relation_ids.return_value = ['monrelid']
|
||||
self.related_units.return_value = ['monunit']
|
||||
self.relation_get.return_value = '10.0.0.1'
|
||||
self.get_host_ip.return_value = '10.0.0.1'
|
||||
|
||||
def rel_get(k, *args):
|
||||
return {'private-address': '127.0.0.1',
|
||||
'ceph-public-address': '10.0.0.1'}[k]
|
||||
|
||||
self.relation_get.side_effect = rel_get
|
||||
self.get_host_ip.side_effect = lambda x: x
|
||||
self.assertEquals(ceph_hooks.get_mon_hosts(), ['10.0.0.1:6789'])
|
||||
|
||||
def test_get_conf(self):
|
||||
|
@ -25,7 +25,7 @@ def load_config():
|
||||
|
||||
if not config:
|
||||
logging.error('Could not find config.yaml in any parent directory '
|
||||
'of %s. ' % file)
|
||||
'of %s. ' % f)
|
||||
raise Exception
|
||||
|
||||
return yaml.safe_load(open(config).read())['options']
|
||||
|
Loading…
Reference in New Issue
Block a user