Drop postgresql support
Remove postgresql DB support; This feature is untested as part of the charms, is not in use and was deprecated as part of the 1708 charms release. Change-Id: I327a686a35edf9b6ff5c1c3cbc4165f8faeef688
This commit is contained in:
parent
7ae5ab6a28
commit
7b9feea400
@ -28,7 +28,6 @@ from charmhelpers.core.hookenv import (
|
|||||||
config,
|
config,
|
||||||
is_relation_made,
|
is_relation_made,
|
||||||
log,
|
log,
|
||||||
ERROR,
|
|
||||||
relation_ids,
|
relation_ids,
|
||||||
remote_service_name,
|
remote_service_name,
|
||||||
related_units,
|
related_units,
|
||||||
@ -248,32 +247,12 @@ def amqp_changed():
|
|||||||
|
|
||||||
@hooks.hook('shared-db-relation-joined')
|
@hooks.hook('shared-db-relation-joined')
|
||||||
def db_joined(rid=None):
|
def db_joined(rid=None):
|
||||||
if is_relation_made('pgsql-db'):
|
|
||||||
# error, postgresql is used
|
|
||||||
e = ('Attempting to associate a mysql database when there is already '
|
|
||||||
'associated a postgresql one')
|
|
||||||
log(e, level=ERROR)
|
|
||||||
raise Exception(e)
|
|
||||||
|
|
||||||
relation_set(relation_id=rid,
|
relation_set(relation_id=rid,
|
||||||
nova_database=config('database'),
|
nova_database=config('database'),
|
||||||
nova_username=config('database-user'),
|
nova_username=config('database-user'),
|
||||||
nova_hostname=get_relation_ip('shared-db'))
|
nova_hostname=get_relation_ip('shared-db'))
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('pgsql-db-relation-joined')
|
|
||||||
def pgsql_db_joined():
|
|
||||||
if is_relation_made('shared-db'):
|
|
||||||
# raise error
|
|
||||||
e = ('Attempting to associate a postgresql database when'
|
|
||||||
' there is already associated a mysql one')
|
|
||||||
log(e, level=ERROR)
|
|
||||||
raise Exception(e)
|
|
||||||
|
|
||||||
relation_set(**{'database': config('database'),
|
|
||||||
'private-address': get_relation_ip('psql-db')})
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('shared-db-relation-changed')
|
@hooks.hook('shared-db-relation-changed')
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def db_changed():
|
def db_changed():
|
||||||
@ -283,15 +262,6 @@ def db_changed():
|
|||||||
CONFIGS.write(NOVA_CONF)
|
CONFIGS.write(NOVA_CONF)
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('pgsql-db-relation-changed')
|
|
||||||
@restart_on_change(restart_map())
|
|
||||||
def postgresql_db_changed():
|
|
||||||
if 'pgsql-db' not in CONFIGS.complete_contexts():
|
|
||||||
log('pgsql-db relation incomplete. Peer not ready?')
|
|
||||||
return
|
|
||||||
CONFIGS.write(NOVA_CONF)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('image-service-relation-changed')
|
@hooks.hook('image-service-relation-changed')
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def image_service_changed():
|
def image_service_changed():
|
||||||
@ -421,8 +391,7 @@ def ceph_broken():
|
|||||||
|
|
||||||
@hooks.hook('amqp-relation-broken',
|
@hooks.hook('amqp-relation-broken',
|
||||||
'image-service-relation-broken',
|
'image-service-relation-broken',
|
||||||
'shared-db-relation-broken',
|
'shared-db-relation-broken')
|
||||||
'pgsql-db-relation-broken')
|
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def relation_broken():
|
def relation_broken():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
@ -207,7 +207,6 @@ BASE_RESOURCE_MAP = {
|
|||||||
'contexts': [context.AMQPContext(ssl_dir=NOVA_CONF_DIR),
|
'contexts': [context.AMQPContext(ssl_dir=NOVA_CONF_DIR),
|
||||||
context.SharedDBContext(
|
context.SharedDBContext(
|
||||||
relation_prefix='nova', ssl_dir=NOVA_CONF_DIR),
|
relation_prefix='nova', ssl_dir=NOVA_CONF_DIR),
|
||||||
context.PostgresqlDBContext(),
|
|
||||||
context.ImageServiceContext(),
|
context.ImageServiceContext(),
|
||||||
context.OSConfigFlagContext(),
|
context.OSConfigFlagContext(),
|
||||||
CloudComputeContext(),
|
CloudComputeContext(),
|
||||||
@ -960,8 +959,8 @@ def get_optional_relations():
|
|||||||
optional_interfaces['storage-backend'] = ['ceph']
|
optional_interfaces['storage-backend'] = ['ceph']
|
||||||
if relation_ids('neutron-plugin'):
|
if relation_ids('neutron-plugin'):
|
||||||
optional_interfaces['neutron-plugin'] = ['neutron-plugin']
|
optional_interfaces['neutron-plugin'] = ['neutron-plugin']
|
||||||
if relation_ids('shared-db') or relation_ids('pgsql-db'):
|
if relation_ids('shared-db'):
|
||||||
optional_interfaces['database'] = ['shared-db', 'pgsql-db']
|
optional_interfaces['database'] = ['shared-db']
|
||||||
return optional_interfaces
|
return optional_interfaces
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
nova_compute_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_compute_hooks.py
|
|
@ -1 +0,0 @@
|
|||||||
nova_compute_hooks.py
|
|
@ -26,8 +26,6 @@ extra-bindings:
|
|||||||
requires:
|
requires:
|
||||||
shared-db:
|
shared-db:
|
||||||
interface: mysql-shared
|
interface: mysql-shared
|
||||||
pgsql-db:
|
|
||||||
interface: pgsql
|
|
||||||
amqp:
|
amqp:
|
||||||
interface: rabbitmq
|
interface: rabbitmq
|
||||||
image-service:
|
image-service:
|
||||||
|
@ -368,28 +368,6 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||||||
nova_hostname='10.0.0.50')
|
nova_hostname='10.0.0.50')
|
||||||
self.get_relation_ip.assert_called_with('shared-db')
|
self.get_relation_ip.assert_called_with('shared-db')
|
||||||
|
|
||||||
def test_postgresql_db_joined(self):
|
|
||||||
self.is_relation_made.return_value = False
|
|
||||||
hooks.pgsql_db_joined()
|
|
||||||
self.relation_set.assert_called_with(**{
|
|
||||||
'database': 'nova', 'private-address': '10.0.0.50'})
|
|
||||||
|
|
||||||
def test_db_joined_with_postgresql(self):
|
|
||||||
self.is_relation_made.return_value = True
|
|
||||||
|
|
||||||
msg = ('Attempting to associate a mysql database when there is '
|
|
||||||
'already associated a postgresql one')
|
|
||||||
|
|
||||||
with self.assertRaisesRegexp(Exception, msg):
|
|
||||||
hooks.db_joined()
|
|
||||||
|
|
||||||
def test_postgresql_joined_with_db(self):
|
|
||||||
self.is_relation_made.return_value = True
|
|
||||||
msg = ('Attempting to associate a postgresql database when there is '
|
|
||||||
'already associated a mysql one')
|
|
||||||
with self.assertRaisesRegexp(Exception, msg):
|
|
||||||
hooks.pgsql_db_joined()
|
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
def test_db_changed_missing_relation_data(self, configs):
|
def test_db_changed_missing_relation_data(self, configs):
|
||||||
configs.complete_contexts = MagicMock()
|
configs.complete_contexts = MagicMock()
|
||||||
@ -399,39 +377,18 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||||||
'shared-db relation incomplete. Peer not ready?'
|
'shared-db relation incomplete. Peer not ready?'
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
|
||||||
def test_postgresql_db_changed_missing_relation_data(self, configs):
|
|
||||||
configs.complete_contexts = MagicMock()
|
|
||||||
configs.complete_contexts.return_value = []
|
|
||||||
hooks.postgresql_db_changed()
|
|
||||||
self.log.assert_called_with(
|
|
||||||
'pgsql-db relation incomplete. Peer not ready?'
|
|
||||||
)
|
|
||||||
|
|
||||||
def _shared_db_test(self, configs):
|
def _shared_db_test(self, configs):
|
||||||
configs.complete_contexts = MagicMock()
|
configs.complete_contexts = MagicMock()
|
||||||
configs.complete_contexts.return_value = ['shared-db']
|
configs.complete_contexts.return_value = ['shared-db']
|
||||||
configs.write = MagicMock()
|
configs.write = MagicMock()
|
||||||
hooks.db_changed()
|
hooks.db_changed()
|
||||||
|
|
||||||
def _postgresql_db_test(self, configs):
|
|
||||||
configs.complete_contexts = MagicMock()
|
|
||||||
configs.complete_contexts.return_value = ['pgsql-db']
|
|
||||||
configs.write = MagicMock()
|
|
||||||
hooks.postgresql_db_changed()
|
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
def test_db_changed_with_data(self, configs):
|
def test_db_changed_with_data(self, configs):
|
||||||
self._shared_db_test(configs)
|
self._shared_db_test(configs)
|
||||||
self.assertEqual([call('/etc/nova/nova.conf')],
|
self.assertEqual([call('/etc/nova/nova.conf')],
|
||||||
configs.write.call_args_list)
|
configs.write.call_args_list)
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
|
||||||
def test_postgresql_db_changed_with_data(self, configs):
|
|
||||||
self._postgresql_db_test(configs)
|
|
||||||
self.assertEqual([call('/etc/nova/nova.conf')],
|
|
||||||
configs.write.call_args_list)
|
|
||||||
|
|
||||||
@patch.object(hooks, 'CONFIGS')
|
@patch.object(hooks, 'CONFIGS')
|
||||||
def test_image_service_missing_relation_data(self, configs):
|
def test_image_service_missing_relation_data(self, configs):
|
||||||
configs.complete_contexts = MagicMock()
|
configs.complete_contexts = MagicMock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user