Merge "Fix incorrectly applied cluster relation settings"
This commit is contained in:
commit
2029cdf6d0
@ -239,10 +239,7 @@ def cluster_joined(rid=None):
|
|||||||
config('os-{}-network'.format(addr_type))
|
config('os-{}-network'.format(addr_type))
|
||||||
)
|
)
|
||||||
if address:
|
if address:
|
||||||
relation_set(
|
settings['{}-address'.format(addr_type)] = address
|
||||||
relation_id=rid,
|
|
||||||
settings={'{}-address'.format(addr_type): address}
|
|
||||||
)
|
|
||||||
|
|
||||||
if config('prefer-ipv6'):
|
if config('prefer-ipv6'):
|
||||||
private_addr = get_ipv6_addr(exc_list=[config('vip')])[0]
|
private_addr = get_ipv6_addr(exc_list=[config('vip')])[0]
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from mock import (
|
from mock import (
|
||||||
patch,
|
patch, call
|
||||||
)
|
)
|
||||||
|
|
||||||
from test_utils import (
|
from test_utils import (
|
||||||
@ -218,6 +218,28 @@ class CephRadosGWTests(CharmTestCase):
|
|||||||
self.assertEquals(ceph_hooks.canonical_url({}, PUBLIC),
|
self.assertEquals(ceph_hooks.canonical_url({}, PUBLIC),
|
||||||
'http://[%s]' % ipv6_addr)
|
'http://[%s]' % ipv6_addr)
|
||||||
|
|
||||||
|
@patch.object(ceph_hooks, 'get_address_in_network')
|
||||||
|
def test_cluster_joined(self, mock_get_addr):
|
||||||
|
addrs = {'10.0.0.0/24': '10.0.0.1',
|
||||||
|
'10.0.1.0/24': '10.0.1.1',
|
||||||
|
'10.0.2.0/24': '10.0.2.1'}
|
||||||
|
|
||||||
|
def fake_get_address_in_network(network):
|
||||||
|
return addrs.get(network)
|
||||||
|
|
||||||
|
mock_get_addr.side_effect = fake_get_address_in_network
|
||||||
|
|
||||||
|
self.test_config.set('os-public-network', '10.0.0.0/24')
|
||||||
|
self.test_config.set('os-admin-network', '10.0.1.0/24')
|
||||||
|
self.test_config.set('os-internal-network', '10.0.2.0/24')
|
||||||
|
|
||||||
|
ceph_hooks.cluster_joined()
|
||||||
|
self.relation_set.assert_has_calls(
|
||||||
|
[call(relation_id=None,
|
||||||
|
**{'admin-address': '10.0.1.1',
|
||||||
|
'internal-address': '10.0.2.1',
|
||||||
|
'public-address': '10.0.0.1'})])
|
||||||
|
|
||||||
def test_cluster_changed(self):
|
def test_cluster_changed(self):
|
||||||
_id_joined = self.patch('identity_joined')
|
_id_joined = self.patch('identity_joined')
|
||||||
self.relation_ids.return_value = ['rid']
|
self.relation_ids.return_value = ['rid']
|
||||||
|
Loading…
Reference in New Issue
Block a user