Remove fall-back logic to service provider registration

Once [1] merges, we no longer need to catch the AttributeError
exception, so clean this up.

[1] https://review.openstack.org/#/c/202207

Related-bug: #1473110

Change-Id: I7f3f084acfae67eaf82a959178565a05149254f4
This commit is contained in:
armando-migliaccio 2015-07-27 13:57:09 -07:00 committed by Armando Migliaccio
parent bf04bce4bf
commit 4e934ada6b
2 changed files with 9 additions and 21 deletions

View File

@ -57,14 +57,9 @@ def verify_lbaas_mutual_exclusion():
def add_provider_configuration(type_manager, service_type):
try:
type_manager.add_provider_configuration(
service_type,
pconf.ProviderConfiguration('neutron_lbaas'))
except AttributeError:
# TODO(armax): remove this try catch once the API
# add_provider_configuration becomes available
LOG.debug('add_provider_configuration API is not available')
type_manager.add_provider_configuration(
service_type,
pconf.ProviderConfiguration('neutron_lbaas'))
class LoadBalancerPlugin(ldb.LoadBalancerPluginDb,

View File

@ -22,7 +22,6 @@ from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import base as ext_base
from neutron.tests.unit.extensions import test_quotasv2
from neutron.tests.unit import testlib_api
from oslo_config import cfg
from testtools import matchers
@ -34,18 +33,12 @@ class NeutronDbPluginV2TestCase(
test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def set_override(self, lbaas_provider):
# TODO(armax): remove this if branch as soon as the ServiceTypeManager
# API for adding provider configurations becomes available
if not hasattr(st_db.ServiceTypeManager, 'add_provider_configuration'):
cfg.CONF.set_override(
'service_provider', lbaas_provider, 'service_providers')
else:
# override the default service provider
self.service_providers = (
mock.patch.object(st_db.ServiceTypeManager,
'get_service_providers').start())
self.service_providers.return_value = (
self._to_provider_dicts(lbaas_provider))
# override the default service provider
self.service_providers = (
mock.patch.object(st_db.ServiceTypeManager,
'get_service_providers').start())
self.service_providers.return_value = (
self._to_provider_dicts(lbaas_provider))
# need to reload provider configuration
st_db.ServiceTypeManager._instance = None