Fix the check for allowed_cidrs in listeners
The allowed_cidrs value could be an empty list if the request involves the sdk, so change the check to account for that. Change-Id: I2df7e5a944cbd40c60943ad105f6e09f7afa85a9 Closes-bug: #1896603
This commit is contained in:
parent
481f0b3b3c
commit
76b20882aa
@ -58,6 +58,16 @@ class OvnProviderDriver(driver_base.ProviderDriver):
|
|||||||
user_fault_string=msg,
|
user_fault_string=msg,
|
||||||
operator_fault_string=msg)
|
operator_fault_string=msg)
|
||||||
|
|
||||||
|
def _check_for_allowed_cidrs(self, allowed_cidrs):
|
||||||
|
# TODO(haleyb): add support for this
|
||||||
|
if isinstance(allowed_cidrs, o_datamodels.UnsetType):
|
||||||
|
allowed_cidrs = []
|
||||||
|
if allowed_cidrs:
|
||||||
|
msg = _('OVN provider does not support allowed_cidrs option')
|
||||||
|
raise driver_exceptions.UnsupportedOptionError(
|
||||||
|
user_fault_string=msg,
|
||||||
|
operator_fault_string=msg)
|
||||||
|
|
||||||
def loadbalancer_create(self, loadbalancer):
|
def loadbalancer_create(self, loadbalancer):
|
||||||
admin_state_up = loadbalancer.admin_state_up
|
admin_state_up = loadbalancer.admin_state_up
|
||||||
if isinstance(admin_state_up, o_datamodels.UnsetType):
|
if isinstance(admin_state_up, o_datamodels.UnsetType):
|
||||||
@ -138,12 +148,8 @@ class OvnProviderDriver(driver_base.ProviderDriver):
|
|||||||
|
|
||||||
def listener_create(self, listener):
|
def listener_create(self, listener):
|
||||||
self._check_for_supported_protocols(listener.protocol)
|
self._check_for_supported_protocols(listener.protocol)
|
||||||
# TODO(haleyb): add support for this
|
self._check_for_allowed_cidrs(listener.allowed_cidrs)
|
||||||
if not isinstance(listener.allowed_cidrs, o_datamodels.UnsetType):
|
|
||||||
msg = _('OVN provider does not support allowed_cidrs option')
|
|
||||||
raise driver_exceptions.UnsupportedOptionError(
|
|
||||||
user_fault_string=msg,
|
|
||||||
operator_fault_string=msg)
|
|
||||||
admin_state_up = listener.admin_state_up
|
admin_state_up = listener.admin_state_up
|
||||||
if isinstance(admin_state_up, o_datamodels.UnsetType):
|
if isinstance(admin_state_up, o_datamodels.UnsetType):
|
||||||
admin_state_up = True
|
admin_state_up = True
|
||||||
@ -167,12 +173,7 @@ class OvnProviderDriver(driver_base.ProviderDriver):
|
|||||||
self._ovn_helper.add_request(request)
|
self._ovn_helper.add_request(request)
|
||||||
|
|
||||||
def listener_update(self, old_listener, new_listener):
|
def listener_update(self, old_listener, new_listener):
|
||||||
# TODO(haleyb): add support for this
|
self._check_for_allowed_cidrs(new_listener.allowed_cidrs)
|
||||||
if not isinstance(new_listener.allowed_cidrs, o_datamodels.UnsetType):
|
|
||||||
msg = _('OVN provider does not support allowed_cidrs option')
|
|
||||||
raise driver_exceptions.UnsupportedOptionError(
|
|
||||||
user_fault_string=msg,
|
|
||||||
operator_fault_string=msg)
|
|
||||||
|
|
||||||
request_info = {'id': new_listener.listener_id,
|
request_info = {'id': new_listener.listener_id,
|
||||||
'loadbalancer_id': old_listener.loadbalancer_id,
|
'loadbalancer_id': old_listener.loadbalancer_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user