Support cache option for legacy GBP driver

The legacy GBP driver shares the cache code in the apic_aim
mechanism driver. This class uses an option that's only available
when the apic_aim mechanism driver is loaded. In order to ensure
backwards-compatibility for the legacy GBP driver, check to see
if the configuration options exist before trying to use it for
configuring the class.

Change-Id: I26aab66b725cea1971e8d212705d47a7890e4b42
This commit is contained in:
Thomas Bachman 2019-12-18 03:13:42 +00:00 committed by Thomas Bachman
parent 449bb411e7
commit 54f20d3b22
1 changed files with 9 additions and 2 deletions

View File

@ -40,8 +40,15 @@ class ProjectDetailsCache(object):
self.project_details = {}
self.keystone = None
self.gbp = None
self.enable_neutronclient_internal_ep_interface = (
cfg.CONF.ml2_apic_aim.enable_neutronclient_internal_ep_interface)
# This is needed for the legacy GBP plugin, which also
# uses the cache. This can be reverted once newton support
# is dropped
if hasattr(cfg.CONF, 'ml2_apic_aim'):
ml2_cfg = cfg.CONF.ml2_apic_aim
self.enable_neutronclient_internal_ep_interface = (
ml2_cfg.enable_neutronclient_internal_ep_interface)
else:
self.enable_neutronclient_internal_ep_interface = False
def _get_keystone_client(self):
# REVISIT: It seems load_from_conf_options() and