Use restore heat_ prefix for shared-db relation
Heat is staying in status blocked Missing relation database when
doing an upgrade from stable to next. Missing required data:
database_password. The relation is actually passing heat_password.
Commit 1bdc87f495
removed the heat_
prefix. This changes restores the heat_ prefix to allow stable to
next upgrades to work.
Change-Id: Id87afd5eda14eceac6c734867f9f96328c116c79
Closes-Bug: #1571830
This commit is contained in:
parent
6abd6f966c
commit
cc6811b7f7
|
@ -5,3 +5,6 @@ bin
|
||||||
tags
|
tags
|
||||||
*.sw[nop]
|
*.sw[nop]
|
||||||
*.pyc
|
*.pyc
|
||||||
|
precise/
|
||||||
|
trusty/
|
||||||
|
xenial/
|
||||||
|
|
|
@ -175,9 +175,9 @@ def db_joined():
|
||||||
# NOTE: fallback to private-address
|
# NOTE: fallback to private-address
|
||||||
host = unit_get('private-address')
|
host = unit_get('private-address')
|
||||||
|
|
||||||
relation_set(database=config('database'),
|
relation_set(heat_database=config('database'),
|
||||||
username=config('database-user'),
|
heat_username=config('database-user'),
|
||||||
hostname=host)
|
heat_hostname=host)
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('shared-db-relation-changed')
|
@hooks.hook('shared-db-relation-changed')
|
||||||
|
@ -189,7 +189,7 @@ def db_changed():
|
||||||
CONFIGS.write(HEAT_CONF)
|
CONFIGS.write(HEAT_CONF)
|
||||||
|
|
||||||
if is_elected_leader(CLUSTER_RES):
|
if is_elected_leader(CLUSTER_RES):
|
||||||
allowed_units = relation_get('allowed_units')
|
allowed_units = relation_get('heat_allowed_units')
|
||||||
if allowed_units and local_unit() in allowed_units.split():
|
if allowed_units and local_unit() in allowed_units.split():
|
||||||
log('Cluster leader, performing db sync')
|
log('Cluster leader, performing db sync')
|
||||||
migrate_database()
|
migrate_database()
|
||||||
|
|
|
@ -84,7 +84,8 @@ CONFIG_FILES = OrderedDict([
|
||||||
(HEAT_CONF, {
|
(HEAT_CONF, {
|
||||||
'services': BASE_SERVICES,
|
'services': BASE_SERVICES,
|
||||||
'contexts': [context.AMQPContext(ssl_dir=HEAT_DIR),
|
'contexts': [context.AMQPContext(ssl_dir=HEAT_DIR),
|
||||||
context.SharedDBContext(ssl_dir=HEAT_DIR),
|
context.SharedDBContext(relation_prefix='heat',
|
||||||
|
ssl_dir=HEAT_DIR),
|
||||||
context.OSConfigFlagContext(),
|
context.OSConfigFlagContext(),
|
||||||
HeatIdentityServiceContext(service=SVC, service_user=SVC),
|
HeatIdentityServiceContext(service=SVC, service_user=SVC),
|
||||||
HeatHAProxyContext(),
|
HeatHAProxyContext(),
|
||||||
|
|
|
@ -331,9 +331,9 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||||
relation = ['shared-db', 'mysql:shared-db']
|
relation = ['shared-db', 'mysql:shared-db']
|
||||||
expected = {
|
expected = {
|
||||||
'private-address': u.valid_ip,
|
'private-address': u.valid_ip,
|
||||||
'database': 'heat',
|
'heat_database': 'heat',
|
||||||
'username': 'heat',
|
'heat_username': 'heat',
|
||||||
'hostname': u.valid_ip
|
'heat_hostname': u.valid_ip
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = u.validate_relation_data(unit, relation, expected)
|
ret = u.validate_relation_data(unit, relation, expected)
|
||||||
|
@ -349,8 +349,8 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||||
expected = {
|
expected = {
|
||||||
'private-address': u.valid_ip,
|
'private-address': u.valid_ip,
|
||||||
'db_host': u.valid_ip,
|
'db_host': u.valid_ip,
|
||||||
'allowed_units': 'heat/0',
|
'heat_allowed_units': 'heat/0',
|
||||||
'password': u.not_null
|
'heat_password': u.not_null
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = u.validate_relation_data(unit, relation, expected)
|
ret = u.validate_relation_data(unit, relation, expected)
|
||||||
|
@ -454,7 +454,7 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||||
u.log.debug('mysql:heat relation: {}'.format(mysql_rel))
|
u.log.debug('mysql:heat relation: {}'.format(mysql_rel))
|
||||||
|
|
||||||
db_uri = "mysql://{}:{}@{}/{}".format('heat',
|
db_uri = "mysql://{}:{}@{}/{}".format('heat',
|
||||||
mysql_rel['password'],
|
mysql_rel['heat_password'],
|
||||||
mysql_rel['db_host'],
|
mysql_rel['db_host'],
|
||||||
'heat')
|
'heat')
|
||||||
|
|
||||||
|
|
|
@ -113,17 +113,17 @@ class HeatRelationTests(CharmTestCase):
|
||||||
self.network_get_primary_address.return_value = '192.168.20.1'
|
self.network_get_primary_address.return_value = '192.168.20.1'
|
||||||
self.unit_get.return_value = 'heat.foohost.com'
|
self.unit_get.return_value = 'heat.foohost.com'
|
||||||
relations.db_joined()
|
relations.db_joined()
|
||||||
self.relation_set.assert_called_with(database='heat',
|
self.relation_set.assert_called_with(heat_database='heat',
|
||||||
username='heat',
|
heat_username='heat',
|
||||||
hostname='192.168.20.1')
|
heat_hostname='192.168.20.1')
|
||||||
self.assertFalse(self.unit_get.called)
|
self.assertFalse(self.unit_get.called)
|
||||||
|
|
||||||
def test_db_joined(self):
|
def test_db_joined(self):
|
||||||
self.unit_get.return_value = 'heat.foohost.com'
|
self.unit_get.return_value = 'heat.foohost.com'
|
||||||
relations.db_joined()
|
relations.db_joined()
|
||||||
self.relation_set.assert_called_with(database='heat',
|
self.relation_set.assert_called_with(heat_database='heat',
|
||||||
username='heat',
|
heat_username='heat',
|
||||||
hostname='heat.foohost.com')
|
heat_hostname='heat.foohost.com')
|
||||||
self.unit_get.assert_called_with('private-address')
|
self.unit_get.assert_called_with('private-address')
|
||||||
|
|
||||||
def _shared_db_test(self, configs):
|
def _shared_db_test(self, configs):
|
||||||
|
|
Loading…
Reference in New Issue