Merge "Remove fall-back logic to service provider registration"

This commit is contained in:
Jenkins 2015-09-02 06:14:54 +00:00 committed by Gerrit Code Review
commit 147c6dbc75
2 changed files with 16 additions and 28 deletions

View File

@ -27,14 +27,9 @@ LOG = logging.getLogger(__name__)
def add_provider_configuration(type_manager, service_type):
try:
type_manager.add_provider_configuration(
service_type,
pconf.ProviderConfiguration('neutron_vpnaas'))
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_vpnaas'))
class VPNPlugin(vpn_db.VPNPluginDb):

View File

@ -32,7 +32,6 @@ from neutron.plugins.common import constants
from neutron.scheduler import l3_agent_scheduler
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin
from neutron.tests.unit.extensions import test_l3 as test_l3_plugin
from oslo_config import cfg
from oslo_utils import uuidutils
import six
import webob.exc
@ -423,25 +422,19 @@ class VPNPluginDbTestCase(VPNTestMixin,
constants.VPN +
':vpnaas:neutron_vpnaas.services.vpn.'
'service_drivers.ipsec.IPsecVPNDriver:default')
# TODO(armax): remove this if branch as soon as the ServiceTypeManager
# API for adding provider configurations becomes available
if not hasattr(sdb.ServiceTypeManager, 'add_provider_configuration'):
cfg.CONF.set_override(
'service_provider', [vpnaas_provider], 'service_providers')
else:
bits = vpnaas_provider.split(':')
vpnaas_provider = {
'service_type': bits[0],
'name': bits[1],
'driver': bits[2]
}
if len(bits) == 4:
vpnaas_provider['default'] = True
# override the default service provider
self.service_providers = (
mock.patch.object(sdb.ServiceTypeManager,
'get_service_providers').start())
self.service_providers.return_value = [vpnaas_provider]
bits = vpnaas_provider.split(':')
vpnaas_provider = {
'service_type': bits[0],
'name': bits[1],
'driver': bits[2]
}
if len(bits) == 4:
vpnaas_provider['default'] = True
# override the default service provider
self.service_providers = (
mock.patch.object(sdb.ServiceTypeManager,
'get_service_providers').start())
self.service_providers.return_value = [vpnaas_provider]
# force service type manager to reload configuration:
sdb.ServiceTypeManager._instance = None
service_plugins = {'vpnaas_plugin': vpnaas_plugin}