Fix new pylint errors
Pylint 2.6.0 added two new checkers [1] that make pep8 validation to fail: - raise-missing-from (W0707) - super-with-arguments (R1725) [1] http://pylint.pycqa.org/en/latest/technical_reference/features.html Change-Id: I15fd7082646d95414bdd8f0815ee44b5867b3ed0
This commit is contained in:
parent
0a85de4c6d
commit
bf3d5372b9
@ -64,12 +64,12 @@ class KeepalivedLvs(udp_listener_base.UdpListenerApiServerBase):
|
||||
assert True is os.path.exists(script_dir)
|
||||
assert True is os.path.exists(os.path.join(
|
||||
script_dir, CHECK_SCRIPT_NAME))
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.Conflict(
|
||||
description='%(file_name)s not Found for '
|
||||
'UDP Listener %(listener_id)s' %
|
||||
{'file_name': CHECK_SCRIPT_NAME,
|
||||
'listener_id': listener_id})
|
||||
'listener_id': listener_id}) from e
|
||||
os.makedirs(util.keepalived_backend_check_script_dir())
|
||||
shutil.copy2(os.path.join(script_dir, CHECK_SCRIPT_NAME),
|
||||
util.keepalived_backend_check_script_path())
|
||||
|
@ -284,7 +284,7 @@ class Ubuntu(BaseOS):
|
||||
network_dir = self.get_network_path()
|
||||
if not ignore:
|
||||
ignore = shutil.ignore_patterns('eth0*', 'openssh*')
|
||||
super(Ubuntu, self).create_netns_dir(
|
||||
super().create_netns_dir(
|
||||
network_dir, netns_network_dir, ignore)
|
||||
|
||||
def write_interfaces_file(self):
|
||||
@ -307,7 +307,7 @@ class Ubuntu(BaseOS):
|
||||
render_host_routes, template_vip=None):
|
||||
if not template_vip:
|
||||
template_vip = j2_env.get_template(self.ETH_X_VIP_CONF)
|
||||
super(Ubuntu, self).write_vip_interface_file(
|
||||
super().write_vip_interface_file(
|
||||
interface_file_path, primary_interface, vip, ip, broadcast,
|
||||
netmask, gateway, mtu, vrrp_ip, vrrp_version, render_host_routes,
|
||||
template_vip)
|
||||
@ -320,7 +320,7 @@ class Ubuntu(BaseOS):
|
||||
netns_interface)
|
||||
if not template_port:
|
||||
template_port = j2_env.get_template(self.ETH_X_PORT_CONF)
|
||||
super(Ubuntu, self).write_port_interface_file(
|
||||
super().write_port_interface_file(
|
||||
netns_interface, fixed_ips, mtu, interface_file_path,
|
||||
template_port)
|
||||
|
||||
@ -391,7 +391,7 @@ class RH(BaseOS):
|
||||
network_dir = self.get_network_path()
|
||||
if not ignore:
|
||||
ignore = shutil.ignore_patterns('ifcfg-eth0*', 'ifcfg-lo*')
|
||||
super(RH, self).create_netns_dir(
|
||||
super().create_netns_dir(
|
||||
network_dir, netns_network_dir, ignore)
|
||||
|
||||
# Copy /etc/sysconfig/network file
|
||||
@ -410,7 +410,7 @@ class RH(BaseOS):
|
||||
render_host_routes, template_vip=None):
|
||||
if not template_vip:
|
||||
template_vip = j2_env.get_template(self.ETH_X_VIP_CONF)
|
||||
super(RH, self).write_vip_interface_file(
|
||||
super().write_vip_interface_file(
|
||||
interface_file_path, primary_interface, vip, ip, broadcast,
|
||||
netmask, gateway, mtu, vrrp_ip, vrrp_version, render_host_routes,
|
||||
template_vip)
|
||||
@ -423,7 +423,7 @@ class RH(BaseOS):
|
||||
alias_interface_file_path = self.get_alias_network_interface_file(
|
||||
primary_interface)
|
||||
template_vip_alias = j2_env.get_template(self.ETH_X_ALIAS_VIP_CONF)
|
||||
super(RH, self).write_vip_interface_file(
|
||||
super().write_vip_interface_file(
|
||||
alias_interface_file_path, primary_interface, vip, ip,
|
||||
broadcast, netmask, gateway, mtu, vrrp_ip, vrrp_version,
|
||||
render_host_routes, template_vip_alias)
|
||||
@ -486,7 +486,7 @@ class RH(BaseOS):
|
||||
netns_interface)
|
||||
if not template_port:
|
||||
template_port = j2_env.get_template(self.ETH_X_PORT_CONF)
|
||||
super(RH, self).write_port_interface_file(
|
||||
super().write_port_interface_file(
|
||||
netns_interface, fixed_ips, mtu, interface_file_path,
|
||||
template_port)
|
||||
|
||||
@ -573,7 +573,7 @@ class RH(BaseOS):
|
||||
class CentOS(RH):
|
||||
|
||||
def __init__(self, os_name):
|
||||
super(CentOS, self).__init__(os_name)
|
||||
super().__init__(os_name)
|
||||
if distro.version() == '7':
|
||||
self.package_name_map.update({'haproxy': 'haproxy18'})
|
||||
|
||||
|
@ -186,9 +186,9 @@ class Server(object):
|
||||
assert 'subnet_cidr' in net_info
|
||||
assert 'gateway' in net_info
|
||||
assert 'mac_address' in net_info
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.BadRequest(
|
||||
description='Invalid subnet information')
|
||||
description='Invalid subnet information') from e
|
||||
return self._plug.plug_vip(vip,
|
||||
net_info['subnet_cidr'],
|
||||
net_info['gateway'],
|
||||
@ -202,8 +202,9 @@ class Server(object):
|
||||
port_info = flask.request.get_json()
|
||||
assert type(port_info) is dict
|
||||
assert 'mac_address' in port_info
|
||||
except Exception:
|
||||
raise exceptions.BadRequest(description='Invalid port information')
|
||||
except Exception as e:
|
||||
raise exceptions.BadRequest(
|
||||
description='Invalid port information') from e
|
||||
return self._plug.plug_network(port_info['mac_address'],
|
||||
port_info.get('fixed_ips'),
|
||||
port_info.get('mtu'))
|
||||
|
@ -47,8 +47,9 @@ class HAProxyQuery(object):
|
||||
|
||||
try:
|
||||
sock.connect(self.socket)
|
||||
except socket.error:
|
||||
raise Exception(_("HAProxy '{0}' query failed.").format(query))
|
||||
except socket.error as e:
|
||||
raise Exception(
|
||||
_("HAProxy '{0}' query failed.").format(query)) from e
|
||||
|
||||
try:
|
||||
sock.send(octavia_utils.b(query + '\n'))
|
||||
|
@ -69,8 +69,8 @@ def get_interface_name(ip_address, net_ns=None):
|
||||
# fe80:0000:0000:0000:f816:3eff:fef2:2058 == fe80::f816:3eff:fef2:2058
|
||||
try:
|
||||
normalized_addr = ipaddress.ip_address(ip_address).compressed
|
||||
except ValueError:
|
||||
raise exceptions.InvalidIPAddress(ip_addr=ip_address)
|
||||
except ValueError as e:
|
||||
raise exceptions.InvalidIPAddress(ip_addr=ip_address) from e
|
||||
|
||||
if net_ns:
|
||||
with pyroute2.NetNS(net_ns) as rtnl_api:
|
||||
|
@ -23,14 +23,14 @@ class AmphoraDriverError(Exception):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
try:
|
||||
super(AmphoraDriverError, self).__init__(self.message % kwargs)
|
||||
super().__init__(self.message % kwargs)
|
||||
self.msg = self.message % kwargs
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
if not self.use_fatal_exceptions():
|
||||
ctxt.reraise = False
|
||||
# at least get the core message out if something happened
|
||||
super(AmphoraDriverError, self).__init__(self.message)
|
||||
super().__init__(self.message)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.msg
|
||||
|
@ -52,7 +52,7 @@ class APIException(exc.HTTPClientError):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.msg = self.msg % kwargs
|
||||
super(APIException, self).__init__(detail=self.msg)
|
||||
super().__init__(detail=self.msg)
|
||||
|
||||
|
||||
class InvalidRequest(APIException):
|
||||
|
@ -53,7 +53,7 @@ class HaproxyAmphoraLoadBalancerDriver(
|
||||
vrrp_rest_driver.KeepalivedAmphoraDriverMixin):
|
||||
|
||||
def __init__(self):
|
||||
super(HaproxyAmphoraLoadBalancerDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.clients = {
|
||||
'base': AmphoraAPIClientBase(),
|
||||
'0.5': AmphoraAPIClient0_5(),
|
||||
@ -587,10 +587,10 @@ class HaproxyAmphoraLoadBalancerDriver(
|
||||
self._populate_amphora_api_version(amphora)
|
||||
self.clients[amphora.api_version].update_agent_config(
|
||||
amphora, agent_config, timeout_dict=timeout_dict)
|
||||
except exc.NotFound:
|
||||
except exc.NotFound as e:
|
||||
LOG.debug('Amphora {} does not support the update_agent_config '
|
||||
'API.'.format(amphora.id))
|
||||
raise driver_except.AmpDriverNotImplementedError()
|
||||
raise driver_except.AmpDriverNotImplementedError() from e
|
||||
|
||||
def get_interface_from_ip(self, amphora, ip_address, timeout_dict=None):
|
||||
"""Get the interface name for an IP address.
|
||||
@ -619,19 +619,17 @@ class HaproxyAmphoraLoadBalancerDriver(
|
||||
class CustomHostNameCheckingAdapter(requests.adapters.HTTPAdapter):
|
||||
def cert_verify(self, conn, url, verify, cert):
|
||||
conn.assert_hostname = self.uuid
|
||||
return super(CustomHostNameCheckingAdapter,
|
||||
self).cert_verify(conn, url, verify, cert)
|
||||
return super().cert_verify(conn, url, verify, cert)
|
||||
|
||||
def init_poolmanager(self, *pool_args, **pool_kwargs):
|
||||
proto = CONF.amphora_agent.agent_tls_protocol.replace('.', '_')
|
||||
pool_kwargs['ssl_version'] = getattr(ssl, "PROTOCOL_%s" % proto)
|
||||
return super(CustomHostNameCheckingAdapter,
|
||||
self).init_poolmanager(*pool_args, **pool_kwargs)
|
||||
return super().init_poolmanager(*pool_args, **pool_kwargs)
|
||||
|
||||
|
||||
class AmphoraAPIClientBase(object):
|
||||
def __init__(self):
|
||||
super(AmphoraAPIClientBase, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.get = functools.partial(self.request, 'get')
|
||||
self.post = functools.partial(self.request, 'post')
|
||||
@ -753,7 +751,7 @@ class AmphoraAPIClientBase(object):
|
||||
|
||||
class AmphoraAPIClient0_5(AmphoraAPIClientBase):
|
||||
def __init__(self):
|
||||
super(AmphoraAPIClient0_5, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.start_listener = functools.partial(self._action,
|
||||
consts.AMP_ACTION_START)
|
||||
@ -868,7 +866,7 @@ class AmphoraAPIClient0_5(AmphoraAPIClientBase):
|
||||
|
||||
class AmphoraAPIClient1_0(AmphoraAPIClientBase):
|
||||
def __init__(self):
|
||||
super(AmphoraAPIClient1_0, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.start_listener = functools.partial(self._action,
|
||||
consts.AMP_ACTION_START)
|
||||
|
@ -35,7 +35,7 @@ class KeepalivedJinjaTemplater(object):
|
||||
|
||||
:param keepalived_template: Absolute path to keepalived Jinja template
|
||||
"""
|
||||
super(KeepalivedJinjaTemplater, self).__init__()
|
||||
super().__init__()
|
||||
self.keepalived_template = (keepalived_template if
|
||||
keepalived_template else
|
||||
KEEPALIVED_TEMPLATE)
|
||||
|
@ -24,7 +24,7 @@ API_VERSION = constants.API_VERSION
|
||||
|
||||
class KeepalivedAmphoraDriverMixin(driver_base.VRRPDriverMixin):
|
||||
def __init__(self):
|
||||
super(KeepalivedAmphoraDriverMixin, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
# The Mixed class must define a self.client object for the
|
||||
# AmphoraApiClient
|
||||
|
@ -34,7 +34,7 @@ class LoggingUpdate(object):
|
||||
class NoopManager(object):
|
||||
|
||||
def __init__(self):
|
||||
super(NoopManager, self).__init__()
|
||||
super().__init__()
|
||||
self.amphoraconfig = {}
|
||||
|
||||
def update_amphora_listeners(self, loadbalancer, amphora, timeout_dict):
|
||||
@ -135,7 +135,7 @@ class NoopAmphoraLoadBalancerDriver(
|
||||
driver_base.AmphoraLoadBalancerDriver,
|
||||
driver_base.VRRPDriverMixin):
|
||||
def __init__(self):
|
||||
super(NoopAmphoraLoadBalancerDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
def update_amphora_listeners(self, loadbalancer, amphora, timeout_dict):
|
||||
|
@ -77,8 +77,8 @@ class PaginationHelper(object):
|
||||
# Otherwise, we need to compare against the max
|
||||
else:
|
||||
limit = min(int(limit), page_max_limit)
|
||||
except ValueError:
|
||||
raise exceptions.InvalidLimit(key=limit)
|
||||
except ValueError as e:
|
||||
raise exceptions.InvalidLimit(key=limit) from e
|
||||
return limit
|
||||
|
||||
def _parse_sort_keys(self, params):
|
||||
@ -318,8 +318,9 @@ class PaginationHelper(object):
|
||||
|
||||
try:
|
||||
sort_key_attr = getattr(model, current_sort_key)
|
||||
except AttributeError:
|
||||
raise exceptions.InvalidSortKey(key=current_sort_key)
|
||||
except AttributeError as e:
|
||||
raise exceptions.InvalidSortKey(
|
||||
key=current_sort_key) from e
|
||||
query = query.order_by(sort_dir_func(sort_key_attr))
|
||||
|
||||
# Add pagination
|
||||
|
@ -36,9 +36,9 @@ class IPAddressType(wtypes.UserType):
|
||||
try:
|
||||
wtypes.IPv6AddressType.validate(value)
|
||||
return value
|
||||
except ValueError:
|
||||
except ValueError as e:
|
||||
error = 'Value should be IPv4 or IPv6 format'
|
||||
raise ValueError(error)
|
||||
raise ValueError(error) from e
|
||||
|
||||
|
||||
class CidrType(wtypes.UserType):
|
||||
@ -50,9 +50,9 @@ class CidrType(wtypes.UserType):
|
||||
"""Validates whether value is an IPv4 or IPv6 CIDR."""
|
||||
try:
|
||||
return str(netaddr.IPNetwork(value).cidr)
|
||||
except (ValueError, netaddr.core.AddrFormatError):
|
||||
except (ValueError, netaddr.core.AddrFormatError) as e:
|
||||
error = 'Value should be IPv4 or IPv6 CIDR format'
|
||||
raise ValueError(error)
|
||||
raise ValueError(error) from e
|
||||
|
||||
|
||||
class URLType(wtypes.UserType):
|
||||
@ -60,15 +60,15 @@ class URLType(wtypes.UserType):
|
||||
name = 'url'
|
||||
|
||||
def __init__(self, require_scheme=True):
|
||||
super(URLType, self).__init__()
|
||||
super().__init__()
|
||||
self.require_scheme = require_scheme
|
||||
|
||||
def validate(self, value):
|
||||
try:
|
||||
validate.url(value, require_scheme=self.require_scheme)
|
||||
except exceptions.InvalidURL:
|
||||
except exceptions.InvalidURL as e:
|
||||
error = 'Value must be a valid URL string'
|
||||
raise ValueError(error)
|
||||
raise ValueError(error) from e
|
||||
return value
|
||||
|
||||
|
||||
@ -80,9 +80,9 @@ class URLPathType(wtypes.UserType):
|
||||
def validate(value):
|
||||
try:
|
||||
validate.url_path(value)
|
||||
except exceptions.InvalidURLPath:
|
||||
except exceptions.InvalidURLPath as e:
|
||||
error = 'Value must be a valid URL Path string'
|
||||
raise ValueError(error)
|
||||
raise ValueError(error) from e
|
||||
return value
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ AMPHORA_SUPPORTED_LB_ALGORITHMS = [
|
||||
|
||||
class AmphoraProviderDriver(driver_base.ProviderDriver):
|
||||
def __init__(self):
|
||||
super(AmphoraProviderDriver, self).__init__()
|
||||
super().__init__()
|
||||
topic = cfg.CONF.oslo_messaging.topic
|
||||
self.target = messaging.Target(
|
||||
namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT,
|
||||
|
@ -47,7 +47,7 @@ AMPHORA_SUPPORTED_LB_ALGORITHMS = [
|
||||
|
||||
class AmphoraProviderDriver(driver_base.ProviderDriver):
|
||||
def __init__(self):
|
||||
super(AmphoraProviderDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.target = messaging.Target(
|
||||
namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT,
|
||||
topic=consts.TOPIC_AMPHORA_V2, version="2.0", fanout=False)
|
||||
|
@ -34,7 +34,7 @@ class DriverUpdater(object):
|
||||
self.listener_stats_repo = repo.ListenerStatisticsRepository()
|
||||
|
||||
self.db_session = db_apis.get_session()
|
||||
super(DriverUpdater, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def _check_for_lb_vip_deallocate(self, repo, lb_id):
|
||||
lb = repo.get(self.db_session, id=lb_id)
|
||||
|
@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class NoopManager(object):
|
||||
def __init__(self):
|
||||
super(NoopManager, self).__init__()
|
||||
super().__init__()
|
||||
self.driverconfig = {}
|
||||
|
||||
# Load Balancer
|
||||
@ -262,7 +262,7 @@ class NoopManager(object):
|
||||
|
||||
class NoopProviderDriver(driver_base.ProviderDriver):
|
||||
def __init__(self):
|
||||
super(NoopProviderDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
# Load Balancer
|
||||
|
@ -22,7 +22,7 @@ class OctaviaDBHealthcheck(pluginbase.HealthcheckBaseExtension):
|
||||
UNAVAILABLE_REASON = 'The Octavia database is unavailable.'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OctaviaDBHealthcheck, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def healthcheck(self, server_port):
|
||||
try:
|
||||
@ -44,4 +44,4 @@ class OctaviaDBCheckResult(pluginbase.HealthcheckResult):
|
||||
"""Result sub-class to provide a unique name in detail reports."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OctaviaDBCheckResult, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -31,7 +31,7 @@ class RootController(object):
|
||||
"""The controller with which the pecan wsgi app should be created."""
|
||||
|
||||
def __init__(self):
|
||||
super(RootController, self).__init__()
|
||||
super().__init__()
|
||||
setattr(self, 'v2.0', v2_controller.V2Controller())
|
||||
setattr(self, 'v2', v2_controller.V2Controller())
|
||||
if CONF.api_settings.healthcheck_enabled:
|
||||
|
@ -39,7 +39,7 @@ class BaseV2Controller(base.BaseController):
|
||||
quotas = None
|
||||
|
||||
def __init__(self):
|
||||
super(BaseV2Controller, self).__init__()
|
||||
super().__init__()
|
||||
self.loadbalancers = load_balancer.LoadBalancersController()
|
||||
self.listeners = listener.ListenersController()
|
||||
self.pools = pool.PoolsController()
|
||||
@ -63,7 +63,7 @@ class OctaviaV2Controller(base.BaseController):
|
||||
amphorae = None
|
||||
|
||||
def __init__(self):
|
||||
super(OctaviaV2Controller, self).__init__()
|
||||
super().__init__()
|
||||
self.amphorae = amphora.AmphoraController()
|
||||
|
||||
@wsme_pecan.wsexpose(wtypes.text)
|
||||
@ -75,6 +75,6 @@ class V2Controller(BaseV2Controller):
|
||||
lbaas = None
|
||||
|
||||
def __init__(self):
|
||||
super(V2Controller, self).__init__()
|
||||
super().__init__()
|
||||
self.lbaas = BaseV2Controller()
|
||||
self.octavia = OctaviaV2Controller()
|
||||
|
@ -36,7 +36,7 @@ class AmphoraController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AMPHORA
|
||||
|
||||
def __init__(self):
|
||||
super(AmphoraController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(amp_types.AmphoraRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -97,7 +97,7 @@ class FailoverController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AMPHORA
|
||||
|
||||
def __init__(self, amp_id):
|
||||
super(FailoverController, self).__init__()
|
||||
super().__init__()
|
||||
if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
|
||||
topic = constants.TOPIC_AMPHORA_V2
|
||||
version = "2.0"
|
||||
@ -147,7 +147,7 @@ class AmphoraUpdateController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AMPHORA
|
||||
|
||||
def __init__(self, amp_id):
|
||||
super(AmphoraUpdateController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
|
||||
topic = constants.TOPIC_AMPHORA_V2
|
||||
@ -194,7 +194,7 @@ class AmphoraStatsController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AMPHORA
|
||||
|
||||
def __init__(self, amp_id):
|
||||
super(AmphoraStatsController, self).__init__()
|
||||
super().__init__()
|
||||
self.amp_id = amp_id
|
||||
|
||||
@wsme_pecan.wsexpose(amp_types.StatisticsRootResponse, wtypes.text,
|
||||
|
@ -37,7 +37,7 @@ class AvailabilityZoneProfileController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AVAILABILITY_ZONE_PROFILE
|
||||
|
||||
def __init__(self):
|
||||
super(AvailabilityZoneProfileController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(profile_types.AvailabilityZoneProfileRootResponse,
|
||||
wtypes.text, [wtypes.text], ignore_extra_args=True)
|
||||
@ -94,10 +94,10 @@ class AvailabilityZoneProfileController(base.BaseController):
|
||||
try:
|
||||
availability_zone_data_dict = jsonutils.loads(
|
||||
availability_zone_profile.availability_zone_data)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidOption(
|
||||
value=availability_zone_profile.availability_zone_data,
|
||||
option=constants.AVAILABILITY_ZONE_DATA)
|
||||
option=constants.AVAILABILITY_ZONE_DATA) from e
|
||||
|
||||
# Validate that the provider driver supports the metadata
|
||||
driver = driver_factory.get_driver(
|
||||
@ -115,9 +115,9 @@ class AvailabilityZoneProfileController(base.BaseController):
|
||||
self.repositories.availability_zone_profile.create(
|
||||
lock_session, **availability_zone_profile_dict))
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.IDAlreadyExists()
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
@ -170,10 +170,10 @@ class AvailabilityZoneProfileController(base.BaseController):
|
||||
try:
|
||||
availability_zone_data_dict = jsonutils.loads(
|
||||
availability_zone_profile.availability_zone_data)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidOption(
|
||||
value=availability_zone_profile.availability_zone_data,
|
||||
option=constants.FLAVOR_DATA)
|
||||
option=constants.FLAVOR_DATA) from e
|
||||
|
||||
if isinstance(availability_zone_profile.provider_name,
|
||||
wtypes.UnsetType):
|
||||
@ -232,6 +232,6 @@ class AvailabilityZoneProfileController(base.BaseController):
|
||||
try:
|
||||
self.repositories.availability_zone_profile.delete(
|
||||
context.session, id=availability_zone_profile_id)
|
||||
except sa_exception.NoResultFound:
|
||||
except sa_exception.NoResultFound as e:
|
||||
raise exceptions.NotFound(resource='Availability Zone Profile',
|
||||
id=availability_zone_profile_id)
|
||||
id=availability_zone_profile_id) from e
|
||||
|
@ -34,7 +34,7 @@ class AvailabilityZonesController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_AVAILABILITY_ZONE
|
||||
|
||||
def __init__(self):
|
||||
super(AvailabilityZonesController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(availability_zone_types.AvailabilityZoneRootResponse,
|
||||
wtypes.text, [wtypes.text], ignore_extra_args=True)
|
||||
@ -93,10 +93,10 @@ class AvailabilityZonesController(base.BaseController):
|
||||
db_availability_zone = self.repositories.availability_zone.create(
|
||||
lock_session, **availability_zone_dict)
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.RecordAlreadyExists(field='availability zone',
|
||||
name=availability_zone.name)
|
||||
raise exceptions.RecordAlreadyExists(
|
||||
field='availability zone', name=availability_zone.name) from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
@ -159,14 +159,14 @@ class AvailabilityZonesController(base.BaseController):
|
||||
serial_session, name=availability_zone_name)
|
||||
serial_session.commit()
|
||||
# Handle when load balancers still reference this availability_zone
|
||||
except odb_exceptions.DBReferenceError:
|
||||
except odb_exceptions.DBReferenceError as e:
|
||||
serial_session.rollback()
|
||||
raise exceptions.ObjectInUse(object='Availability Zone',
|
||||
id=availability_zone_name)
|
||||
except sa_exception.NoResultFound:
|
||||
id=availability_zone_name) from e
|
||||
except sa_exception.NoResultFound as e:
|
||||
serial_session.rollback()
|
||||
raise exceptions.NotFound(resource='Availability Zone',
|
||||
id=availability_zone_name)
|
||||
id=availability_zone_name) from e
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(
|
||||
|
@ -36,7 +36,7 @@ class BaseController(pecan_rest.RestController):
|
||||
RBAC_TYPE = None
|
||||
|
||||
def __init__(self):
|
||||
super(BaseController, self).__init__()
|
||||
super().__init__()
|
||||
self.cert_manager = stevedore_driver.DriverManager(
|
||||
namespace='octavia.cert_manager',
|
||||
name=CONF.certificates.cert_manager,
|
||||
|
@ -38,7 +38,7 @@ class FlavorProfileController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_FLAVOR_PROFILE
|
||||
|
||||
def __init__(self):
|
||||
super(FlavorProfileController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(profile_types.FlavorProfileRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -87,10 +87,10 @@ class FlavorProfileController(base.BaseController):
|
||||
# Do a basic JSON validation on the metadata
|
||||
try:
|
||||
flavor_data_dict = jsonutils.loads(flavorprofile.flavor_data)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidOption(
|
||||
value=flavorprofile.flavor_data,
|
||||
option=constants.FLAVOR_DATA)
|
||||
option=constants.FLAVOR_DATA) from e
|
||||
|
||||
# Validate that the provider driver supports the metadata
|
||||
driver = driver_factory.get_driver(flavorprofile.provider_name)
|
||||
@ -104,9 +104,9 @@ class FlavorProfileController(base.BaseController):
|
||||
db_flavor_profile = self.repositories.flavor_profile.create(
|
||||
lock_session, **flavorprofile_dict)
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.IDAlreadyExists()
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
@ -151,10 +151,10 @@ class FlavorProfileController(base.BaseController):
|
||||
# Do a basic JSON validation on the metadata
|
||||
try:
|
||||
flavor_data_dict = jsonutils.loads(flavorprofile.flavor_data)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidOption(
|
||||
value=flavorprofile.flavor_data,
|
||||
option=constants.FLAVOR_DATA)
|
||||
option=constants.FLAVOR_DATA) from e
|
||||
|
||||
if isinstance(flavorprofile.provider_name, wtypes.UnsetType):
|
||||
db_flavor_profile = self._get_db_flavor_profile(
|
||||
@ -207,6 +207,6 @@ class FlavorProfileController(base.BaseController):
|
||||
try:
|
||||
self.repositories.flavor_profile.delete(context.session,
|
||||
id=flavor_profile_id)
|
||||
except sa_exception.NoResultFound:
|
||||
raise exceptions.NotFound(resource='Flavor profile',
|
||||
id=flavor_profile_id)
|
||||
except sa_exception.NoResultFound as e:
|
||||
raise exceptions.NotFound(
|
||||
resource='Flavor profile', id=flavor_profile_id) from e
|
||||
|
@ -36,7 +36,7 @@ class FlavorsController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_FLAVOR
|
||||
|
||||
def __init__(self):
|
||||
super(FlavorsController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(flavor_types.FlavorRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -90,10 +90,10 @@ class FlavorsController(base.BaseController):
|
||||
db_flavor = self.repositories.flavor.create(lock_session,
|
||||
**flavor_dict)
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.RecordAlreadyExists(field='flavor',
|
||||
name=flavor.name)
|
||||
name=flavor.name) from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
@ -147,12 +147,12 @@ class FlavorsController(base.BaseController):
|
||||
self.repositories.flavor.delete(serial_session, id=flavor_id)
|
||||
serial_session.commit()
|
||||
# Handle when load balancers still reference this flavor
|
||||
except odb_exceptions.DBReferenceError:
|
||||
except odb_exceptions.DBReferenceError as e:
|
||||
serial_session.rollback()
|
||||
raise exceptions.ObjectInUse(object='Flavor', id=flavor_id)
|
||||
except sa_exception.NoResultFound:
|
||||
raise exceptions.ObjectInUse(object='Flavor', id=flavor_id) from e
|
||||
except sa_exception.NoResultFound as e:
|
||||
serial_session.rollback()
|
||||
raise exceptions.NotFound(resource='Flavor', id=flavor_id)
|
||||
raise exceptions.NotFound(resource='Flavor', id=flavor_id) from e
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error('Unknown flavor delete exception: %s', str(e))
|
||||
|
@ -42,7 +42,7 @@ class HealthMonitorController(base.BaseController):
|
||||
RBAC_TYPE = consts.RBAC_HEALTHMONITOR
|
||||
|
||||
def __init__(self):
|
||||
super(HealthMonitorController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(hm_types.HealthMonitorRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -156,13 +156,13 @@ class HealthMonitorController(base.BaseController):
|
||||
try:
|
||||
return self.repositories.health_monitor.create(
|
||||
lock_session, **hm_dict)
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
raise exceptions.DuplicateHealthMonitor()
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
raise exceptions.DuplicateHealthMonitor() from e
|
||||
except odb_exceptions.DBError as e:
|
||||
# TODO(blogan): will have to do separate validation protocol
|
||||
# before creation or update since the exception messages
|
||||
# do not give any information as to what constraint failed
|
||||
raise exceptions.InvalidOption(value='', option='')
|
||||
raise exceptions.InvalidOption(value='', option='') from e
|
||||
|
||||
def _validate_healthmonitor_request_for_udp(self, request):
|
||||
if request.type not in (
|
||||
@ -248,10 +248,10 @@ class HealthMonitorController(base.BaseController):
|
||||
driver.name, driver.health_monitor_create, provider_healthmon)
|
||||
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBError as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.InvalidOption(
|
||||
value=hm_dict.get('type'), option='type')
|
||||
value=hm_dict.get('type'), option='type') from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
|
@ -43,7 +43,7 @@ class L7PolicyController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_L7POLICY
|
||||
|
||||
def __init__(self):
|
||||
super(L7PolicyController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(l7policy_types.L7PolicyRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -103,13 +103,13 @@ class L7PolicyController(base.BaseController):
|
||||
|
||||
return self.repositories.l7policy.create(lock_session,
|
||||
**l7policy_dict)
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
raise exceptions.IDAlreadyExists()
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except odb_exceptions.DBError as e:
|
||||
# TODO(blogan): will have to do separate validation protocol
|
||||
# before creation or update since the exception messages
|
||||
# do not give any information as to what constraint failed
|
||||
raise exceptions.InvalidOption(value='', option='')
|
||||
raise exceptions.InvalidOption(value='', option='') from e
|
||||
|
||||
@wsme_pecan.wsexpose(l7policy_types.L7PolicyRootResponse,
|
||||
body=l7policy_types.L7PolicyRootPOST, status_code=201)
|
||||
|
@ -39,7 +39,7 @@ class L7RuleController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_L7RULE
|
||||
|
||||
def __init__(self, l7policy_id):
|
||||
super(L7RuleController, self).__init__()
|
||||
super().__init__()
|
||||
self.l7policy_id = l7policy_id
|
||||
|
||||
@wsme_pecan.wsexpose(l7rule_types.L7RuleRootResponse, wtypes.text,
|
||||
@ -110,13 +110,13 @@ class L7RuleController(base.BaseController):
|
||||
def _validate_create_l7rule(self, lock_session, l7rule_dict):
|
||||
try:
|
||||
return self.repositories.l7rule.create(lock_session, **l7rule_dict)
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
raise exceptions.IDAlreadyExists()
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except odb_exceptions.DBError as e:
|
||||
# TODO(blogan): will have to do separate validation protocol
|
||||
# before creation or update since the exception messages
|
||||
# do not give any information as to what constraint failed
|
||||
raise exceptions.InvalidOption(value='', option='')
|
||||
raise exceptions.InvalidOption(value='', option='') from e
|
||||
|
||||
@wsme_pecan.wsexpose(l7rule_types.L7RuleRootResponse,
|
||||
body=l7rule_types.L7RuleRootPOST, status_code=201)
|
||||
|
@ -47,7 +47,7 @@ class ListenersController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_LISTENER
|
||||
|
||||
def __init__(self):
|
||||
super(ListenersController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(listener_types.ListenerRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -323,9 +323,9 @@ class ListenersController(base.BaseController):
|
||||
raise exceptions.DuplicateListenerEntry(
|
||||
protocol=listener_dict.get('protocol'),
|
||||
port=listener_dict.get('protocol_port'))
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBError as e:
|
||||
raise exceptions.InvalidOption(value=listener_dict.get('protocol'),
|
||||
option='protocol')
|
||||
option='protocol') from e
|
||||
|
||||
@wsme_pecan.wsexpose(listener_types.ListenerRootResponse,
|
||||
body=listener_types.ListenerRootPOST, status_code=201)
|
||||
@ -647,7 +647,7 @@ class StatisticsController(base.BaseController, stats.StatsMixin):
|
||||
RBAC_TYPE = constants.RBAC_LISTENER
|
||||
|
||||
def __init__(self, listener_id):
|
||||
super(StatisticsController, self).__init__()
|
||||
super().__init__()
|
||||
self.id = listener_id
|
||||
|
||||
@wsme_pecan.wsexpose(listener_types.StatisticsRootResponse, wtypes.text,
|
||||
|
@ -52,7 +52,7 @@ class LoadBalancersController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_LOADBALANCER
|
||||
|
||||
def __init__(self):
|
||||
super(LoadBalancersController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(lb_types.LoadBalancerRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -293,9 +293,9 @@ class LoadBalancersController(base.BaseController):
|
||||
try:
|
||||
provider = self.repositories.flavor.get_flavor_provider(
|
||||
session, load_balancer.flavor_id)
|
||||
except sa_exception.NoResultFound:
|
||||
except sa_exception.NoResultFound as e:
|
||||
raise exceptions.ValidationException(
|
||||
detail=_("Invalid flavor_id."))
|
||||
detail=_("Invalid flavor_id.")) from e
|
||||
|
||||
# No provider specified and no flavor specified, use conf default
|
||||
if (isinstance(load_balancer.provider, wtypes.UnsetType) and
|
||||
@ -322,9 +322,9 @@ class LoadBalancersController(base.BaseController):
|
||||
flavor_dict = (
|
||||
self.repositories.flavor.get_flavor_metadata_dict(
|
||||
lock_session, lb_dict['flavor_id']))
|
||||
except sa_exception.NoResultFound:
|
||||
except sa_exception.NoResultFound as e:
|
||||
raise exceptions.ValidationException(
|
||||
detail=_("Invalid flavor_id."))
|
||||
detail=_("Invalid flavor_id.")) from e
|
||||
|
||||
# Make sure the driver will still accept the flavor metadata
|
||||
if flavor_dict:
|
||||
@ -361,9 +361,9 @@ class LoadBalancersController(base.BaseController):
|
||||
self.repositories.availability_zone
|
||||
.get_availability_zone_metadata_dict(lock_session, az.name)
|
||||
)
|
||||
except sa_exception.NoResultFound:
|
||||
except sa_exception.NoResultFound as e:
|
||||
raise exceptions.ValidationException(
|
||||
detail=_("Invalid availability_zone."))
|
||||
detail=_("Invalid availability_zone.")) from e
|
||||
|
||||
# Make sure the driver will still accept the availability zone metadata
|
||||
if az_dict:
|
||||
@ -371,10 +371,10 @@ class LoadBalancersController(base.BaseController):
|
||||
driver_utils.call_provider(driver.name,
|
||||
driver.validate_availability_zone,
|
||||
az_dict)
|
||||
except NotImplementedError:
|
||||
except NotImplementedError as e:
|
||||
raise exceptions.ProviderNotImplementedError(
|
||||
prov=driver.name, user_msg="This provider does not support"
|
||||
" availability zones.")
|
||||
" availability zones.") from e
|
||||
|
||||
return az_dict
|
||||
|
||||
@ -513,9 +513,9 @@ class LoadBalancersController(base.BaseController):
|
||||
driver_dm.LoadBalancer.from_dict(driver_lb_dict))
|
||||
|
||||
lock_session.commit()
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
lock_session.rollback()
|
||||
raise exceptions.IDAlreadyExists()
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
lock_session.rollback()
|
||||
@ -758,7 +758,7 @@ class StatusController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_LOADBALANCER
|
||||
|
||||
def __init__(self, lb_id):
|
||||
super(StatusController, self).__init__()
|
||||
super().__init__()
|
||||
self.id = lb_id
|
||||
|
||||
@wsme_pecan.wsexpose(lb_types.StatusRootResponse, wtypes.text,
|
||||
@ -786,7 +786,7 @@ class StatisticsController(base.BaseController, stats.StatsMixin):
|
||||
RBAC_TYPE = constants.RBAC_LOADBALANCER
|
||||
|
||||
def __init__(self, lb_id):
|
||||
super(StatisticsController, self).__init__()
|
||||
super().__init__()
|
||||
self.id = lb_id
|
||||
|
||||
@wsme_pecan.wsexpose(lb_types.StatisticsRootResponse, wtypes.text,
|
||||
@ -814,7 +814,7 @@ class StatisticsController(base.BaseController, stats.StatsMixin):
|
||||
class FailoverController(LoadBalancersController):
|
||||
|
||||
def __init__(self, lb_id):
|
||||
super(FailoverController, self).__init__()
|
||||
super().__init__()
|
||||
self.lb_id = lb_id
|
||||
|
||||
@wsme_pecan.wsexpose(None, wtypes.text, status_code=202)
|
||||
|
@ -41,7 +41,7 @@ class MemberController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_MEMBER
|
||||
|
||||
def __init__(self, pool_id):
|
||||
super(MemberController, self).__init__()
|
||||
super().__init__()
|
||||
self.pool_id = pool_id
|
||||
|
||||
@wsme_pecan.wsexpose(member_types.MemberRootResponse, wtypes.text,
|
||||
@ -129,11 +129,11 @@ class MemberController(base.BaseController):
|
||||
raise exceptions.DuplicateMemberEntry(
|
||||
ip_address=member_dict.get('ip_address'),
|
||||
port=member_dict.get('protocol_port'))
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBError as e:
|
||||
# TODO(blogan): will have to do separate validation protocol
|
||||
# before creation or update since the exception messages
|
||||
# do not give any information as to what constraint failed
|
||||
raise exceptions.InvalidOption(value='', option='')
|
||||
raise exceptions.InvalidOption(value='', option='') from e
|
||||
|
||||
def _validate_pool_id(self, member_id, db_member_pool_id):
|
||||
if db_member_pool_id != self.pool_id:
|
||||
@ -319,7 +319,7 @@ class MemberController(base.BaseController):
|
||||
class MembersController(MemberController):
|
||||
|
||||
def __init__(self, pool_id):
|
||||
super(MembersController, self).__init__(pool_id)
|
||||
super().__init__(pool_id)
|
||||
|
||||
@wsme_pecan.wsexpose(None, wtypes.text,
|
||||
body=member_types.MembersRootPUT, status_code=202)
|
||||
|
@ -46,7 +46,7 @@ class PoolsController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_POOL
|
||||
|
||||
def __init__(self):
|
||||
super(PoolsController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(pool_types.PoolRootResponse, wtypes.text,
|
||||
[wtypes.text], ignore_extra_args=True)
|
||||
@ -141,13 +141,13 @@ class PoolsController(base.BaseController):
|
||||
return self.repositories.create_pool_on_load_balancer(
|
||||
lock_session, pool_dict,
|
||||
listener_id=listener_id)
|
||||
except odb_exceptions.DBDuplicateEntry:
|
||||
raise exceptions.IDAlreadyExists()
|
||||
except odb_exceptions.DBError:
|
||||
except odb_exceptions.DBDuplicateEntry as e:
|
||||
raise exceptions.IDAlreadyExists() from e
|
||||
except odb_exceptions.DBError as e:
|
||||
# TODO(blogan): will have to do separate validation protocol
|
||||
# before creation or update since the exception messages
|
||||
# do not give any information as to what constraint failed
|
||||
raise exceptions.InvalidOption(value='', option='')
|
||||
raise exceptions.InvalidOption(value='', option='') from e
|
||||
|
||||
def _is_only_specified_in_request(self, request, **kwargs):
|
||||
request_attrs = []
|
||||
|
@ -34,7 +34,7 @@ class ProviderController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_PROVIDER
|
||||
|
||||
def __init__(self):
|
||||
super(ProviderController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(provider_types.ProvidersRootResponse, [wtypes.text],
|
||||
ignore_extra_args=True)
|
||||
@ -76,7 +76,7 @@ class FlavorCapabilitiesController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_PROVIDER_FLAVOR
|
||||
|
||||
def __init__(self, provider):
|
||||
super(FlavorCapabilitiesController, self).__init__()
|
||||
super().__init__()
|
||||
self.provider = provider
|
||||
|
||||
@wsme_pecan.wsexpose(provider_types.FlavorCapabilitiesResponse,
|
||||
@ -126,7 +126,7 @@ class AvailabilityZoneCapabilitiesController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_PROVIDER_AVAILABILITY_ZONE
|
||||
|
||||
def __init__(self, provider):
|
||||
super(AvailabilityZoneCapabilitiesController, self).__init__()
|
||||
super().__init__()
|
||||
self.provider = provider
|
||||
|
||||
@wsme_pecan.wsexpose(provider_types.AvailabilityZoneCapabilitiesResponse,
|
||||
|
@ -31,7 +31,7 @@ class QuotasController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_QUOTA
|
||||
|
||||
def __init__(self):
|
||||
super(QuotasController, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@wsme_pecan.wsexpose(quota_types.QuotaResponse, wtypes.text)
|
||||
def get(self, project_id):
|
||||
@ -103,7 +103,7 @@ class QuotasDefaultController(base.BaseController):
|
||||
RBAC_TYPE = constants.RBAC_QUOTA
|
||||
|
||||
def __init__(self, project_id):
|
||||
super(QuotasDefaultController, self).__init__()
|
||||
super().__init__()
|
||||
self.project_id = project_id
|
||||
|
||||
@wsme_pecan.wsexpose(quota_types.QuotaResponse, wtypes.text)
|
||||
|
@ -42,7 +42,7 @@ class QuotaBase(base.BaseType):
|
||||
minimum=consts.MIN_QUOTA, maximum=consts.MAX_QUOTA))
|
||||
|
||||
def to_dict(self, render_unsets=False):
|
||||
quota_dict = super(QuotaBase, self).to_dict(render_unsets)
|
||||
quota_dict = super().to_dict(render_unsets)
|
||||
if 'loadbalancer' in quota_dict:
|
||||
quota_dict['load_balancer'] = quota_dict.pop('loadbalancer')
|
||||
if 'healthmonitor' in quota_dict:
|
||||
|
@ -46,20 +46,20 @@ class LocalCertGenerator(cert_gen.CertGenerator):
|
||||
LOG.info("Using CA Certificate from config.")
|
||||
try:
|
||||
ca_cert = open(CONF.certificates.ca_certificate, 'rb').read()
|
||||
except IOError:
|
||||
except IOError as e:
|
||||
raise exceptions.CertificateGenerationException(
|
||||
msg="Failed to load CA Certificate {0}."
|
||||
.format(CONF.certificates.ca_certificate)
|
||||
)
|
||||
) from e
|
||||
if not ca_key:
|
||||
LOG.info("Using CA Private Key from config.")
|
||||
try:
|
||||
ca_key = open(CONF.certificates.ca_private_key, 'rb').read()
|
||||
except IOError:
|
||||
except IOError as e:
|
||||
raise exceptions.CertificateGenerationException(
|
||||
msg="Failed to load CA Private Key {0}."
|
||||
.format(CONF.certificates.ca_private_key)
|
||||
)
|
||||
) from e
|
||||
if not ca_key_pass:
|
||||
ca_key_pass = CONF.certificates.ca_private_key_passphrase
|
||||
if ca_key_pass:
|
||||
@ -92,10 +92,10 @@ class LocalCertGenerator(cert_gen.CertGenerator):
|
||||
ca_digest = CONF.certificates.signing_digest
|
||||
try:
|
||||
algorithm = getattr(hashes, ca_digest.upper())()
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
raise crypto_exceptions.UnsupportedAlgorithm(
|
||||
"Supplied digest method not found: %s" % ca_digest
|
||||
)
|
||||
) from e
|
||||
|
||||
if not ca_cert:
|
||||
with open(CONF.certificates.ca_certificate, 'rb') as f:
|
||||
|
@ -38,7 +38,7 @@ class BarbicanCertManager(cert_mgr.CertManager):
|
||||
"""Certificate Manager that wraps the Barbican client API."""
|
||||
|
||||
def __init__(self):
|
||||
super(BarbicanCertManager, self).__init__()
|
||||
super().__init__()
|
||||
self.auth = stevedore_driver.DriverManager(
|
||||
namespace='octavia.barbican_auth',
|
||||
name=cfg.CONF.certificates.barbican_auth,
|
||||
|
@ -32,7 +32,7 @@ class BarbicanCertManager(cert_mgr.CertManager):
|
||||
"""Certificate Manager that wraps the Barbican client API."""
|
||||
|
||||
def __init__(self, auth=None):
|
||||
super(BarbicanCertManager, self).__init__()
|
||||
super().__init__()
|
||||
if auth:
|
||||
self.auth = auth
|
||||
else:
|
||||
|
@ -32,7 +32,7 @@ class CastellanCertManager(cert_mgr.CertManager):
|
||||
"""Certificate Manager for the Castellan library."""
|
||||
|
||||
def __init__(self):
|
||||
super(CastellanCertManager, self).__init__()
|
||||
super().__init__()
|
||||
self.manager = key_manager.API()
|
||||
|
||||
def store_cert(self, context, certificate, private_key, intermediates=None,
|
||||
|
@ -117,17 +117,17 @@ class LocalCertManager(cert_mgr.CertManager):
|
||||
try:
|
||||
with os.fdopen(os.open(filename_certificate, flags)) as cert_file:
|
||||
cert_data['certificate'] = cert_file.read()
|
||||
except IOError:
|
||||
except IOError as e:
|
||||
LOG.error("Failed to read certificate for %s.", cert_ref)
|
||||
raise exceptions.CertificateStorageException(
|
||||
msg="Certificate could not be read.")
|
||||
msg="Certificate could not be read.") from e
|
||||
try:
|
||||
with os.fdopen(os.open(filename_private_key, flags)) as key_file:
|
||||
cert_data['private_key'] = key_file.read()
|
||||
except IOError:
|
||||
except IOError as e:
|
||||
LOG.error("Failed to read private key for %s", cert_ref)
|
||||
raise exceptions.CertificateStorageException(
|
||||
msg="Private Key could not be read.")
|
||||
msg="Private Key could not be read.") from e
|
||||
|
||||
try:
|
||||
with os.fdopen(os.open(filename_intermediates, flags)) as int_file:
|
||||
@ -204,8 +204,9 @@ class LocalCertManager(cert_mgr.CertManager):
|
||||
try:
|
||||
with os.fdopen(os.open(filename_secret, flags)) as secret_file:
|
||||
secret_data = secret_file.read()
|
||||
except IOError:
|
||||
except IOError as e:
|
||||
LOG.error("Failed to read secret for %s.", secret_ref)
|
||||
raise exceptions.CertificateRetrievalException(ref=secret_ref)
|
||||
raise exceptions.CertificateRetrievalException(
|
||||
ref=secret_ref) from e
|
||||
|
||||
return secret_data
|
||||
|
@ -37,7 +37,7 @@ class AmphoraAgent(gunicorn.app.base.BaseApplication):
|
||||
def __init__(self, app, options=None):
|
||||
self.options = options or {}
|
||||
self.application = app
|
||||
super(AmphoraAgent, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
def load_config(self):
|
||||
config = {key: value for key, value in self.options.items()
|
||||
|
@ -76,7 +76,7 @@ class BaseTaskFlowEngine(object):
|
||||
class ExtendExpiryListener(base.Listener):
|
||||
|
||||
def __init__(self, engine, job):
|
||||
super(ExtendExpiryListener, self).__init__(engine)
|
||||
super().__init__(engine)
|
||||
self.job = job
|
||||
|
||||
def _task_receiver(self, state, details):
|
||||
@ -92,14 +92,14 @@ class ExtendExpiryListener(base.Listener):
|
||||
class DynamicLoggingConductor(impl_blocking.BlockingConductor):
|
||||
|
||||
def _listeners_from_job(self, job, engine):
|
||||
listeners = super(DynamicLoggingConductor, self)._listeners_from_job(
|
||||
listeners = super()._listeners_from_job(
|
||||
job, engine)
|
||||
listeners.append(logging.DynamicLoggingListener(engine, log=LOG))
|
||||
|
||||
return listeners
|
||||
|
||||
def _on_job_done(self, job, fut):
|
||||
super(DynamicLoggingConductor, self)._on_job_done(job, fut)
|
||||
super()._on_job_done(job, fut)
|
||||
# Double check that job is complete.
|
||||
if (not CONF.task_flow.jobboard_save_logbook and
|
||||
job.state == states.COMPLETE):
|
||||
@ -115,8 +115,7 @@ class DynamicLoggingConductor(impl_blocking.BlockingConductor):
|
||||
class RedisDynamicLoggingConductor(DynamicLoggingConductor):
|
||||
|
||||
def _listeners_from_job(self, job, engine):
|
||||
listeners = super(RedisDynamicLoggingConductor,
|
||||
self)._listeners_from_job(job, engine)
|
||||
listeners = super()._listeners_from_job(job, engine)
|
||||
listeners.append(ExtendExpiryListener(engine, job))
|
||||
return listeners
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Context(common_context.RequestContext):
|
||||
if project_id:
|
||||
kwargs['tenant'] = project_id
|
||||
|
||||
super(Context, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.is_admin = (policy.get_enforcer().check_is_admin(self) or
|
||||
CONF.api_settings.auth_strategy == constants.NOAUTH)
|
||||
|
@ -40,14 +40,14 @@ class OctaviaException(Exception):
|
||||
self.message = args[0]
|
||||
self.orig_msg = kwargs.get('orig_msg')
|
||||
self.orig_code = kwargs.get('orig_code')
|
||||
super(OctaviaException, self).__init__(self.message % kwargs)
|
||||
super().__init__(self.message % kwargs)
|
||||
self.msg = self.message % kwargs
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
if not self.use_fatal_exceptions():
|
||||
ctxt.reraise = False
|
||||
# at least get the core message out if something happened
|
||||
super(OctaviaException, self).__init__(self.message)
|
||||
super().__init__(self.message)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.msg
|
||||
@ -66,7 +66,7 @@ class APIException(exc.HTTPClientError):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.msg = self.msg % kwargs
|
||||
super(APIException, self).__init__(detail=self.msg)
|
||||
super().__init__(detail=self.msg)
|
||||
|
||||
|
||||
class NotFound(APIException):
|
||||
|
@ -77,4 +77,4 @@ class SkippingAuthProtocol(auth_token.AuthProtocol):
|
||||
'authentication', path)
|
||||
return None # return NONE to reach actual logic
|
||||
|
||||
return super(SkippingAuthProtocol, self).process_request(request)
|
||||
return super().process_request(request)
|
||||
|
@ -63,8 +63,8 @@ class Policy(oslo_policy.Enforcer):
|
||||
rules from config file.
|
||||
"""
|
||||
|
||||
super(Policy, self).__init__(conf, policy_file, rules, default_rule,
|
||||
use_conf, overwrite)
|
||||
super().__init__(conf, policy_file, rules, default_rule, use_conf,
|
||||
overwrite)
|
||||
|
||||
self.register_defaults(policies.list_rules())
|
||||
|
||||
@ -107,7 +107,7 @@ class Policy(oslo_policy.Enforcer):
|
||||
exc = exceptions.PolicyForbidden
|
||||
|
||||
try:
|
||||
return super(Policy, self).authorize(
|
||||
return super().authorize(
|
||||
action, target, credentials, do_raise=do_raise, exc=exc)
|
||||
except oslo_policy.PolicyNotRegistered:
|
||||
with excutils.save_and_reraise_exception():
|
||||
@ -139,7 +139,7 @@ class IsAdminCheck(oslo_policy.Check):
|
||||
|
||||
self.expected = match.lower() == 'true'
|
||||
|
||||
super(IsAdminCheck, self).__init__(kind, str(self.expected))
|
||||
super().__init__(kind, str(self.expected))
|
||||
|
||||
def __call__(self, target, creds, enforcer):
|
||||
"""Determine whether is_admin matches the requested value."""
|
||||
|
@ -24,7 +24,7 @@ LOG = logging.getLogger(__name__)
|
||||
class StatsMixin(object):
|
||||
|
||||
def __init__(self):
|
||||
super(StatsMixin, self).__init__()
|
||||
super().__init__()
|
||||
self.listener_stats_repo = repo.ListenerStatisticsRepository()
|
||||
self.repo_amphora = repo.AmphoraRepository()
|
||||
self.repo_loadbalancer = repo.LoadBalancerRepository()
|
||||
|
@ -80,9 +80,9 @@ def _read_private_key(private_key_pem, passphrase=None):
|
||||
try:
|
||||
return serialization.load_pem_private_key(private_key_pem, passphrase,
|
||||
backends.default_backend())
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception("Passphrase required.")
|
||||
raise exceptions.NeedsPassphrase
|
||||
raise exceptions.NeedsPassphrase from e
|
||||
|
||||
|
||||
def prepare_private_key(private_key, passphrase=None):
|
||||
@ -166,9 +166,9 @@ def _parse_pkcs7_bundle(pkcs7):
|
||||
for substrate in _read_pem_blocks(pkcs7):
|
||||
for cert in _get_certs_from_pkcs7_substrate(substrate):
|
||||
yield cert
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
|
||||
# If no PEM encoding, assume this is DER encoded and try to decode
|
||||
else:
|
||||
@ -225,9 +225,9 @@ def _get_certs_from_pkcs7_substrate(substrate):
|
||||
contentInfo, _ = der_decoder.decode(substrate,
|
||||
asn1Spec=rfc2315.ContentInfo())
|
||||
contentType = contentInfo.getComponentByName('contentType')
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
if contentType != rfc2315.signedData:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
@ -236,9 +236,9 @@ def _get_certs_from_pkcs7_substrate(substrate):
|
||||
content, _ = der_decoder.decode(
|
||||
contentInfo.getComponentByName('content'),
|
||||
asn1Spec=rfc2315.SignedData())
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
|
||||
for cert in content.getComponentByName('certificates'):
|
||||
yield der_encoder.encode(cert)
|
||||
@ -275,9 +275,9 @@ def get_host_names(certificate):
|
||||
x509.OID_SUBJECT_ALTERNATIVE_NAME)
|
||||
|
||||
return host_names
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
|
||||
|
||||
def get_cert_expiration(certificate_pem):
|
||||
@ -290,9 +290,9 @@ def get_cert_expiration(certificate_pem):
|
||||
cert = x509.load_pem_x509_certificate(certificate_pem,
|
||||
backends.default_backend())
|
||||
return cert.not_valid_after
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
|
||||
|
||||
def _get_x509_from_pem_bytes(certificate_pem):
|
||||
@ -306,9 +306,9 @@ def _get_x509_from_pem_bytes(certificate_pem):
|
||||
try:
|
||||
x509cert = x509.load_pem_x509_certificate(certificate_pem,
|
||||
backends.default_backend())
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
return x509cert
|
||||
|
||||
|
||||
@ -321,9 +321,9 @@ def _get_x509_from_der_bytes(certificate_der):
|
||||
try:
|
||||
x509cert = x509.load_der_x509_certificate(certificate_der,
|
||||
backends.default_backend())
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception('Unreadable Certificate.')
|
||||
raise exceptions.UnreadableCert
|
||||
raise exceptions.UnreadableCert from e
|
||||
return x509cert
|
||||
|
||||
|
||||
|
@ -44,8 +44,8 @@ def url(url, require_scheme=True):
|
||||
if require_scheme:
|
||||
if p_url.scheme != 'http' and p_url.scheme != 'https':
|
||||
raise exceptions.InvalidURL(url=url)
|
||||
except Exception:
|
||||
raise exceptions.InvalidURL(url=url)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidURL(url=url) from e
|
||||
return True
|
||||
|
||||
|
||||
@ -63,8 +63,8 @@ def url_path(url_path):
|
||||
|
||||
if invalid_path:
|
||||
raise exceptions.InvalidURLPath(url_path=url_path)
|
||||
except Exception:
|
||||
raise exceptions.InvalidURLPath(url_path=url_path)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidURLPath(url_path=url_path) from e
|
||||
return True
|
||||
|
||||
|
||||
@ -317,8 +317,8 @@ def port_exists(port_id, context=None):
|
||||
network_driver = utils.get_network_driver()
|
||||
try:
|
||||
port = network_driver.get_port(port_id, context=context)
|
||||
except Exception:
|
||||
raise exceptions.InvalidSubresource(resource='Port', id=port_id)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidSubresource(resource='Port', id=port_id) from e
|
||||
return port
|
||||
|
||||
|
||||
@ -336,8 +336,9 @@ def subnet_exists(subnet_id, context=None):
|
||||
network_driver = utils.get_network_driver()
|
||||
try:
|
||||
subnet = network_driver.get_subnet(subnet_id, context=context)
|
||||
except Exception:
|
||||
raise exceptions.InvalidSubresource(resource='Subnet', id=subnet_id)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidSubresource(
|
||||
resource='Subnet', id=subnet_id) from e
|
||||
return subnet
|
||||
|
||||
|
||||
@ -346,9 +347,9 @@ def qos_policy_exists(qos_policy_id):
|
||||
qos_extension_enabled(network_driver)
|
||||
try:
|
||||
qos_policy = network_driver.get_qos_policy(qos_policy_id)
|
||||
except Exception:
|
||||
raise exceptions.InvalidSubresource(resource='qos_policy',
|
||||
id=qos_policy_id)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidSubresource(
|
||||
resource='qos_policy', id=qos_policy_id) from e
|
||||
return qos_policy
|
||||
|
||||
|
||||
@ -367,8 +368,9 @@ def network_exists_optionally_contains_subnet(network_id, subnet_id=None,
|
||||
network_driver = utils.get_network_driver()
|
||||
try:
|
||||
network = network_driver.get_network(network_id, context=context)
|
||||
except Exception:
|
||||
raise exceptions.InvalidSubresource(resource='Network', id=network_id)
|
||||
except Exception as e:
|
||||
raise exceptions.InvalidSubresource(
|
||||
resource='Network', id=network_id) from e
|
||||
if subnet_id:
|
||||
if not network.subnets or subnet_id not in network.subnets:
|
||||
raise exceptions.InvalidSubresource(resource='Subnet',
|
||||
@ -414,9 +416,9 @@ def check_session_persistence(SP_dict):
|
||||
'"APP_COOKIE" session persistence type.'))
|
||||
except exceptions.ValidationException:
|
||||
raise
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.ValidationException(detail=_(
|
||||
'Invalid session_persistence provided.'))
|
||||
'Invalid session_persistence provided.')) from e
|
||||
|
||||
|
||||
def ip_not_reserved(ip_address):
|
||||
|
@ -25,7 +25,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class NoopManager(object):
|
||||
def __init__(self):
|
||||
super(NoopManager, self).__init__()
|
||||
super().__init__()
|
||||
self.computeconfig = {}
|
||||
|
||||
def build(self, name="amphora_name", amphora_flavor=None,
|
||||
@ -120,7 +120,7 @@ class NoopManager(object):
|
||||
|
||||
class NoopComputeDriver(driver_base.ComputeBase):
|
||||
def __init__(self):
|
||||
super(NoopComputeDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
def build(self, name="amphora_name", amphora_flavor=None,
|
||||
|
@ -61,7 +61,7 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
'''Compute implementation of virtual machines via nova.'''
|
||||
|
||||
def __init__(self):
|
||||
super(VirtualMachineManager, self).__init__()
|
||||
super().__init__()
|
||||
# Must initialize nova api
|
||||
self._nova_client = clients.NovaAuth.get_nova_client(
|
||||
endpoint=CONF.nova.endpoint,
|
||||
@ -201,9 +201,9 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
amphora, fault = self.get_amphora(compute_id)
|
||||
if amphora and amphora.status == 'ACTIVE':
|
||||
return constants.UP
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception("Error retrieving nova virtual machine status.")
|
||||
raise exceptions.ComputeStatusException()
|
||||
raise exceptions.ComputeStatusException() from e
|
||||
return constants.DOWN
|
||||
|
||||
def get_amphora(self, compute_id, management_network_id=None):
|
||||
@ -217,9 +217,9 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
# utilize nova client ServerManager 'get' method to retrieve info
|
||||
try:
|
||||
amphora = self.manager.get(compute_id)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception("Error retrieving nova virtual machine.")
|
||||
raise exceptions.ComputeGetException()
|
||||
raise exceptions.ComputeGetException() from e
|
||||
return self._translate_amphora(amphora, management_network_id)
|
||||
|
||||
def _translate_amphora(self, nova_response, management_network_id=None):
|
||||
@ -307,9 +307,9 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
try:
|
||||
server_group_obj = self.server_groups.create(**kwargs)
|
||||
return server_group_obj
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception("Error create server group instance.")
|
||||
raise exceptions.ServerGroupObjectCreateException()
|
||||
raise exceptions.ServerGroupObjectCreateException() from e
|
||||
|
||||
def delete_server_group(self, server_group_id):
|
||||
"""Delete a server group object
|
||||
@ -323,9 +323,9 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
except nova_exceptions.NotFound:
|
||||
LOG.warning("Server group instance with id: %s not found. "
|
||||
"Assuming already deleted.", server_group_id)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.exception("Error delete server group instance.")
|
||||
raise exceptions.ServerGroupObjectDeleteException()
|
||||
raise exceptions.ServerGroupObjectDeleteException() from e
|
||||
|
||||
def attach_network_or_port(self, compute_id, network_id=None,
|
||||
ip_address=None, port_id=None):
|
||||
@ -409,10 +409,10 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
||||
"""
|
||||
try:
|
||||
self.flavor_manager.get(flavor_id)
|
||||
except nova_exceptions.NotFound:
|
||||
except nova_exceptions.NotFound as e:
|
||||
LOG.info('Flavor %s was not found in nova.', flavor_id)
|
||||
raise exceptions.InvalidSubresource(resource='Nova flavor',
|
||||
id=flavor_id)
|
||||
id=flavor_id) from e
|
||||
except Exception as e:
|
||||
LOG.exception('Nova reports a failure getting flavor details for '
|
||||
'flavor ID %s: %s', flavor_id, e)
|
||||
|
@ -35,7 +35,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class UpdateHealthDb(update_base.HealthUpdateBase):
|
||||
def __init__(self):
|
||||
super(UpdateHealthDb, self).__init__()
|
||||
super().__init__()
|
||||
# first setup repo for amphora, listener,member(nodes),pool repo
|
||||
self.amphora_repo = repo.AmphoraRepository()
|
||||
self.amphora_health_repo = repo.AmphoraHealthRepository()
|
||||
|
@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
|
||||
class ConsumerService(cotyledon.Service):
|
||||
|
||||
def __init__(self, worker_id, conf):
|
||||
super(ConsumerService, self).__init__(worker_id)
|
||||
super().__init__(worker_id)
|
||||
self.conf = conf
|
||||
self.topic = conf.oslo_messaging.topic
|
||||
self.server = conf.host
|
||||
@ -61,4 +61,4 @@ class ConsumerService(cotyledon.Service):
|
||||
e.worker.executor.shutdown()
|
||||
except AttributeError:
|
||||
pass
|
||||
super(ConsumerService, self).terminate()
|
||||
super().terminate()
|
||||
|
@ -31,7 +31,7 @@ CONF = cfg.CONF
|
||||
class ConsumerService(cotyledon.Service):
|
||||
|
||||
def __init__(self, worker_id, conf):
|
||||
super(ConsumerService, self).__init__(worker_id)
|
||||
super().__init__(worker_id)
|
||||
self.conf = conf
|
||||
self.topic = constants.TOPIC_AMPHORA_V2
|
||||
self.server = conf.host
|
||||
@ -71,4 +71,4 @@ class ConsumerService(cotyledon.Service):
|
||||
e.worker.executor.shutdown()
|
||||
except AttributeError:
|
||||
pass
|
||||
super(ConsumerService, self).terminate()
|
||||
super().terminate()
|
||||
|
@ -36,7 +36,7 @@ class TaskUtils(object):
|
||||
self.amp_health_repo = repo.AmphoraHealthRepository()
|
||||
self.l7policy_repo = repo.L7PolicyRepository()
|
||||
self.l7rule_repo = repo.L7RuleRepository()
|
||||
super(TaskUtils, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def unmark_amphora_health_busy(self, amphora_id):
|
||||
"""Unmark the amphora_health record busy for an amphora.
|
||||
|
@ -69,7 +69,7 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
|
||||
self._flavor_repo = repo.FlavorRepository()
|
||||
self._az_repo = repo.AvailabilityZoneRepository()
|
||||
|
||||
super(ControllerWorker, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
@tenacity.retry(
|
||||
retry=(
|
||||
|
@ -36,7 +36,7 @@ class BaseAmphoraTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseAmphoraTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.amphora_driver = stevedore_driver.DriverManager(
|
||||
namespace='octavia.amphora.drivers',
|
||||
name=CONF.controller_worker.amphora_driver,
|
||||
|
@ -27,7 +27,7 @@ class BaseCertTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseCertTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.cert_generator = stevedore_driver.DriverManager(
|
||||
namespace='octavia.cert_generator',
|
||||
name=CONF.certificates.cert_generator,
|
||||
|
@ -39,7 +39,7 @@ class BaseComputeTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseComputeTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.compute = stevedore_driver.DriverManager(
|
||||
namespace='octavia.compute.drivers',
|
||||
name=CONF.controller_worker.compute_driver,
|
||||
@ -163,7 +163,7 @@ class CertComputeCreate(ComputeCreate):
|
||||
config_drive_files = {
|
||||
'/etc/octavia/certs/server.pem': fer.decrypt(server_pem),
|
||||
'/etc/octavia/certs/client_ca.pem': ca}
|
||||
return super(CertComputeCreate, self).execute(
|
||||
return super().execute(
|
||||
amphora_id, config_drive_files=config_drive_files,
|
||||
build_type_priority=build_type_priority,
|
||||
server_group_id=server_group_id, ports=ports, flavor=flavor,
|
||||
|
@ -53,7 +53,7 @@ class BaseDatabaseTask(task.Task):
|
||||
self.l7policy_repo = repo.L7PolicyRepository()
|
||||
self.l7rule_repo = repo.L7RuleRepository()
|
||||
self.task_utils = task_utilities.TaskUtils()
|
||||
super(BaseDatabaseTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def _delete_from_amp_health(self, amphora_id):
|
||||
"""Delete the amphora_health record for an amphora.
|
||||
@ -195,7 +195,7 @@ class DeleteHealthMonitorInDBByPool(DeleteHealthMonitorInDB):
|
||||
:param pool: A pool which health monitor should be deleted.
|
||||
:returns: None
|
||||
"""
|
||||
super(DeleteHealthMonitorInDBByPool, self).execute(
|
||||
super().execute(
|
||||
pool.health_monitor)
|
||||
|
||||
def revert(self, pool, *args, **kwargs):
|
||||
@ -204,7 +204,7 @@ class DeleteHealthMonitorInDBByPool(DeleteHealthMonitorInDB):
|
||||
:param pool: A pool which health monitor couldn't be deleted
|
||||
:returns: None
|
||||
"""
|
||||
super(DeleteHealthMonitorInDBByPool, self).revert(
|
||||
super().revert(
|
||||
pool.health_monitor, *args, **kwargs)
|
||||
|
||||
|
||||
@ -968,7 +968,7 @@ class MarkLBActiveInDB(BaseDatabaseTask):
|
||||
"""
|
||||
|
||||
def __init__(self, mark_subobjects=False, **kwargs):
|
||||
super(MarkLBActiveInDB, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.mark_subobjects = mark_subobjects
|
||||
|
||||
def execute(self, loadbalancer):
|
||||
|
@ -22,7 +22,7 @@ class BaseLifecycleTask(task.Task):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.task_utils = task_utilities.TaskUtils()
|
||||
super(BaseLifecycleTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class AmphoraIDToErrorOnRevertTask(BaseLifecycleTask):
|
||||
@ -42,7 +42,7 @@ class AmphoraToErrorOnRevertTask(AmphoraIDToErrorOnRevertTask):
|
||||
pass
|
||||
|
||||
def revert(self, amphora, *args, **kwargs):
|
||||
super(AmphoraToErrorOnRevertTask, self).revert(amphora.id)
|
||||
super().revert(amphora.id)
|
||||
|
||||
|
||||
class HealthMonitorToErrorOnRevertTask(BaseLifecycleTask):
|
||||
@ -128,7 +128,7 @@ class LoadBalancerToErrorOnRevertTask(LoadBalancerIDToErrorOnRevertTask):
|
||||
pass
|
||||
|
||||
def revert(self, loadbalancer, *args, **kwargs):
|
||||
super(LoadBalancerToErrorOnRevertTask, self).revert(loadbalancer.id)
|
||||
super().revert(loadbalancer.id)
|
||||
|
||||
|
||||
class MemberToErrorOnRevertTask(BaseLifecycleTask):
|
||||
|
@ -37,7 +37,7 @@ class BaseNetworkTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseNetworkTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self._network_driver = None
|
||||
self.task_utils = task_utils.TaskUtils()
|
||||
self.lb_repo = repositories.LoadBalancerRepository()
|
||||
|
@ -53,7 +53,7 @@ class SleepingRetryTimesController(retry.Times):
|
||||
|
||||
def __init__(self, attempts=1, name=None, provides=None, requires=None,
|
||||
auto_extract=True, rebind=None, revert_all=False, interval=1):
|
||||
super(SleepingRetryTimesController, self).__init__(
|
||||
super().__init__(
|
||||
attempts, name, provides, requires, auto_extract, rebind,
|
||||
revert_all)
|
||||
self._interval = interval
|
||||
|
@ -39,7 +39,7 @@ class BaseAmphoraTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseAmphoraTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.amphora_driver = stevedore_driver.DriverManager(
|
||||
namespace='octavia.amphora.drivers',
|
||||
name=CONF.controller_worker.amphora_driver,
|
||||
|
@ -27,7 +27,7 @@ class BaseCertTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseCertTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.cert_generator = stevedore_driver.DriverManager(
|
||||
namespace='octavia.cert_generator',
|
||||
name=CONF.certificates.cert_generator,
|
||||
|
@ -40,7 +40,7 @@ class BaseComputeTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseComputeTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.compute = stevedore_driver.DriverManager(
|
||||
namespace='octavia.compute.drivers',
|
||||
name=CONF.controller_worker.compute_driver,
|
||||
@ -172,7 +172,7 @@ class CertComputeCreate(ComputeCreate):
|
||||
'/etc/octavia/certs/server.pem': fer.decrypt(
|
||||
server_pem.encode("utf-8")),
|
||||
'/etc/octavia/certs/client_ca.pem': ca}
|
||||
return super(CertComputeCreate, self).execute(
|
||||
return super().execute(
|
||||
amphora_id, config_drive_files=config_drive_files,
|
||||
build_type_priority=build_type_priority,
|
||||
server_group_id=server_group_id, ports=ports, flavor=flavor,
|
||||
|
@ -54,7 +54,7 @@ class BaseDatabaseTask(task.Task):
|
||||
self.l7policy_repo = repo.L7PolicyRepository()
|
||||
self.l7rule_repo = repo.L7RuleRepository()
|
||||
self.task_utils = task_utilities.TaskUtils()
|
||||
super(BaseDatabaseTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def _delete_from_amp_health(self, amphora_id):
|
||||
"""Delete the amphora_health record for an amphora.
|
||||
@ -206,7 +206,7 @@ class DeleteHealthMonitorInDBByPool(DeleteHealthMonitorInDB):
|
||||
id=pool_id)
|
||||
provider_hm = provider_utils.db_HM_to_provider_HM(
|
||||
db_pool.health_monitor).to_dict()
|
||||
super(DeleteHealthMonitorInDBByPool, self).execute(
|
||||
super().execute(
|
||||
provider_hm)
|
||||
|
||||
def revert(self, pool_id, *args, **kwargs):
|
||||
@ -219,7 +219,7 @@ class DeleteHealthMonitorInDBByPool(DeleteHealthMonitorInDB):
|
||||
id=pool_id)
|
||||
provider_hm = provider_utils.db_HM_to_provider_HM(
|
||||
db_pool.health_monitor).to_dict()
|
||||
super(DeleteHealthMonitorInDBByPool, self).revert(
|
||||
super().revert(
|
||||
provider_hm, *args, **kwargs)
|
||||
|
||||
|
||||
@ -1030,7 +1030,7 @@ class MarkLBActiveInDB(BaseDatabaseTask):
|
||||
"""
|
||||
|
||||
def __init__(self, mark_subobjects=False, **kwargs):
|
||||
super(MarkLBActiveInDB, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.mark_subobjects = mark_subobjects
|
||||
|
||||
def execute(self, loadbalancer):
|
||||
|
@ -23,7 +23,7 @@ class BaseLifecycleTask(task.Task):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.task_utils = task_utilities.TaskUtils()
|
||||
super(BaseLifecycleTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class AmphoraIDToErrorOnRevertTask(BaseLifecycleTask):
|
||||
@ -43,7 +43,7 @@ class AmphoraToErrorOnRevertTask(AmphoraIDToErrorOnRevertTask):
|
||||
pass
|
||||
|
||||
def revert(self, amphora, *args, **kwargs):
|
||||
super(AmphoraToErrorOnRevertTask, self).revert(
|
||||
super().revert(
|
||||
amphora.get(constants.ID))
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ class LoadBalancerToErrorOnRevertTask(LoadBalancerIDToErrorOnRevertTask):
|
||||
pass
|
||||
|
||||
def revert(self, loadbalancer, *args, **kwargs):
|
||||
super(LoadBalancerToErrorOnRevertTask, self).revert(
|
||||
super().revert(
|
||||
loadbalancer[constants.LOADBALANCER_ID])
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ class BaseNetworkTask(task.Task):
|
||||
"""Base task to load drivers common to the tasks."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(BaseNetworkTask, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self._network_driver = None
|
||||
self.task_utils = task_utils.TaskUtils()
|
||||
self.loadbalancer_repo = repo.LoadBalancerRepository()
|
||||
|
@ -541,10 +541,10 @@ class Repositories(object):
|
||||
quotas.in_use_l7rule = l7rule_count
|
||||
return False
|
||||
return True
|
||||
except db_exception.DBDeadlock:
|
||||
except db_exception.DBDeadlock as e:
|
||||
LOG.warning('Quota project lock timed out for project: %(proj)s',
|
||||
{'proj': project_id})
|
||||
raise exceptions.ProjectBusyException()
|
||||
raise exceptions.ProjectBusyException() from e
|
||||
return False
|
||||
|
||||
def decrement_quota(self, lock_session, _class, project_id, quantity=1):
|
||||
@ -648,10 +648,10 @@ class Repositories(object):
|
||||
'project: %(proj)s that would cause a '
|
||||
'negative quota.',
|
||||
{'clss': type(_class), 'proj': project_id})
|
||||
except db_exception.DBDeadlock:
|
||||
except db_exception.DBDeadlock as e:
|
||||
LOG.warning('Quota project lock timed out for project: %(proj)s',
|
||||
{'proj': project_id})
|
||||
raise exceptions.ProjectBusyException()
|
||||
raise exceptions.ProjectBusyException() from e
|
||||
|
||||
def create_load_balancer_tree(self, session, lock_session, lb_dict):
|
||||
listener_dicts = lb_dict.pop('listeners', [])
|
||||
@ -855,7 +855,7 @@ class LoadBalancerRepository(BaseRepository):
|
||||
subqueryload(models.LoadBalancer._tags),
|
||||
noload('*'))
|
||||
|
||||
return super(LoadBalancerRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -952,7 +952,7 @@ class HealthMonitorRepository(BaseRepository):
|
||||
subqueryload(models.HealthMonitor._tags),
|
||||
noload('*'))
|
||||
|
||||
return super(HealthMonitorRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -1023,7 +1023,7 @@ class PoolRepository(BaseRepository):
|
||||
subqueryload(models.Pool._tags),
|
||||
noload('*'))
|
||||
|
||||
return super(PoolRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -1051,7 +1051,7 @@ class MemberRepository(BaseRepository):
|
||||
subqueryload(models.Member._tags),
|
||||
noload('*'))
|
||||
|
||||
return super(MemberRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -1098,7 +1098,7 @@ class ListenerRepository(BaseRepository):
|
||||
subqueryload(models.Listener.allowed_cidrs),
|
||||
noload('*'))
|
||||
|
||||
return super(ListenerRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -1282,7 +1282,7 @@ class AmphoraRepository(BaseRepository):
|
||||
subqueryload(models.Amphora.load_balancer),
|
||||
noload('*'))
|
||||
|
||||
return super(AmphoraRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
@ -1691,7 +1691,7 @@ class L7RuleRepository(BaseRepository):
|
||||
subqueryload(models.L7Rule._tags),
|
||||
noload('*'))
|
||||
|
||||
return super(L7RuleRepository, self).get_all(
|
||||
return super().get_all(
|
||||
session, pagination_helper=pagination_helper,
|
||||
query_options=query_options, **filters)
|
||||
|
||||
|
@ -28,7 +28,7 @@ class NoopProvidesRequiresTask(task.Task):
|
||||
def __init__(self, name, provides_dicts=None, requires=None):
|
||||
if provides_dicts is None:
|
||||
provides_dicts = {}
|
||||
super(NoopProvidesRequiresTask, self).__init__(
|
||||
super().__init__(
|
||||
name=name,
|
||||
provides=list(provides_dicts),
|
||||
requires=requires)
|
||||
@ -40,7 +40,7 @@ class NoopProvidesRequiresTask(task.Task):
|
||||
|
||||
class NoopManager(object):
|
||||
def __init__(self):
|
||||
super(NoopManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
def get_create_distributor_subflow(self):
|
||||
LOG.debug('Distributor %s create_distributor', self.__class__.__name__)
|
||||
@ -99,7 +99,7 @@ class NoopManager(object):
|
||||
|
||||
class NoopDistributorDriver(driver_base.DistributorDriver):
|
||||
def __init__(self):
|
||||
super(NoopDistributorDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
def get_create_distributor_subflow(self):
|
||||
|
@ -41,7 +41,7 @@ CONF = cfg.CONF
|
||||
class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
|
||||
def __init__(self):
|
||||
super(AllowedAddressPairsDriver, self).__init__()
|
||||
super().__init__()
|
||||
self._check_aap_loaded()
|
||||
self.compute = stevedore_driver.DriverManager(
|
||||
namespace='octavia.compute.drivers',
|
||||
@ -95,15 +95,15 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
LOG.debug('Created vip port: %(port_id)s for amphora: %(amp)s',
|
||||
{'port_id': new_port.id, 'amp': amphora.id})
|
||||
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error creating the base (VRRP) port for the VIP with '
|
||||
'port details: {}').format(port)
|
||||
LOG.exception(message)
|
||||
raise base.PlugVIPException(message)
|
||||
raise base.PlugVIPException(message) from e
|
||||
|
||||
try:
|
||||
interface = self.plug_port(amphora, new_port)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error plugging amphora (compute_id: {compute_id}) '
|
||||
'into vip network {network_id}.').format(
|
||||
compute_id=amphora.compute_id,
|
||||
@ -119,7 +119,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
'plug_port failed. This resource is being '
|
||||
'abandoned and should be manually deleted when '
|
||||
'neutron is functional.', new_port.id)
|
||||
raise base.PlugVIPException(message)
|
||||
raise base.PlugVIPException(message) from e
|
||||
return interface
|
||||
|
||||
def _add_vip_address_pair(self, port_id, vip_address):
|
||||
@ -127,12 +127,12 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
self._add_allowed_address_pair_to_port(port_id, vip_address)
|
||||
except neutron_client_exceptions.PortNotFoundClient as e:
|
||||
raise base.PortNotFound(str(e))
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error adding allowed address pair {ip} '
|
||||
'to port {port_id}.').format(ip=vip_address,
|
||||
port_id=port_id)
|
||||
LOG.exception(message)
|
||||
raise base.PlugVIPException(message)
|
||||
raise base.PlugVIPException(message) from e
|
||||
|
||||
def _get_lb_security_group(self, load_balancer_id):
|
||||
sec_grp_name = common_utils.get_vip_security_group_name(
|
||||
@ -359,11 +359,11 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
neutron_client_exceptions.PortNotFoundClient):
|
||||
LOG.debug('VIP port %s already deleted. Skipping.',
|
||||
vip.port_id)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error deleting VIP port_id {port_id} from '
|
||||
'neutron').format(port_id=vip.port_id)
|
||||
LOG.exception(message)
|
||||
raise base.DeallocateVIPException(message)
|
||||
raise base.DeallocateVIPException(message) from e
|
||||
elif port:
|
||||
LOG.info("Port %s will not be deleted by Octavia as it was "
|
||||
"not created by Octavia.", vip.port_id)
|
||||
@ -543,12 +543,12 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
}}
|
||||
self.neutron_client.update_port(interface.port_id,
|
||||
aap_update)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error unplugging VIP. Could not clear '
|
||||
'allowed address pairs from port '
|
||||
'{port_id}.').format(port_id=vip.port_id)
|
||||
LOG.exception(message)
|
||||
raise base.UnplugVIPException(message)
|
||||
raise base.UnplugVIPException(message) from e
|
||||
|
||||
# Delete the VRRP port if we created it
|
||||
try:
|
||||
@ -566,11 +566,11 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
def unplug_vip(self, load_balancer, vip):
|
||||
try:
|
||||
subnet = self.get_subnet(vip.subnet_id)
|
||||
except base.SubnetNotFound:
|
||||
except base.SubnetNotFound as e:
|
||||
msg = ("Can't unplug vip because vip subnet {0} was not "
|
||||
"found").format(vip.subnet_id)
|
||||
LOG.exception(msg)
|
||||
raise base.PluggedVIPNotFound(msg)
|
||||
raise base.PluggedVIPNotFound(msg) from e
|
||||
for amphora in filter(
|
||||
lambda amp: amp.status == constants.AMPHORA_ALLOCATED,
|
||||
load_balancer.amphorae):
|
||||
@ -587,13 +587,13 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
if 'Network' in str(e):
|
||||
raise base.NetworkNotFound(str(e))
|
||||
raise base.PlugNetworkException(str(e))
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error plugging amphora (compute_id: {compute_id}) '
|
||||
'into network {network_id}.').format(
|
||||
compute_id=compute_id,
|
||||
network_id=network_id)
|
||||
LOG.exception(message)
|
||||
raise base.PlugNetworkException(message)
|
||||
raise base.PlugNetworkException(message) from e
|
||||
|
||||
return self._nova_interface_to_octavia_interface(compute_id, interface)
|
||||
|
||||
@ -647,8 +647,8 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
port.id, {constants.PORT: {'dns_name': ''}})
|
||||
|
||||
except (neutron_client_exceptions.NotFound,
|
||||
neutron_client_exceptions.PortNotFoundClient):
|
||||
raise base.PortNotFound()
|
||||
neutron_client_exceptions.PortNotFoundClient) as e:
|
||||
raise base.PortNotFound() from e
|
||||
|
||||
def plug_port(self, amphora, port):
|
||||
try:
|
||||
@ -671,14 +671,14 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
network_id=port.network_id,
|
||||
port_id=port.id,
|
||||
fixed_ips=port.fixed_ips)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
message = _('Error plugging amphora (compute_id: '
|
||||
'{compute_id}) into port '
|
||||
'{port_id}.').format(
|
||||
compute_id=amphora.compute_id,
|
||||
port_id=port.id)
|
||||
LOG.exception(message)
|
||||
raise base.PlugNetworkException(message)
|
||||
raise base.PlugNetworkException(message) from e
|
||||
|
||||
return plugged_interface
|
||||
|
||||
|
@ -193,18 +193,19 @@ class BaseNeutronDriver(base.AbstractNetworkDriver):
|
||||
resource_type)(resource_id)
|
||||
return getattr(utils, 'convert_%s_dict_to_model' %
|
||||
resource_type)(resource)
|
||||
except neutron_client_exceptions.NotFound:
|
||||
except neutron_client_exceptions.NotFound as e:
|
||||
message = _('{resource_type} not found '
|
||||
'({resource_type} id: {resource_id}).').format(
|
||||
resource_type=resource_type, resource_id=resource_id)
|
||||
raise getattr(base, '%sNotFound' % ''.join(
|
||||
[w.capitalize() for w in resource_type.split('_')]))(message)
|
||||
except Exception:
|
||||
[w.capitalize() for w in resource_type.split('_')]
|
||||
))(message) from e
|
||||
except Exception as e:
|
||||
message = _('Error retrieving {resource_type} '
|
||||
'({resource_type} id: {resource_id}.').format(
|
||||
resource_type=resource_type, resource_id=resource_id)
|
||||
LOG.exception(message)
|
||||
raise base.NetworkException(message)
|
||||
raise base.NetworkException(message) from e
|
||||
|
||||
def _get_resources_by_filters(self, resource_type, unique_item=False,
|
||||
**filters):
|
||||
@ -226,18 +227,19 @@ class BaseNeutronDriver(base.AbstractNetworkDriver):
|
||||
|
||||
return list(map(conversion_function,
|
||||
resource['%ss' % resource_type]))
|
||||
except neutron_client_exceptions.NotFound:
|
||||
except neutron_client_exceptions.NotFound as e:
|
||||
message = _('{resource_type} not found '
|
||||
'({resource_type} Filters: {filters}.').format(
|
||||
resource_type=resource_type, filters=filters)
|
||||
raise getattr(base, '%sNotFound' % ''.join(
|
||||
[w.capitalize() for w in resource_type.split('_')]))(message)
|
||||
except Exception:
|
||||
[w.capitalize() for w in resource_type.split('_')]
|
||||
))(message) from e
|
||||
except Exception as e:
|
||||
message = _('Error retrieving {resource_type} '
|
||||
'({resource_type} Filters: {filters}.').format(
|
||||
resource_type=resource_type, filters=filters)
|
||||
LOG.exception(message)
|
||||
raise base.NetworkException(message)
|
||||
raise base.NetworkException(message) from e
|
||||
|
||||
def get_network(self, network_id, context=None):
|
||||
return self._get_resource('network', network_id, context=context)
|
||||
|
@ -24,7 +24,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class NoopManager(object):
|
||||
def __init__(self):
|
||||
super(NoopManager, self).__init__()
|
||||
super().__init__()
|
||||
self.networkconfigconfig = {}
|
||||
self._qos_extension_enabled = True
|
||||
|
||||
@ -338,7 +338,7 @@ class NoopManager(object):
|
||||
|
||||
class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
||||
def __init__(self):
|
||||
super(NoopNetworkDriver, self).__init__()
|
||||
super().__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
def allocate_vip(self, loadbalancer):
|
||||
|
@ -97,7 +97,7 @@ class KeepalivedLvsTestCase(base.TestCase):
|
||||
TEST_URL = server.PATH_PREFIX + '/listeners/%s/%s/udp_listener'
|
||||
|
||||
def setUp(self):
|
||||
super(KeepalivedLvsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.app = flask.Flask(__name__)
|
||||
self.client = self.app.test_client()
|
||||
self._ctx = self.app.test_request_context()
|
||||
|
@ -46,7 +46,7 @@ class TestServerTestCase(base.TestCase):
|
||||
app = None
|
||||
|
||||
def setUp(self):
|
||||
super(TestServerTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conf = self.useFixture(oslo_fixture.Config(config.cfg.CONF))
|
||||
self.conf.config(group="haproxy_amphora", base_path='/var/lib/octavia')
|
||||
self.conf.config(group="controller_worker",
|
||||
|
@ -55,7 +55,7 @@ class DriverAgentTest(base.OctaviaDBTestBase):
|
||||
# Note that because the driver agent is a multi-process
|
||||
# agent we must use a sqlite file rather than an
|
||||
# in-memory instance.
|
||||
super(DriverAgentTest, self).setUp(
|
||||
super().setUp(
|
||||
connection_string=sqlite_db_connection)
|
||||
|
||||
conf = self.useFixture(oslo_fixture.Config(config.cfg.CONF))
|
||||
|
@ -25,7 +25,7 @@ from octavia.tests.functional.db import base as base_db_test
|
||||
class TestHealthCheck(base_db_test.OctaviaDBTestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestHealthCheck, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
# We need to define these early as they are late loaded in oslo
|
||||
# middleware and our configuration overrides would not apply.
|
||||
|
@ -31,7 +31,7 @@ class TestRootController(base_db_test.OctaviaDBTestBase):
|
||||
return response
|
||||
|
||||
def setUp(self):
|
||||
super(TestRootController, self).setUp()
|
||||
super().setUp()
|
||||
self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
|
||||
self.conf.config(group='api_settings', auth_strategy=constants.NOAUTH)
|
||||
|
||||
|
@ -99,7 +99,7 @@ class BaseAPITest(base_db_test.OctaviaDBTestBase):
|
||||
'faultstring': 'Policy does not allow this request to be performed.'}
|
||||
|
||||
def setUp(self):
|
||||
super(BaseAPITest, self).setUp()
|
||||
super().setUp()
|
||||
self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
|
||||
self.conf.config(group="controller_worker",
|
||||
network_driver='network_noop_driver')
|
||||
|
@ -33,7 +33,7 @@ class TestAmphora(base.BaseAPITest):
|
||||
root_tag_stats = 'amphora_stats'
|
||||
|
||||
def setUp(self):
|
||||
super(TestAmphora, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(
|
||||
uuidutils.generate_uuid()).get('loadbalancer')
|
||||
self.lb_id = self.lb.get('id')
|
||||
|
@ -31,7 +31,7 @@ class TestAvailabilityZones(base.BaseAPITest):
|
||||
root_tag_links = 'availability_zones_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestAvailabilityZones, self).setUp()
|
||||
super().setUp()
|
||||
self.azp = self.create_availability_zone_profile(
|
||||
'test1', 'noop_driver', '{"compute_zone": "my_az_1"}')
|
||||
|
||||
|
@ -31,7 +31,7 @@ class TestFlavors(base.BaseAPITest):
|
||||
root_tag_links = 'flavors_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestFlavors, self).setUp()
|
||||
super().setUp()
|
||||
self.fp = self.create_flavor_profile('test1', 'noop_driver',
|
||||
'{"image": "ubuntu"}')
|
||||
|
||||
|
@ -33,7 +33,7 @@ class TestHealthMonitor(base.BaseAPITest):
|
||||
root_tag_links = 'healthmonitors_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestHealthMonitor, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(
|
||||
uuidutils.generate_uuid()).get('loadbalancer')
|
||||
self.lb_id = self.lb.get('id')
|
||||
|
@ -33,7 +33,7 @@ class TestL7Policy(base.BaseAPITest):
|
||||
root_tag_links = 'l7policies_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestL7Policy, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(uuidutils.generate_uuid())
|
||||
self.lb_id = self.lb.get('loadbalancer').get('id')
|
||||
self.project_id = self.lb.get('loadbalancer').get('project_id')
|
||||
|
@ -32,7 +32,7 @@ class TestL7Rule(base.BaseAPITest):
|
||||
root_tag_links = 'rules_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestL7Rule, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(uuidutils.generate_uuid())
|
||||
self.lb_id = self.lb.get('loadbalancer').get('id')
|
||||
self.project_id = self.lb.get('loadbalancer').get('project_id')
|
||||
|
@ -38,7 +38,7 @@ class TestListener(base.BaseAPITest):
|
||||
root_tag_links = 'listeners_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestListener, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(uuidutils.generate_uuid())
|
||||
self.lb_id = self.lb.get('loadbalancer').get('id')
|
||||
self.project_id = self.lb.get('loadbalancer').get('project_id')
|
||||
|
@ -587,7 +587,7 @@ class TestLoadBalancer(base.BaseAPITest):
|
||||
|
||||
class TestNeutronException(network_base.AllocateVIPException):
|
||||
def __init__(self, message, orig_msg, orig_code):
|
||||
super(TestNeutronException, self).__init__(
|
||||
super().__init__(
|
||||
message, orig_msg=orig_msg, orig_code=orig_code,
|
||||
)
|
||||
|
||||
@ -2472,7 +2472,7 @@ class TestLoadBalancerGraph(base.BaseAPITest):
|
||||
root_tag = 'loadbalancer'
|
||||
|
||||
def setUp(self):
|
||||
super(TestLoadBalancerGraph, self).setUp()
|
||||
super().setUp()
|
||||
self._project_id = uuidutils.generate_uuid()
|
||||
|
||||
def _build_body(self, json):
|
||||
|
@ -36,7 +36,7 @@ class TestMember(base.BaseAPITest):
|
||||
root_tag_links = 'members_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestMember, self).setUp()
|
||||
super().setUp()
|
||||
vip_subnet_id = uuidutils.generate_uuid()
|
||||
self.lb = self.create_load_balancer(vip_subnet_id)
|
||||
self.lb_id = self.lb.get('loadbalancer').get('id')
|
||||
|
@ -35,7 +35,7 @@ class TestPool(base.BaseAPITest):
|
||||
root_tag_links = 'pools_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestPool, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self.lb = self.create_load_balancer(
|
||||
uuidutils.generate_uuid()).get('loadbalancer')
|
||||
|
@ -30,7 +30,7 @@ class TestProvider(base.BaseAPITest):
|
||||
root_tag_list = 'providers'
|
||||
|
||||
def setUp(self):
|
||||
super(TestProvider, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
def test_get_all_providers(self):
|
||||
octavia_dict = {u'description': u'Octavia driver.',
|
||||
@ -60,7 +60,7 @@ class TestFlavorCapabilities(base.BaseAPITest):
|
||||
root_tag = 'flavor_capabilities'
|
||||
|
||||
def setUp(self):
|
||||
super(TestFlavorCapabilities, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
def test_nonexistent_provider(self):
|
||||
self.get(self.FLAVOR_CAPABILITIES_PATH.format(provider='bogus'),
|
||||
@ -178,7 +178,7 @@ class TestAvailabilityZoneCapabilities(base.BaseAPITest):
|
||||
root_tag = 'availability_zone_capabilities'
|
||||
|
||||
def setUp(self):
|
||||
super(TestAvailabilityZoneCapabilities, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
def test_nonexistent_provider(self):
|
||||
self.get(self.AVAILABILITY_ZONE_CAPABILITIES_PATH.format(
|
||||
|
@ -33,7 +33,7 @@ class TestQuotas(base.BaseAPITest):
|
||||
root_tag_links = 'quotas_links'
|
||||
|
||||
def setUp(self):
|
||||
super(TestQuotas, self).setUp()
|
||||
super().setUp()
|
||||
conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
|
||||
conf.config(
|
||||
group="quotas",
|
||||
|
@ -29,7 +29,7 @@ from octavia.db import models
|
||||
class OctaviaDBTestBase(test_base.DbTestCase):
|
||||
|
||||
def setUp(self, connection_string='sqlite://'):
|
||||
super(OctaviaDBTestBase, self).setUp()
|
||||
super().setUp()
|
||||
# NOTE(blogan): doing this for now because using the engine and
|
||||
# session set up in the fixture for test_base.DbTestCase does not work
|
||||
# with the API functional tests. Need to investigate more if this
|
||||
|
@ -271,7 +271,7 @@ class PoolModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class MemberModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(MemberModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.create_pool(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -317,7 +317,7 @@ class MemberModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class SessionPersistenceModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(SessionPersistenceModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.create_pool(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -449,7 +449,7 @@ class ListenerModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class ListenerStatisticsModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(ListenerStatisticsModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.create_listener(self.session)
|
||||
self.amphora = self.create_amphora(self.session)
|
||||
|
||||
@ -486,7 +486,7 @@ class ListenerStatisticsModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class HealthMonitorModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(HealthMonitorModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.create_pool(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -577,7 +577,7 @@ class LoadBalancerModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class VipModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(VipModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.load_balancer = self.create_load_balancer(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -610,7 +610,7 @@ class VipModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class SNIModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(SNIModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.create_listener(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -643,7 +643,7 @@ class SNIModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class AmphoraModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(AmphoraModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.load_balancer = self.create_load_balancer(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -678,7 +678,7 @@ class AmphoraModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
class AmphoraHealthModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
def setUp(self):
|
||||
super(AmphoraHealthModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.amphora = self.create_amphora(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -708,7 +708,7 @@ class AmphoraHealthModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
class L7PolicyModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
def setUp(self):
|
||||
super(L7PolicyModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.create_listener(self.session)
|
||||
|
||||
def test_create(self):
|
||||
@ -826,7 +826,7 @@ class L7PolicyModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class L7RuleModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(L7RuleModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.create_listener(self.session)
|
||||
self.l7policy = self.create_l7policy(self.session, self.listener.id)
|
||||
|
||||
@ -872,7 +872,7 @@ class L7RuleModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class TestDataModelConversionTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDataModelConversionTest, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(self.session)
|
||||
self.amphora = self.create_amphora(self.session)
|
||||
self.associate_amphora(self.lb, self.amphora)
|
||||
@ -1329,7 +1329,7 @@ class TestDataModelConversionTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class TestDataModelManipulations(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDataModelManipulations, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.create_load_balancer(self.session)
|
||||
self.amphora = self.create_amphora(self.session)
|
||||
self.associate_amphora(self.lb, self.amphora)
|
||||
@ -1748,7 +1748,7 @@ class TestDataModelManipulations(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
class FlavorModelTest(base.OctaviaDBTestBase, ModelTestMixin):
|
||||
|
||||
def setUp(self):
|
||||
super(FlavorModelTest, self).setUp()
|
||||
super().setUp()
|
||||
self.profile = self.create_flavor_profile(self.session)
|
||||
|
||||
def test_create(self):
|
||||
|
@ -48,7 +48,7 @@ class BaseRepositoryTest(base.OctaviaDBTestBase):
|
||||
FAKE_EXP_AGE = 10
|
||||
|
||||
def setUp(self):
|
||||
super(BaseRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool_repo = repo.PoolRepository()
|
||||
self.member_repo = repo.MemberRepository()
|
||||
self.lb_repo = repo.LoadBalancerRepository()
|
||||
@ -96,7 +96,7 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
|
||||
FAKE_IP = '192.0.2.44'
|
||||
|
||||
def setUp(self):
|
||||
super(AllRepositoriesTest, self).setUp()
|
||||
super().setUp()
|
||||
self.repos = repo.Repositories()
|
||||
self.load_balancer = self.repos.load_balancer.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
@ -2665,7 +2665,7 @@ class PoolRepositoryTest(BaseRepositoryTest):
|
||||
class MemberRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(MemberRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.pool_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="pool_test", description="pool_description",
|
||||
@ -2753,7 +2753,7 @@ class MemberRepositoryTest(BaseRepositoryTest):
|
||||
class SessionPersistenceRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(SessionPersistenceRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.pool_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="pool_test", description="pool_description",
|
||||
@ -2804,7 +2804,7 @@ class SessionPersistenceRepositoryTest(BaseRepositoryTest):
|
||||
class TestListenerRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestListenerRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.load_balancer = self.lb_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="lb_name", description="lb_description",
|
||||
@ -3096,7 +3096,7 @@ class TestListenerRepositoryTest(BaseRepositoryTest):
|
||||
class ListenerStatisticsRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(ListenerStatisticsRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.listener_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="listener_name", description="listener_description",
|
||||
@ -3273,7 +3273,7 @@ class ListenerStatisticsRepositoryTest(BaseRepositoryTest):
|
||||
class HealthMonitorRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(HealthMonitorRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.pool_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="pool_test", description="pool_description",
|
||||
@ -3637,7 +3637,7 @@ class LoadBalancerRepositoryTest(BaseRepositoryTest):
|
||||
class VipRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(VipRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.lb_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="lb_name", description="lb_description",
|
||||
@ -3701,7 +3701,7 @@ class VipRepositoryTest(BaseRepositoryTest):
|
||||
class SNIRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(SNIRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.listener_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="listener_name", description="listener_description",
|
||||
@ -3751,7 +3751,7 @@ class SNIRepositoryTest(BaseRepositoryTest):
|
||||
class AmphoraRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(AmphoraRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.lb_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="lb_name", description="lb_description",
|
||||
@ -4025,7 +4025,7 @@ class AmphoraRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
class AmphoraHealthRepositoryTest(BaseRepositoryTest):
|
||||
def setUp(self):
|
||||
super(AmphoraHealthRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.amphora = self.amphora_repo.create(self.session,
|
||||
id=self.FAKE_UUID_1,
|
||||
compute_id=self.FAKE_UUID_3,
|
||||
@ -4132,7 +4132,7 @@ class AmphoraHealthRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
class VRRPGroupRepositoryTest(BaseRepositoryTest):
|
||||
def setUp(self):
|
||||
super(VRRPGroupRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.lb = self.lb_repo.create(
|
||||
self.session, id=self.FAKE_UUID_1, project_id=self.FAKE_UUID_2,
|
||||
name="lb_name", description="lb_description",
|
||||
@ -4178,7 +4178,7 @@ class VRRPGroupRepositoryTest(BaseRepositoryTest):
|
||||
class L7PolicyRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(L7PolicyRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.pool = self.create_pool(self.FAKE_UUID_1)
|
||||
self.listener = self.create_listener(self.FAKE_UUID_1, 80)
|
||||
|
||||
@ -4587,7 +4587,7 @@ class L7PolicyRepositoryTest(BaseRepositoryTest):
|
||||
class L7RuleRepositoryTest(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(L7RuleRepositoryTest, self).setUp()
|
||||
super().setUp()
|
||||
self.listener = self.listener_repo.create(
|
||||
self.session, id=uuidutils.generate_uuid(),
|
||||
project_id=self.FAKE_UUID_2,
|
||||
@ -4958,7 +4958,7 @@ class L7RuleRepositoryTest(BaseRepositoryTest):
|
||||
class TestQuotasRepository(BaseRepositoryTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestQuotasRepository, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
def update_quotas(self, project_id, load_balancer=20, listener=20, pool=20,
|
||||
health_monitor=20, member=20, l7policy=20, l7rule=20):
|
||||
|
@ -40,7 +40,7 @@ class TestAmphoraInfo(base.TestCase):
|
||||
LB_ID_1 = uuidutils.generate_uuid()
|
||||
|
||||
def setUp(self):
|
||||
super(TestAmphoraInfo, self).setUp()
|
||||
super().setUp()
|
||||
self.osutils_mock = mock.MagicMock()
|
||||
self.amp_info = amphora_info.AmphoraInfo(self.osutils_mock)
|
||||
self.udp_driver = mock.MagicMock()
|
||||
|
@ -21,7 +21,7 @@ from octavia.tests.unit.common.sample_configs import sample_configs_combined
|
||||
|
||||
class HAProxyCompatTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(HAProxyCompatTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.old_haproxy_global = (
|
||||
"# Configuration for loadbalancer sample_loadbalancer_id_1\n"
|
||||
"global\n"
|
||||
|
@ -22,7 +22,7 @@ import octavia.tests.unit.base as base
|
||||
|
||||
class KeepalivedTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(KeepalivedTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.app = flask.Flask(__name__)
|
||||
self.client = self.app.test_client()
|
||||
self._ctx = self.app.test_request_context()
|
||||
|
@ -24,7 +24,7 @@ class KeepalivedLvsTestCase(base.TestCase):
|
||||
FAKE_ID = uuidutils.generate_uuid()
|
||||
|
||||
def setUp(self):
|
||||
super(KeepalivedLvsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.test_keepalivedlvs = keepalivedlvs.KeepalivedLvs()
|
||||
|
||||
@mock.patch.object(keepalivedlvs, "webob")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user