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
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,3 +5,6 @@ bin
|
||||
tags
|
||||
*.sw[nop]
|
||||
*.pyc
|
||||
precise/
|
||||
trusty/
|
||||
xenial/
|
||||
|
@ -175,9 +175,9 @@ def db_joined():
|
||||
# NOTE: fallback to private-address
|
||||
host = unit_get('private-address')
|
||||
|
||||
relation_set(database=config('database'),
|
||||
username=config('database-user'),
|
||||
hostname=host)
|
||||
relation_set(heat_database=config('database'),
|
||||
heat_username=config('database-user'),
|
||||
heat_hostname=host)
|
||||
|
||||
|
||||
@hooks.hook('shared-db-relation-changed')
|
||||
@ -189,7 +189,7 @@ def db_changed():
|
||||
CONFIGS.write(HEAT_CONF)
|
||||
|
||||
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():
|
||||
log('Cluster leader, performing db sync')
|
||||
migrate_database()
|
||||
|
@ -84,7 +84,8 @@ CONFIG_FILES = OrderedDict([
|
||||
(HEAT_CONF, {
|
||||
'services': BASE_SERVICES,
|
||||
'contexts': [context.AMQPContext(ssl_dir=HEAT_DIR),
|
||||
context.SharedDBContext(ssl_dir=HEAT_DIR),
|
||||
context.SharedDBContext(relation_prefix='heat',
|
||||
ssl_dir=HEAT_DIR),
|
||||
context.OSConfigFlagContext(),
|
||||
HeatIdentityServiceContext(service=SVC, service_user=SVC),
|
||||
HeatHAProxyContext(),
|
||||
|
@ -331,9 +331,9 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||
relation = ['shared-db', 'mysql:shared-db']
|
||||
expected = {
|
||||
'private-address': u.valid_ip,
|
||||
'database': 'heat',
|
||||
'username': 'heat',
|
||||
'hostname': u.valid_ip
|
||||
'heat_database': 'heat',
|
||||
'heat_username': 'heat',
|
||||
'heat_hostname': u.valid_ip
|
||||
}
|
||||
|
||||
ret = u.validate_relation_data(unit, relation, expected)
|
||||
@ -349,8 +349,8 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||
expected = {
|
||||
'private-address': u.valid_ip,
|
||||
'db_host': u.valid_ip,
|
||||
'allowed_units': 'heat/0',
|
||||
'password': u.not_null
|
||||
'heat_allowed_units': 'heat/0',
|
||||
'heat_password': u.not_null
|
||||
}
|
||||
|
||||
ret = u.validate_relation_data(unit, relation, expected)
|
||||
@ -454,7 +454,7 @@ class HeatBasicDeployment(OpenStackAmuletDeployment):
|
||||
u.log.debug('mysql:heat relation: {}'.format(mysql_rel))
|
||||
|
||||
db_uri = "mysql://{}:{}@{}/{}".format('heat',
|
||||
mysql_rel['password'],
|
||||
mysql_rel['heat_password'],
|
||||
mysql_rel['db_host'],
|
||||
'heat')
|
||||
|
||||
|
@ -113,17 +113,17 @@ class HeatRelationTests(CharmTestCase):
|
||||
self.network_get_primary_address.return_value = '192.168.20.1'
|
||||
self.unit_get.return_value = 'heat.foohost.com'
|
||||
relations.db_joined()
|
||||
self.relation_set.assert_called_with(database='heat',
|
||||
username='heat',
|
||||
hostname='192.168.20.1')
|
||||
self.relation_set.assert_called_with(heat_database='heat',
|
||||
heat_username='heat',
|
||||
heat_hostname='192.168.20.1')
|
||||
self.assertFalse(self.unit_get.called)
|
||||
|
||||
def test_db_joined(self):
|
||||
self.unit_get.return_value = 'heat.foohost.com'
|
||||
relations.db_joined()
|
||||
self.relation_set.assert_called_with(database='heat',
|
||||
username='heat',
|
||||
hostname='heat.foohost.com')
|
||||
self.relation_set.assert_called_with(heat_database='heat',
|
||||
heat_username='heat',
|
||||
heat_hostname='heat.foohost.com')
|
||||
self.unit_get.assert_called_with('private-address')
|
||||
|
||||
def _shared_db_test(self, configs):
|
||||
|
Loading…
Reference in New Issue
Block a user