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: Ia57a7358fd3567fe0250c45f3e00c07fa83f329c
This commit is contained in:
parent
e1ac46f342
commit
6b5bb0da1e
|
@ -28,13 +28,11 @@ from charmhelpers.core.hookenv import (
|
|||
Hooks,
|
||||
UnregisteredHookError,
|
||||
config,
|
||||
is_relation_made,
|
||||
log,
|
||||
local_unit,
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
relation_get,
|
||||
relation_ids,
|
||||
relation_set,
|
||||
|
@ -334,13 +332,6 @@ def initialise_pki():
|
|||
|
||||
@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'))
|
||||
|
@ -359,18 +350,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)
|
||||
|
||||
relation_set(database=config('database'))
|
||||
|
||||
|
||||
def update_all_identity_relation_units(check_db_ready=True):
|
||||
if is_unit_paused_set():
|
||||
return
|
||||
|
@ -457,20 +436,6 @@ def db_changed():
|
|||
CONFIGS.write(POLICY_JSON)
|
||||
|
||||
|
||||
@hooks.hook('pgsql-db-relation-changed')
|
||||
@restart_on_change(restart_map(), restart_functions=restart_function_map())
|
||||
@synchronize_ca_if_changed()
|
||||
def pgsql_db_changed():
|
||||
if 'pgsql-db' not in CONFIGS.complete_contexts():
|
||||
log('pgsql-db relation incomplete. Peer not ready?')
|
||||
else:
|
||||
CONFIGS.write(KEYSTONE_CONF)
|
||||
leader_init_db_if_ready(use_current_context=True)
|
||||
if CompareOpenStackReleases(
|
||||
os_release('keystone-common')) >= 'liberty':
|
||||
CONFIGS.write(POLICY_JSON)
|
||||
|
||||
|
||||
@hooks.hook('identity-service-relation-changed')
|
||||
@restart_on_change(restart_map(), restart_functions=restart_function_map())
|
||||
@synchronize_ca_if_changed()
|
||||
|
|
|
@ -278,7 +278,6 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||
'services': BASE_SERVICES,
|
||||
'contexts': [keystone_context.KeystoneContext(),
|
||||
context.SharedDBContext(ssl_dir=KEYSTONE_CONF_DIR),
|
||||
context.PostgresqlDBContext(),
|
||||
context.SyslogContext(),
|
||||
keystone_context.HAProxyContext(),
|
||||
context.BindHostContext(),
|
||||
|
@ -299,7 +298,6 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||
'contexts': [keystone_context.KeystoneContext(),
|
||||
keystone_context.NginxSSLContext(),
|
||||
context.SharedDBContext(ssl_dir=KEYSTONE_CONF_DIR),
|
||||
context.PostgresqlDBContext(),
|
||||
context.SyslogContext(),
|
||||
keystone_context.HAProxyContext(),
|
||||
context.BindHostContext(),
|
||||
|
@ -309,7 +307,6 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||
'services': BASE_SERVICES,
|
||||
'contexts': [keystone_context.KeystoneContext(),
|
||||
context.SharedDBContext(ssl_dir=KEYSTONE_CONF_DIR),
|
||||
context.PostgresqlDBContext(),
|
||||
context.SyslogContext(),
|
||||
keystone_context.HAProxyContext(),
|
||||
keystone_context.NginxSSLContext(),
|
||||
|
@ -481,7 +478,7 @@ valid_services = {
|
|||
# The interface is said to be satisfied if anyone of the interfaces in the
|
||||
# list has a complete context.
|
||||
REQUIRED_INTERFACES = {
|
||||
'database': ['shared-db', 'pgsql-db'],
|
||||
'database': ['shared-db'],
|
||||
}
|
||||
|
||||
|
||||
|
@ -2424,7 +2421,7 @@ def is_db_ready(use_current_context=False, db_rel=None):
|
|||
returns True otherwise False.
|
||||
"""
|
||||
key = 'allowed_units'
|
||||
db_rels = ['shared-db', 'pgsql-db']
|
||||
db_rels = ['shared-db']
|
||||
if db_rel:
|
||||
db_rels = [db_rel]
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
keystone_hooks.py
|
|
@ -1 +0,0 @@
|
|||
keystone_hooks.py
|
|
@ -33,8 +33,6 @@ provides:
|
|||
requires:
|
||||
shared-db:
|
||||
interface: mysql-shared
|
||||
pgsql-db:
|
||||
interface: pgsql
|
||||
ha:
|
||||
interface: hacluster
|
||||
scope: container
|
||||
|
|
|
@ -53,7 +53,6 @@ TO_PATCH = [
|
|||
# charmhelpers.core.hookenv
|
||||
'Hooks',
|
||||
'config',
|
||||
'is_relation_made',
|
||||
'log',
|
||||
'local_unit',
|
||||
'filter_installed_packages',
|
||||
|
@ -239,37 +238,11 @@ class KeystoneRelationTests(CharmTestCase):
|
|||
mock_config.side_effect = cfg
|
||||
|
||||
self.get_relation_ip.return_value = '192.168.20.1'
|
||||
self.is_relation_made.return_value = False
|
||||
hooks.db_joined()
|
||||
self.relation_set.assert_called_with(database='keystone',
|
||||
username='keystone',
|
||||
hostname='192.168.20.1')
|
||||
|
||||
def test_postgresql_db_joined(self):
|
||||
self.is_relation_made.return_value = False
|
||||
hooks.pgsql_db_joined()
|
||||
self.relation_set.assert_called_with(database='keystone'),
|
||||
|
||||
def test_db_joined_with_postgresql(self):
|
||||
self.is_relation_made.return_value = True
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
hooks.db_joined()
|
||||
self.assertEqual(
|
||||
context.exception.message,
|
||||
'Attempting to associate a mysql database when there '
|
||||
'is already associated a postgresql one')
|
||||
|
||||
def test_postgresql_joined_with_db(self):
|
||||
self.is_relation_made.return_value = True
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
hooks.pgsql_db_joined()
|
||||
self.assertEqual(
|
||||
context.exception.message,
|
||||
'Attempting to associate a postgresql database when there '
|
||||
'is already associated a mysql one')
|
||||
|
||||
@patch('keystone_utils.log')
|
||||
@patch('keystone_utils.ensure_ssl_cert_master')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
|
@ -284,20 +257,6 @@ class KeystoneRelationTests(CharmTestCase):
|
|||
'shared-db relation incomplete. Peer not ready?'
|
||||
)
|
||||
|
||||
@patch('keystone_utils.log')
|
||||
@patch('keystone_utils.ensure_ssl_cert_master')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
def test_postgresql_db_changed_missing_relation_data(self, configs,
|
||||
mock_ensure_leader,
|
||||
mock_log):
|
||||
mock_ensure_leader.return_value = False
|
||||
configs.complete_contexts = MagicMock()
|
||||
configs.complete_contexts.return_value = []
|
||||
hooks.pgsql_db_changed()
|
||||
self.log.assert_called_with(
|
||||
'pgsql-db relation incomplete. Peer not ready?'
|
||||
)
|
||||
|
||||
def _shared_db_test(self, configs, unit_name):
|
||||
self.relation_get.return_value = 'keystone/0 keystone/3'
|
||||
self.local_unit.return_value = unit_name
|
||||
|
@ -306,12 +265,6 @@ class KeystoneRelationTests(CharmTestCase):
|
|||
configs.write = MagicMock()
|
||||
hooks.db_changed()
|
||||
|
||||
def _postgresql_db_test(self, configs):
|
||||
configs.complete_contexts = MagicMock()
|
||||
configs.complete_contexts.return_value = ['pgsql-db']
|
||||
configs.write = MagicMock()
|
||||
hooks.pgsql_db_changed()
|
||||
|
||||
@patch.object(hooks, 'leader_init_db_if_ready')
|
||||
@patch('keystone_utils.ensure_ssl_cert_master')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
|
@ -325,19 +278,6 @@ class KeystoneRelationTests(CharmTestCase):
|
|||
configs.write.call_args_list)
|
||||
self.assertTrue(leader_init.called)
|
||||
|
||||
@patch.object(hooks, 'leader_init_db_if_ready')
|
||||
@patch('keystone_utils.ensure_ssl_cert_master')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
def test_postgresql_db_changed(self, configs,
|
||||
mock_ensure_ssl_cert_master,
|
||||
leader_init):
|
||||
self.os_release.return_value = 'havana'
|
||||
mock_ensure_ssl_cert_master.return_value = False
|
||||
self._postgresql_db_test(configs)
|
||||
self.assertEqual([call('/etc/keystone/keystone.conf')],
|
||||
configs.write.call_args_list)
|
||||
self.assertTrue(leader_init.called)
|
||||
|
||||
@patch.object(hooks, 'update_all_domain_backends')
|
||||
@patch.object(hooks, 'update_all_identity_relation_units')
|
||||
@patch.object(hooks, 'run_in_apache')
|
||||
|
|
Loading…
Reference in New Issue