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: I456125442dd721c1b7b48b000fe4b4e4322bb476
This commit is contained in:
parent
a956c6b9d8
commit
46f0b43dd3
|
@ -51,7 +51,6 @@ from charmhelpers.core.hookenv import (
|
|||
Hooks,
|
||||
UnregisteredHookError,
|
||||
config,
|
||||
is_relation_made,
|
||||
local_unit,
|
||||
relation_get,
|
||||
relation_ids,
|
||||
|
@ -60,7 +59,6 @@ from charmhelpers.core.hookenv import (
|
|||
service_name,
|
||||
log,
|
||||
DEBUG,
|
||||
ERROR,
|
||||
WARNING,
|
||||
status_set,
|
||||
open_port,
|
||||
|
@ -211,13 +209,6 @@ def config_changed():
|
|||
|
||||
@hooks.hook('shared-db-relation-joined')
|
||||
def db_joined():
|
||||
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)
|
||||
|
||||
if config('prefer-ipv6'):
|
||||
sync_db_with_multi_ipv6_addresses(config('database'),
|
||||
config('database-user'))
|
||||
|
@ -237,19 +228,6 @@ def db_joined():
|
|||
hostname=host)
|
||||
|
||||
|
||||
@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)
|
||||
|
||||
conf = config()
|
||||
relation_set(database=conf['database'])
|
||||
|
||||
|
||||
@hooks.hook('shared-db-relation-changed')
|
||||
@restart_on_change(restart_map())
|
||||
def db_changed():
|
||||
|
@ -270,18 +248,6 @@ def db_changed():
|
|||
'not in acl list: %s' % repr(allowed_units))
|
||||
|
||||
|
||||
@hooks.hook('pgsql-db-relation-changed')
|
||||
@restart_on_change(restart_map())
|
||||
def pgsql_db_changed():
|
||||
if 'pgsql-db' not in CONFIGS.complete_contexts():
|
||||
juju_log('pgsql-db relation incomplete. Peer not ready?')
|
||||
return
|
||||
CONFIGS.write(CINDER_CONF)
|
||||
if is_elected_leader(CLUSTER_RES):
|
||||
juju_log('Cluster leader, performing db sync')
|
||||
migrate_database()
|
||||
|
||||
|
||||
@hooks.hook('amqp-relation-joined')
|
||||
def amqp_joined(relation_id=None):
|
||||
conf = config()
|
||||
|
@ -583,8 +549,7 @@ def image_service_changed():
|
|||
@hooks.hook('amqp-relation-broken',
|
||||
'identity-service-relation-broken',
|
||||
'image-service-relation-broken',
|
||||
'shared-db-relation-broken',
|
||||
'pgsql-db-relation-broken')
|
||||
'shared-db-relation-broken')
|
||||
@restart_on_change(restart_map(), stopstart=True)
|
||||
def relation_broken():
|
||||
CONFIGS.write_all()
|
||||
|
|
|
@ -201,7 +201,7 @@ TEMPLATES = 'templates/'
|
|||
# the
|
||||
# list has a complete context.
|
||||
REQUIRED_INTERFACES = {
|
||||
'database': ('shared-db', 'pgsql-db'),
|
||||
'database': ('shared-db',),
|
||||
'messaging': ('amqp',),
|
||||
'identity': ('identity-service',),
|
||||
}
|
||||
|
@ -225,7 +225,6 @@ def ceph_config_file():
|
|||
BASE_RESOURCE_MAP = OrderedDict([
|
||||
(CINDER_CONF, {
|
||||
'contexts': [context.SharedDBContext(ssl_dir=CINDER_CONF_DIR),
|
||||
context.PostgresqlDBContext(),
|
||||
context.AMQPContext(ssl_dir=CINDER_CONF_DIR),
|
||||
context.ImageServiceContext(),
|
||||
context.OSConfigFlagContext(),
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
cinder_hooks.py
|
|
@ -1 +0,0 @@
|
|||
cinder_hooks.py
|
|
@ -1 +0,0 @@
|
|||
cinder_hooks.py
|
|
@ -25,8 +25,6 @@ provides:
|
|||
requires:
|
||||
shared-db:
|
||||
interface: mysql-shared
|
||||
pgsql-db:
|
||||
interface: pgsql
|
||||
amqp:
|
||||
interface: rabbitmq
|
||||
identity-service:
|
||||
|
|
|
@ -70,7 +70,6 @@ TO_PATCH = [
|
|||
'update_nrpe_config',
|
||||
# charmhelpers.core.hookenv
|
||||
'config',
|
||||
'is_relation_made',
|
||||
'local_unit',
|
||||
'relation_get',
|
||||
'relation_ids',
|
||||
|
@ -300,13 +299,6 @@ class TestChangedHooks(CharmTestCase):
|
|||
self.CONFIGS.write.assert_called_with('/etc/cinder/cinder.conf')
|
||||
self.assertTrue(self.migrate_database.called)
|
||||
|
||||
def test_pgsql_db_changed(self):
|
||||
'It writes out cinder.conf on db changed'
|
||||
self.CONFIGS.complete_contexts.return_value = ['pgsql-db']
|
||||
hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])
|
||||
self.CONFIGS.write.assert_called_with('/etc/cinder/cinder.conf')
|
||||
self.assertTrue(self.migrate_database.called)
|
||||
|
||||
def test_db_changed_relation_incomplete(self):
|
||||
'It does not write out cinder.conf with incomplete shared-db rel'
|
||||
self.relation_get.return_value = 'cinder/0 cinder/1'
|
||||
|
@ -333,12 +325,6 @@ class TestChangedHooks(CharmTestCase):
|
|||
hooks.hooks.execute(['hooks/shared-db-relation-changed'])
|
||||
self.assertFalse(self.migrate_database.called)
|
||||
|
||||
def test_pgsql_db_changed_relation_incomplete(self):
|
||||
'It does not write out cinder.conf with incomplete pgsql-db rel'
|
||||
hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])
|
||||
self.assertFalse(self.CONFIGS.write.called)
|
||||
self.assertFalse(self.migrate_database.called)
|
||||
|
||||
def test_db_changed_not_leader(self):
|
||||
'It does not migrate database when not leader'
|
||||
self.relation_get.return_value = 'cinder/0 cinder/1'
|
||||
|
@ -349,14 +335,6 @@ class TestChangedHooks(CharmTestCase):
|
|||
self.CONFIGS.write.assert_called_with('/etc/cinder/cinder.conf')
|
||||
self.assertFalse(self.migrate_database.called)
|
||||
|
||||
def test_pgsql_db_changed_not_leader(self):
|
||||
'It does not migrate database when not leader'
|
||||
self.is_elected_leader.return_value = False
|
||||
self.CONFIGS.complete_contexts.return_value = ['pgsql-db']
|
||||
hooks.hooks.execute(['hooks/pgsql-db-relation-changed'])
|
||||
self.CONFIGS.write.assert_called_with('/etc/cinder/cinder.conf')
|
||||
self.assertFalse(self.migrate_database.called)
|
||||
|
||||
def test_amqp_changed(self):
|
||||
'It writes out cinder.conf on amqp changed with complete relation'
|
||||
self.CONFIGS.complete_contexts.return_value = ['amqp']
|
||||
|
@ -440,37 +418,11 @@ class TestJoinedHooks(CharmTestCase):
|
|||
def test_db_joined(self):
|
||||
'It properly requests access to a shared-db service'
|
||||
self.get_relation_ip.return_value = '10.0.0.1'
|
||||
self.is_relation_made.return_value = False
|
||||
hooks.hooks.execute(['hooks/shared-db-relation-joined'])
|
||||
expected = {'username': 'cinder',
|
||||
'hostname': '10.0.0.1', 'database': 'cinder'}
|
||||
self.relation_set.assert_called_with(**expected)
|
||||
|
||||
def test_db_joined_with_postgresql(self):
|
||||
self.is_relation_made.return_value = True
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
hooks.hooks.execute(['hooks/shared-db-relation-joined'])
|
||||
self.assertEqual(context.exception.message,
|
||||
'Attempting to associate a mysql database when there '
|
||||
'is already associated a postgresql one')
|
||||
|
||||
def test_postgresql_db_joined(self):
|
||||
'It properly requests access to a postgresql-db service'
|
||||
self.is_relation_made.return_value = False
|
||||
hooks.hooks.execute(['hooks/pgsql-db-relation-joined'])
|
||||
expected = {'database': 'cinder'}
|
||||
self.relation_set.assert_called_with(**expected)
|
||||
|
||||
def test_postgresql_joined_with_db(self):
|
||||
self.is_relation_made.return_value = True
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
hooks.hooks.execute(['hooks/pgsql-db-relation-joined'])
|
||||
self.assertEqual(context.exception.message,
|
||||
'Attempting to associate a postgresql database when'
|
||||
' there is already associated a mysql one')
|
||||
|
||||
def test_amqp_joined(self):
|
||||
'It properly requests access to an amqp service'
|
||||
hooks.hooks.execute(['hooks/amqp-relation-joined'])
|
||||
|
|
|
@ -1058,7 +1058,7 @@ class TestCinderUtils(CharmTestCase):
|
|||
def test_required_interfaces_api(self):
|
||||
'''identity-service interface required for api service'''
|
||||
expected = {
|
||||
'database': ('shared-db', 'pgsql-db'),
|
||||
'database': ('shared-db',),
|
||||
'messaging': ('amqp',),
|
||||
'identity': ('identity-service',),
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ class TestCinderUtils(CharmTestCase):
|
|||
'''
|
||||
self.test_config.set('enabled-services', 'volume,scheduler')
|
||||
expected = {
|
||||
'database': ('shared-db', 'pgsql-db'),
|
||||
'database': ('shared-db',),
|
||||
'messaging': ('amqp',),
|
||||
}
|
||||
self.assertEqual(cinder_utils.required_interfaces(), expected)
|
||||
|
|
Loading…
Reference in New Issue