Fix gate failure
Bumped a bunch of constraints and requirements to fix a gate failure with recent pip update. Fix associated new warnings. Change-Id: Ibc6f6025b89f2ac893471bf58794569804545b9d
This commit is contained in:
parent
e36f3270e6
commit
0968b410ce
@ -1,15 +1,17 @@
|
||||
alabaster==0.7.10
|
||||
appdirs==1.4.3
|
||||
astroid==1.3.8
|
||||
astroid==2.4.0
|
||||
Babel==2.3.4
|
||||
cliff==2.8.0
|
||||
cmd2==0.8.0
|
||||
coverage==4.0
|
||||
docutils==0.11
|
||||
dulwich==0.15.0
|
||||
extras==1.0.0
|
||||
fixtures==3.0.0
|
||||
flake8==2.5.5
|
||||
flake8==3.7.9
|
||||
future==0.16.0
|
||||
hacking==0.12.0
|
||||
hacking==3.0.1
|
||||
imagesize==0.7.1
|
||||
iso8601==0.1.11
|
||||
isort==4.3.21
|
||||
@ -18,7 +20,7 @@ keystoneauth1==3.4.0
|
||||
linecache2==1.0.0
|
||||
logilab-common==1.4.1
|
||||
MarkupSafe==1.0
|
||||
mccabe==0.2.1
|
||||
mccabe==0.6.1
|
||||
mox3==0.20.0
|
||||
netaddr==0.7.18
|
||||
os-client-config==1.28.0
|
||||
@ -27,16 +29,16 @@ oslotest==3.2.0
|
||||
ovs==2.10.0
|
||||
pbr==2.0.0
|
||||
pep8==1.5.7
|
||||
pyflakes==0.8.1
|
||||
pyflakes==2.1.1
|
||||
Pygments==2.2.0
|
||||
pylint==1.9.2
|
||||
pylint==2.6.0
|
||||
python-mimeparse==1.6.0
|
||||
python-subunit==1.0.0
|
||||
pytz==2013.6
|
||||
PyYAML==3.12
|
||||
PyYAML==5.3.1
|
||||
requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
six==1.10.0
|
||||
six==1.12.0
|
||||
snowballstemmer==1.2.1
|
||||
stevedore==1.20.0
|
||||
stestr==2.0.0
|
||||
|
@ -27,7 +27,7 @@ class Backend(object):
|
||||
_ovsdb_connection = None
|
||||
|
||||
def __init__(self, connection, start=True, auto_index=True, **kwargs):
|
||||
super(Backend, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.ovsdb_connection = connection
|
||||
if auto_index:
|
||||
if connection.is_running:
|
||||
@ -111,7 +111,7 @@ class Backend(object):
|
||||
connection_exception = exceptions.OvsdbConnectionUnavailable(
|
||||
db_schema=self.schema, error=e)
|
||||
LOG.exception(connection_exception)
|
||||
raise connection_exception
|
||||
raise connection_exception from e
|
||||
|
||||
def restart_connection(self):
|
||||
self.ovsdb_connection.stop()
|
||||
@ -194,7 +194,7 @@ class Backend(object):
|
||||
return t.rows[record]
|
||||
except KeyError:
|
||||
raise idlutils.RowNotFound(table=table, col='uuid',
|
||||
match=record)
|
||||
match=record) from None
|
||||
try:
|
||||
uuid_ = uuid.UUID(record)
|
||||
return t.rows[uuid_]
|
||||
|
@ -96,7 +96,7 @@ class AddCommand(BaseCommand):
|
||||
|
||||
class DbCreateCommand(BaseCommand):
|
||||
def __init__(self, api, table, _as_row=False, **columns):
|
||||
super(DbCreateCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.columns = columns
|
||||
self.row = _as_row
|
||||
@ -118,7 +118,7 @@ class DbCreateCommand(BaseCommand):
|
||||
|
||||
class DbDestroyCommand(BaseCommand):
|
||||
def __init__(self, api, table, record):
|
||||
super(DbDestroyCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
|
||||
@ -129,7 +129,7 @@ class DbDestroyCommand(BaseCommand):
|
||||
|
||||
class DbSetCommand(BaseCommand):
|
||||
def __init__(self, api, table, record, *col_values):
|
||||
super(DbSetCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
self.col_values = col_values
|
||||
@ -161,7 +161,7 @@ class DbSetCommand(BaseCommand):
|
||||
|
||||
class DbAddCommand(BaseCommand):
|
||||
def __init__(self, api, table, record, column, *values):
|
||||
super(DbAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
self.column = column
|
||||
@ -195,7 +195,7 @@ class DbAddCommand(BaseCommand):
|
||||
|
||||
class DbClearCommand(BaseCommand):
|
||||
def __init__(self, api, table, record, column):
|
||||
super(DbClearCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
self.column = column
|
||||
@ -209,7 +209,7 @@ class DbClearCommand(BaseCommand):
|
||||
|
||||
class DbGetCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, record, column):
|
||||
super(DbGetCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
self.column = column
|
||||
@ -229,7 +229,7 @@ class DbGetCommand(ReadOnlyCommand):
|
||||
|
||||
class DbListCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, records, columns, if_exists, row=False):
|
||||
super(DbListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.columns = columns
|
||||
self.if_exists = if_exists
|
||||
@ -299,7 +299,7 @@ class DbListCommand(ReadOnlyCommand):
|
||||
|
||||
class DbFindCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, table, *conditions, **kwargs):
|
||||
super(DbFindCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = self.api._tables[table]
|
||||
self.conditions = conditions
|
||||
self.row = kwargs.get('row', False)
|
||||
@ -321,7 +321,7 @@ class DbFindCommand(ReadOnlyCommand):
|
||||
|
||||
class BaseGetRowCommand(ReadOnlyCommand):
|
||||
def __init__(self, api, record):
|
||||
super(BaseGetRowCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.record = record
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -330,7 +330,7 @@ class BaseGetRowCommand(ReadOnlyCommand):
|
||||
|
||||
class DbRemoveCommand(BaseCommand):
|
||||
def __init__(self, api, table, record, column, *values, **keyvalues):
|
||||
super(DbRemoveCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.record = record
|
||||
self.column = column
|
||||
|
@ -36,20 +36,20 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class TransactionQueue(queue.Queue, object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TransactionQueue, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self._wait_queue = connection_utils.WaitQueue(
|
||||
max_queue_size=self.maxsize)
|
||||
|
||||
def get_nowait(self, *args, **kwargs):
|
||||
try:
|
||||
result = super(TransactionQueue, self).get_nowait(*args, **kwargs)
|
||||
result = super().get_nowait(*args, **kwargs)
|
||||
except queue.Empty:
|
||||
return None
|
||||
self._wait_queue.alert_notification_consume()
|
||||
return result
|
||||
|
||||
def put(self, *args, **kwargs):
|
||||
super(TransactionQueue, self).put(*args, **kwargs)
|
||||
super().put(*args, **kwargs)
|
||||
self._wait_queue.alert_notify()
|
||||
|
||||
@property
|
||||
@ -149,10 +149,10 @@ class Connection(object):
|
||||
# run when we are started
|
||||
try:
|
||||
self.txns.put(txn, timeout=self.timeout)
|
||||
except queue.Full:
|
||||
except queue.Full as e:
|
||||
raise exceptions.TimeoutException(commands=txn.commands,
|
||||
timeout=self.timeout,
|
||||
cause='TXN queue is full')
|
||||
cause='TXN queue is full') from e
|
||||
|
||||
|
||||
class OvsdbIdl(idl.Idl):
|
||||
|
@ -52,4 +52,4 @@ class WaitEvent(RowEvent, ovsdb_event.WaitEvent):
|
||||
class RowEventHandler(ovsdb_event.RowEventHandler):
|
||||
def notify(self, event, row, updates=None):
|
||||
row = idlutils.frozen_row(row)
|
||||
super(RowEventHandler, self).notify(event, row, updates)
|
||||
super().notify(event, row, updates)
|
||||
|
@ -124,7 +124,7 @@ def row_by_record(idl_, table, record):
|
||||
except ValueError:
|
||||
# Not a UUID string, continue lookup by other means
|
||||
pass
|
||||
except KeyError:
|
||||
except KeyError as e:
|
||||
if sys.platform != 'win32':
|
||||
# On Windows the name of the ports is described by the OVS schema:
|
||||
# https://tinyurl.com/zk8skhx
|
||||
@ -134,7 +134,7 @@ def row_by_record(idl_, table, record):
|
||||
# as it happens on Linux and will try to fetch the directly
|
||||
# the column instead of using the lookup table. This will raise
|
||||
# a KeyError exception on Windows.
|
||||
raise RowNotFound(table=table, col='uuid', match=record)
|
||||
raise RowNotFound(table=table, col='uuid', match=record) from e
|
||||
|
||||
rl = _LOOKUP_TABLE.get(table, RowLookup(table, get_index_column(t), None))
|
||||
# no table means uuid only, no column means lookup table only has one row
|
||||
@ -195,7 +195,7 @@ def get_schema_helper(connection, schema_name):
|
||||
"%(err)s", {'conn': c,
|
||||
'err': os.strerror(err)})
|
||||
continue
|
||||
elif resp.error:
|
||||
if resp.error:
|
||||
LOG.error("TRXN error, failed to retrieve schema from %(conn)s: "
|
||||
"%(err)s", {'conn': c,
|
||||
'err': resp.error})
|
||||
|
@ -52,10 +52,11 @@ class Transaction(api.Transaction):
|
||||
self.ovsdb_connection.queue_txn(self)
|
||||
try:
|
||||
result = self.results.get(timeout=self.timeout)
|
||||
except queue.Empty:
|
||||
raise exceptions.TimeoutException(commands=self.commands,
|
||||
timeout=self.timeout,
|
||||
cause='Result queue is empty')
|
||||
except queue.Empty as e:
|
||||
raise exceptions.TimeoutException(
|
||||
commands=self.commands,
|
||||
timeout=self.timeout,
|
||||
cause='Result queue is empty') from e
|
||||
if isinstance(result, idlutils.ExceptionResult):
|
||||
if self.log_errors:
|
||||
LOG.error(result.tb)
|
||||
@ -103,7 +104,7 @@ class Transaction(api.Transaction):
|
||||
# idl.run() again. So, call idl.run() here just in case.
|
||||
self.api.idl.run()
|
||||
continue
|
||||
elif status in (txn.ERROR, txn.NOT_LOCKED):
|
||||
if status in (txn.ERROR, txn.NOT_LOCKED):
|
||||
msg = 'OVSDB Error: '
|
||||
if status == txn.NOT_LOCKED:
|
||||
msg += ("The transaction failed because the IDL has "
|
||||
@ -118,10 +119,10 @@ class Transaction(api.Transaction):
|
||||
# For now, raise similar error to vsctl/utils.execute()
|
||||
raise RuntimeError(msg)
|
||||
return
|
||||
elif status == txn.ABORTED:
|
||||
if status == txn.ABORTED:
|
||||
LOG.debug("Transaction aborted")
|
||||
return
|
||||
elif status == txn.UNCHANGED:
|
||||
if status == txn.UNCHANGED:
|
||||
LOG.debug("Transaction caused no change")
|
||||
elif status == txn.SUCCESS:
|
||||
self.post_commit(txn)
|
||||
|
@ -80,7 +80,7 @@ class WaitEvent(RowEvent):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.event = threading.Event()
|
||||
self.timeout = kwargs.pop('timeout', None)
|
||||
super(WaitEvent, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@abc.abstractmethod
|
||||
def matches(self, event, row, old=None):
|
||||
|
@ -24,13 +24,13 @@ class OvsdbAppException(RuntimeError):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
try:
|
||||
super(OvsdbAppException, self).__init__(self.message % kwargs)
|
||||
super().__init__(self.message % kwargs)
|
||||
self.msg = self.message % kwargs
|
||||
except Exception:
|
||||
if self.use_fatal_exceptions():
|
||||
raise
|
||||
# at least get the core message out if something happened
|
||||
super(OvsdbAppException, self).__init__(self.message)
|
||||
super().__init__(self.message)
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
@ -26,7 +26,7 @@ class AddManagerCommand(command.AddCommand):
|
||||
table_name = 'Manager'
|
||||
|
||||
def __init__(self, api, target):
|
||||
super(AddManagerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.target = target
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -43,7 +43,7 @@ class AddManagerCommand(command.AddCommand):
|
||||
|
||||
class GetManagerCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api):
|
||||
super(GetManagerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
|
||||
def run_idl(self, txn):
|
||||
self.result = [m.target for m in
|
||||
@ -52,17 +52,17 @@ class GetManagerCommand(command.ReadOnlyCommand):
|
||||
|
||||
class RemoveManagerCommand(BaseCommand):
|
||||
def __init__(self, api, target):
|
||||
super(RemoveManagerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.target = target
|
||||
|
||||
def run_idl(self, txn):
|
||||
try:
|
||||
manager = idlutils.row_by_value(self.api.idl, 'Manager', 'target',
|
||||
self.target)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
msg = "Manager with target %s does not exist" % self.target
|
||||
LOG.error(msg)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
try:
|
||||
self.api._ovs.delvalue('manager_options', manager)
|
||||
except AttributeError: # OVS < 2.6
|
||||
@ -77,7 +77,7 @@ class AddBridgeCommand(command.AddCommand):
|
||||
table_name = 'Bridge'
|
||||
|
||||
def __init__(self, api, name, may_exist, datapath_type):
|
||||
super(AddBridgeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.may_exist = may_exist
|
||||
self.datapath_type = datapath_type
|
||||
@ -113,7 +113,7 @@ class AddBridgeCommand(command.AddCommand):
|
||||
|
||||
class DelBridgeCommand(BaseCommand):
|
||||
def __init__(self, api, name, if_exists):
|
||||
super(DelBridgeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -121,13 +121,13 @@ class DelBridgeCommand(BaseCommand):
|
||||
try:
|
||||
br = idlutils.row_by_value(self.api.idl, 'Bridge', 'name',
|
||||
self.name)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
else:
|
||||
msg = "Bridge %s does not exist" % self.name
|
||||
LOG.error(msg)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
# Clean up cached ports/interfaces
|
||||
for port in br.ports:
|
||||
for interface in port.interfaces:
|
||||
@ -145,7 +145,7 @@ class DelBridgeCommand(BaseCommand):
|
||||
|
||||
class BridgeExistsCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, name):
|
||||
super(BridgeExistsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -155,7 +155,7 @@ class BridgeExistsCommand(command.ReadOnlyCommand):
|
||||
|
||||
class ListBridgesCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api):
|
||||
super(ListBridgesCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
|
||||
def run_idl(self, txn):
|
||||
# NOTE (twilson) [x.name for x in rows.values()] if no index
|
||||
@ -165,7 +165,7 @@ class ListBridgesCommand(command.ReadOnlyCommand):
|
||||
|
||||
class SetControllerCommand(BaseCommand):
|
||||
def __init__(self, api, bridge, targets):
|
||||
super(SetControllerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
self.targets = targets
|
||||
|
||||
@ -182,7 +182,7 @@ class SetControllerCommand(BaseCommand):
|
||||
|
||||
class DelControllerCommand(BaseCommand):
|
||||
def __init__(self, api, bridge):
|
||||
super(DelControllerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -192,7 +192,7 @@ class DelControllerCommand(BaseCommand):
|
||||
|
||||
class GetControllerCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, bridge):
|
||||
super(GetControllerCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -202,7 +202,7 @@ class GetControllerCommand(command.ReadOnlyCommand):
|
||||
|
||||
class SetFailModeCommand(BaseCommand):
|
||||
def __init__(self, api, bridge, mode):
|
||||
super(SetFailModeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
self.mode = mode
|
||||
|
||||
@ -215,7 +215,7 @@ class AddPortCommand(command.AddCommand):
|
||||
table_name = 'Port'
|
||||
|
||||
def __init__(self, api, bridge, port, may_exist):
|
||||
super(AddPortCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
self.port = port
|
||||
self.may_exist = may_exist
|
||||
@ -248,7 +248,7 @@ class AddPortCommand(command.AddCommand):
|
||||
|
||||
class DelPortCommand(BaseCommand):
|
||||
def __init__(self, api, port, bridge, if_exists):
|
||||
super(DelPortCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.bridge = bridge
|
||||
self.if_exists = if_exists
|
||||
@ -257,11 +257,11 @@ class DelPortCommand(BaseCommand):
|
||||
try:
|
||||
port = idlutils.row_by_value(self.api.idl, 'Port', 'name',
|
||||
self.port)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = "Port %s does not exist" % self.port
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
if self.bridge:
|
||||
br = idlutils.row_by_value(self.api.idl, 'Bridge', 'name',
|
||||
self.bridge)
|
||||
@ -293,7 +293,7 @@ class DelPortCommand(BaseCommand):
|
||||
|
||||
class ListPortsCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, bridge):
|
||||
super(ListPortsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -303,7 +303,7 @@ class ListPortsCommand(command.ReadOnlyCommand):
|
||||
|
||||
class ListIfacesCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, bridge):
|
||||
super(ListIfacesCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.bridge = bridge
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -314,7 +314,7 @@ class ListIfacesCommand(command.ReadOnlyCommand):
|
||||
|
||||
class PortToBridgeCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, name):
|
||||
super(PortToBridgeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -330,7 +330,7 @@ class PortToBridgeCommand(command.ReadOnlyCommand):
|
||||
|
||||
class InterfaceToBridgeCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, name):
|
||||
super(InterfaceToBridgeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -346,7 +346,7 @@ class InterfaceToBridgeCommand(command.ReadOnlyCommand):
|
||||
|
||||
class GetExternalIdCommand(command.ReadOnlyCommand):
|
||||
def __init__(self, api, table, name, field):
|
||||
super(GetExternalIdCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.name = name
|
||||
self.field = field
|
||||
@ -359,7 +359,7 @@ class GetExternalIdCommand(command.ReadOnlyCommand):
|
||||
|
||||
class SetExternalIdCommand(BaseCommand):
|
||||
def __init__(self, api, table, name, field, value):
|
||||
super(SetExternalIdCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.name = name
|
||||
self.field = field
|
||||
@ -375,23 +375,23 @@ class SetExternalIdCommand(BaseCommand):
|
||||
|
||||
class BrGetExternalIdCommand(GetExternalIdCommand):
|
||||
def __init__(self, api, name, field):
|
||||
super(BrGetExternalIdCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Bridge', name, field)
|
||||
|
||||
|
||||
class BrSetExternalIdCommand(SetExternalIdCommand):
|
||||
def __init__(self, api, name, field, value):
|
||||
super(BrSetExternalIdCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Bridge', name, field, value)
|
||||
|
||||
|
||||
class IfaceGetExternalIdCommand(GetExternalIdCommand):
|
||||
def __init__(self, api, name, field):
|
||||
super(IfaceGetExternalIdCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Interface', name, field)
|
||||
|
||||
|
||||
class IfaceSetExternalIdCommand(SetExternalIdCommand):
|
||||
def __init__(self, api, name, field, value):
|
||||
super(IfaceSetExternalIdCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Interface', name, field, value)
|
||||
|
@ -34,7 +34,7 @@ class OvsVsctlTransaction(transaction.Transaction):
|
||||
txn.expected_ifaces = set()
|
||||
|
||||
def post_commit(self, txn):
|
||||
super(OvsVsctlTransaction, self).post_commit(txn)
|
||||
super().post_commit(txn)
|
||||
# ovs-vsctl only logs these failures and does not return nonzero
|
||||
try:
|
||||
self.do_post_commit(txn)
|
||||
|
@ -24,7 +24,7 @@ class LsAddCommand(cmd.AddCommand):
|
||||
table_name = 'Logical_Switch'
|
||||
|
||||
def __init__(self, api, switch=None, may_exist=False, **columns):
|
||||
super(LsAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.columns = columns
|
||||
self.may_exist = may_exist
|
||||
@ -55,7 +55,7 @@ class LsAddCommand(cmd.AddCommand):
|
||||
|
||||
class LsDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, switch, if_exists=False):
|
||||
super(LsDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -63,11 +63,11 @@ class LsDelCommand(cmd.BaseCommand):
|
||||
try:
|
||||
lswitch = self.api.lookup('Logical_Switch', self.switch)
|
||||
lswitch.delete()
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = "Logical Switch %s does not exist" % self.switch
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
|
||||
class LsListCommand(cmd.ReadOnlyCommand):
|
||||
@ -93,7 +93,7 @@ class _AclAddHelper(cmd.AddCommand):
|
||||
const.ACL_PRIORITY_MAX))
|
||||
if action not in ('allow', 'allow-related', 'drop', 'reject'):
|
||||
raise TypeError("action must be allow/allow-related/drop/reject")
|
||||
super(_AclAddHelper, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.entity = entity
|
||||
self.direction = direction
|
||||
self.priority = priority
|
||||
@ -141,9 +141,9 @@ class AclAddCommand(_AclAddHelper):
|
||||
**external_ids):
|
||||
# NOTE: we're overriding the constructor here to not break any
|
||||
# existing callers before we introduced Port Groups.
|
||||
super(AclAddCommand, self).__init__(api, switch, direction, priority,
|
||||
match, action, log, may_exist,
|
||||
severity, name, **external_ids)
|
||||
super().__init__(api, switch, direction, priority,
|
||||
match, action, log, may_exist,
|
||||
severity, name, **external_ids)
|
||||
|
||||
|
||||
class PgAclAddCommand(_AclAddHelper):
|
||||
@ -157,7 +157,7 @@ class _AclDelHelper(cmd.BaseCommand):
|
||||
raise TypeError("Must specify priority and match together")
|
||||
if priority is not None and not direction:
|
||||
raise TypeError("Cannot specify priority/match without direction")
|
||||
super(_AclDelHelper, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.entity = entity
|
||||
self.conditions = []
|
||||
if direction:
|
||||
@ -182,8 +182,7 @@ class AclDelCommand(_AclDelHelper):
|
||||
priority=None, match=None):
|
||||
# NOTE: we're overriding the constructor here to not break any
|
||||
# existing callers before we introduced Port Groups.
|
||||
super(AclDelCommand, self).__init__(api, switch, direction, priority,
|
||||
match)
|
||||
super().__init__(api, switch, direction, priority, match)
|
||||
|
||||
|
||||
class PgAclDelCommand(_AclDelHelper):
|
||||
@ -192,7 +191,7 @@ class PgAclDelCommand(_AclDelHelper):
|
||||
|
||||
class _AclListHelper(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, entity):
|
||||
super(_AclListHelper, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.entity = entity
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -229,7 +228,7 @@ class QoSAddCommand(cmd.AddCommand):
|
||||
dscp, const.QOS_DSCP_MAX)
|
||||
if rate is None and dscp is None:
|
||||
raise ValueError("One of the rate or dscp must be configured")
|
||||
super(QoSAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.direction = direction
|
||||
self.priority = priority
|
||||
@ -275,7 +274,7 @@ class QoSDelCommand(cmd.BaseCommand):
|
||||
raise TypeError("Must specify priority and match together")
|
||||
if priority is not None and not direction:
|
||||
raise TypeError("Cannot specify priority/match without direction")
|
||||
super(QoSDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.conditions = []
|
||||
self.if_exists = if_exists
|
||||
@ -289,11 +288,11 @@ class QoSDelCommand(cmd.BaseCommand):
|
||||
def run_idl(self, txn):
|
||||
try:
|
||||
ls = self.api.lookup('Logical_Switch', self.switch)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = 'Logical Switch %s does not exist' % self.switch
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
for row in ls.qos_rules:
|
||||
if idlutils.row_match(row, self.conditions):
|
||||
@ -303,7 +302,7 @@ class QoSDelCommand(cmd.BaseCommand):
|
||||
|
||||
class QoSListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, switch):
|
||||
super(QoSListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -315,7 +314,7 @@ class QoSDelExtIdCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, lswitch, external_ids, if_exists=False):
|
||||
if not external_ids:
|
||||
raise TypeError('external_ids dictionary cannot be empty')
|
||||
super(QoSDelExtIdCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.lswitch = lswitch
|
||||
self.external_ids = external_ids
|
||||
self.if_exists = if_exists
|
||||
@ -324,11 +323,11 @@ class QoSDelExtIdCommand(cmd.BaseCommand):
|
||||
try:
|
||||
lswitch = idlutils.row_by_value(self.api.idl, 'Logical_Switch',
|
||||
'name', self.lswitch)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = 'Logical Switch %s does not exist' % self.lswitch
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
for qos in lswitch.qos_rules:
|
||||
if self.external_ids.items() <= qos.external_ids.items():
|
||||
@ -345,7 +344,7 @@ class LspAddCommand(cmd.AddCommand):
|
||||
raise TypeError("tag must be 0 to 4095, inclusive")
|
||||
if (parent_name is None) != (tag is None):
|
||||
raise TypeError("parent_name and tag must be passed together")
|
||||
super(LspAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.port = port
|
||||
self.parent = parent_name
|
||||
@ -394,7 +393,7 @@ class LspAddCommand(cmd.AddCommand):
|
||||
class PortDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, table, port, parent_table, parent=None,
|
||||
if_exists=False):
|
||||
super(PortDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.table = table
|
||||
self.port = port
|
||||
self.parent_table = parent_table
|
||||
@ -404,10 +403,10 @@ class PortDelCommand(cmd.BaseCommand):
|
||||
def run_idl(self, txn):
|
||||
try:
|
||||
row = self.api.lookup(self.table, self.port)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
raise RuntimeError("%s does not exist" % self.port)
|
||||
raise RuntimeError("%s does not exist" % self.port) from e
|
||||
|
||||
# We need to delete the port from its parent
|
||||
if self.parent:
|
||||
@ -425,14 +424,14 @@ class PortDelCommand(cmd.BaseCommand):
|
||||
|
||||
class LspDelCommand(PortDelCommand):
|
||||
def __init__(self, api, port, switch=None, if_exists=False):
|
||||
super(LspDelCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Logical_Switch_Port', port, 'Logical_Switch', switch,
|
||||
if_exists)
|
||||
|
||||
|
||||
class LspListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, switch=None):
|
||||
super(LspListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -449,7 +448,7 @@ class LspGetCommand(cmd.BaseGetRowCommand):
|
||||
|
||||
class LspGetParentCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetParentCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -459,7 +458,7 @@ class LspGetParentCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspGetTagCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetTagCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -477,7 +476,7 @@ class LspSetAddressesCommand(cmd.BaseCommand):
|
||||
raise TypeError(
|
||||
"address (%s) must be router/unknown/dynamic/"
|
||||
"ethaddr[ ipaddr...]" % (addr,))
|
||||
super(LspSetAddressesCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.addresses = addresses
|
||||
|
||||
@ -488,7 +487,7 @@ class LspSetAddressesCommand(cmd.BaseCommand):
|
||||
|
||||
class LspGetAddressesCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetAddressesCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -500,7 +499,7 @@ class LspSetPortSecurityCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, addresses):
|
||||
# NOTE(twilson) ovn-nbctl.c does not do any checking of addresses
|
||||
# so neither do we
|
||||
super(LspSetPortSecurityCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.addresses = addresses
|
||||
|
||||
@ -511,7 +510,7 @@ class LspSetPortSecurityCommand(cmd.BaseCommand):
|
||||
|
||||
class LspGetPortSecurityCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetPortSecurityCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -521,7 +520,7 @@ class LspGetPortSecurityCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspGetUpCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetUpCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -532,7 +531,7 @@ class LspGetUpCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspSetEnabledCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, is_enabled):
|
||||
super(LspSetEnabledCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.is_enabled = is_enabled
|
||||
|
||||
@ -543,7 +542,7 @@ class LspSetEnabledCommand(cmd.BaseCommand):
|
||||
|
||||
class LspGetEnabledCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetEnabledCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -554,7 +553,7 @@ class LspGetEnabledCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspSetTypeCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, port_type):
|
||||
super(LspSetTypeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.port_type = port_type
|
||||
|
||||
@ -565,7 +564,7 @@ class LspSetTypeCommand(cmd.BaseCommand):
|
||||
|
||||
class LspGetTypeCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetTypeCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -577,7 +576,7 @@ class LspSetOptionsCommand(cmd.BaseCommand):
|
||||
table = 'Logical_Switch_Port'
|
||||
|
||||
def __init__(self, api, port, **options):
|
||||
super(LspSetOptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.options = options
|
||||
|
||||
@ -590,7 +589,7 @@ class LspGetOptionsCommand(cmd.ReadOnlyCommand):
|
||||
table = 'Logical_Switch_Port'
|
||||
|
||||
def __init__(self, api, port):
|
||||
super(LspGetOptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -600,7 +599,7 @@ class LspGetOptionsCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspSetDhcpV4OptionsCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, dhcpopt_uuid):
|
||||
super(LspSetDhcpV4OptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.dhcpopt_uuid = dhcpopt_uuid
|
||||
|
||||
@ -611,7 +610,7 @@ class LspSetDhcpV4OptionsCommand(cmd.BaseCommand):
|
||||
|
||||
class LspGetDhcpV4OptionsCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LspGetDhcpV4OptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -625,7 +624,7 @@ class DhcpOptionsAddCommand(cmd.AddCommand):
|
||||
|
||||
def __init__(self, api, cidr, **external_ids):
|
||||
cidr = netaddr.IPNetwork(cidr)
|
||||
super(DhcpOptionsAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.cidr = str(cidr)
|
||||
self.external_ids = external_ids
|
||||
|
||||
@ -638,7 +637,7 @@ class DhcpOptionsAddCommand(cmd.AddCommand):
|
||||
|
||||
class DhcpOptionsDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, dhcpopt_uuid):
|
||||
super(DhcpOptionsDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.dhcpopt_uuid = dhcpopt_uuid
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -658,7 +657,7 @@ class DhcpOptionsGetCommand(cmd.BaseGetRowCommand):
|
||||
|
||||
class DhcpOptionsSetOptionsCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, dhcpopt_uuid, **options):
|
||||
super(DhcpOptionsSetOptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.dhcpopt_uuid = dhcpopt_uuid
|
||||
self.options = options
|
||||
|
||||
@ -669,7 +668,7 @@ class DhcpOptionsSetOptionsCommand(cmd.BaseCommand):
|
||||
|
||||
class DhcpOptionsGetOptionsCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, dhcpopt_uuid):
|
||||
super(DhcpOptionsGetOptionsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.dhcpopt_uuid = dhcpopt_uuid
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -679,7 +678,7 @@ class DhcpOptionsGetOptionsCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LrAddCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router=None, may_exist=False, **columns):
|
||||
super(LrAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.may_exist = may_exist
|
||||
self.columns = columns
|
||||
@ -707,7 +706,7 @@ class LrAddCommand(cmd.BaseCommand):
|
||||
|
||||
class LrDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router, if_exists=False):
|
||||
super(LrDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -715,11 +714,11 @@ class LrDelCommand(cmd.BaseCommand):
|
||||
try:
|
||||
lr = self.api.lookup('Logical_Router', self.router)
|
||||
lr.delete()
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = "Logical Router %s does not exist" % self.router
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
|
||||
class LrListCommand(cmd.ReadOnlyCommand):
|
||||
@ -742,7 +741,7 @@ class LrpAddCommand(cmd.BaseCommand):
|
||||
self.peer = peer
|
||||
self.may_exist = may_exist
|
||||
self.columns = columns
|
||||
super(LrpAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
|
||||
def run_idl(self, txn):
|
||||
lr = self.api.lookup('Logical_Router', self.router)
|
||||
@ -794,14 +793,14 @@ class LrpAddCommand(cmd.BaseCommand):
|
||||
|
||||
class LrpDelCommand(PortDelCommand):
|
||||
def __init__(self, api, port, router=None, if_exists=False):
|
||||
super(LrpDelCommand, self).__init__(
|
||||
super().__init__(
|
||||
api, 'Logical_Router_Port', port, 'Logical_Router', router,
|
||||
if_exists)
|
||||
|
||||
|
||||
class LrpListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, router):
|
||||
super(LrpListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -811,7 +810,7 @@ class LrpListCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LrpSetEnabledCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, is_enabled):
|
||||
super(LrpSetEnabledCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.is_enabled = is_enabled
|
||||
|
||||
@ -822,7 +821,7 @@ class LrpSetEnabledCommand(cmd.BaseCommand):
|
||||
|
||||
class LrpGetEnabledCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, port):
|
||||
super(LrpGetEnabledCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -844,7 +843,7 @@ class LrRouteAddCommand(cmd.BaseCommand):
|
||||
policy='dst-ip', may_exist=False):
|
||||
prefix = str(netaddr.IPNetwork(prefix))
|
||||
nexthop = str(netaddr.IPAddress(nexthop))
|
||||
super(LrRouteAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.prefix = prefix
|
||||
self.nexthop = nexthop
|
||||
@ -887,7 +886,7 @@ class LrRouteDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router, prefix=None, if_exists=False):
|
||||
if prefix is not None:
|
||||
prefix = str(netaddr.IPNetwork(prefix))
|
||||
super(LrRouteDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.prefix = prefix
|
||||
self.if_exists = if_exists
|
||||
@ -911,7 +910,7 @@ class LrRouteDelCommand(cmd.BaseCommand):
|
||||
|
||||
class LrRouteListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, router):
|
||||
super(LrRouteListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -940,7 +939,7 @@ class LrNatAddCommand(cmd.BaseCommand):
|
||||
if external_mac:
|
||||
external_mac = str(
|
||||
netaddr.EUI(external_mac, dialect=netaddr.mac_unix_expanded))
|
||||
super(LrNatAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.nat_type = nat_type
|
||||
self.external_ip = external_ip
|
||||
@ -985,7 +984,7 @@ class LrNatAddCommand(cmd.BaseCommand):
|
||||
class LrNatDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router, nat_type=None, match_ip=None,
|
||||
if_exists=False):
|
||||
super(LrNatDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.conditions = []
|
||||
if nat_type:
|
||||
if nat_type not in const.NAT_TYPES:
|
||||
@ -1027,7 +1026,7 @@ class LrNatDelCommand(cmd.BaseCommand):
|
||||
|
||||
class LrNatListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, router):
|
||||
super(LrNatListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -1038,7 +1037,7 @@ class LrNatListCommand(cmd.ReadOnlyCommand):
|
||||
class LbAddCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, lb, vip, ips, protocol=const.PROTO_TCP,
|
||||
may_exist=False, **columns):
|
||||
super(LbAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.lb = lb
|
||||
self.vip = utils.normalize_ip_port(vip)
|
||||
self.ips = ",".join(utils.normalize_ip_port(ip) for ip in ips)
|
||||
@ -1072,7 +1071,7 @@ class LbAddCommand(cmd.BaseCommand):
|
||||
|
||||
class LbDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, lb, vip=None, if_exists=False):
|
||||
super(LbDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.lb = lb
|
||||
self.vip = utils.normalize_ip_port(vip) if vip else vip
|
||||
self.if_exists = if_exists
|
||||
@ -1103,7 +1102,7 @@ class LbListCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LrLbAddCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router, lb, may_exist=False):
|
||||
super(LrLbAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.lb = lb
|
||||
self.may_exist = may_exist
|
||||
@ -1121,7 +1120,7 @@ class LrLbAddCommand(cmd.BaseCommand):
|
||||
|
||||
class LrLbDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, router, lb=None, if_exists=False):
|
||||
super(LrLbDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
self.lb = lb
|
||||
self.if_exists = if_exists
|
||||
@ -1142,7 +1141,7 @@ class LrLbDelCommand(cmd.BaseCommand):
|
||||
|
||||
class LrLbListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, router):
|
||||
super(LrLbListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.router = router
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -1152,7 +1151,7 @@ class LrLbListCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LsLbAddCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, switch, lb, may_exist=False):
|
||||
super(LsLbAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.lb = lb
|
||||
self.may_exist = may_exist
|
||||
@ -1170,7 +1169,7 @@ class LsLbAddCommand(cmd.BaseCommand):
|
||||
|
||||
class LsLbDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, switch, lb=None, if_exists=False):
|
||||
super(LsLbDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
self.lb = lb
|
||||
self.if_exists = if_exists
|
||||
@ -1191,7 +1190,7 @@ class LsLbDelCommand(cmd.BaseCommand):
|
||||
|
||||
class LsLbListCommand(cmd.ReadOnlyCommand):
|
||||
def __init__(self, api, switch):
|
||||
super(LsLbListCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.switch = switch
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -1203,7 +1202,7 @@ class DnsAddCommand(cmd.AddCommand):
|
||||
table_name = 'DNS'
|
||||
|
||||
def __init__(self, api, **columns):
|
||||
super(DnsAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.columns = columns
|
||||
|
||||
def run_idl(self, txn):
|
||||
@ -1217,7 +1216,7 @@ class DnsAddCommand(cmd.AddCommand):
|
||||
|
||||
class DnsDelCommand(cmd.DbDestroyCommand):
|
||||
def __init__(self, api, uuid):
|
||||
super(DnsDelCommand, self).__init__(api, 'DNS', uuid)
|
||||
super().__init__(api, 'DNS', uuid)
|
||||
|
||||
|
||||
class DnsGetCommand(cmd.BaseGetRowCommand):
|
||||
@ -1232,7 +1231,7 @@ class DnsListCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class DnsSetRecordsCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, row_uuid, **records):
|
||||
super(DnsSetRecordsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.row_uuid = row_uuid
|
||||
self.records = records
|
||||
|
||||
@ -1240,14 +1239,14 @@ class DnsSetRecordsCommand(cmd.BaseCommand):
|
||||
try:
|
||||
dns = self.api.lookup('DNS', self.row_uuid)
|
||||
dns.records = self.records
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
msg = "DNS %s does not exist" % self.row_uuid
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
|
||||
class DnsSetExternalIdsCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, row_uuid, **external_ids):
|
||||
super(DnsSetExternalIdsCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.row_uuid = row_uuid
|
||||
self.external_ids = external_ids
|
||||
|
||||
@ -1255,16 +1254,16 @@ class DnsSetExternalIdsCommand(cmd.BaseCommand):
|
||||
try:
|
||||
dns = self.api.lookup('DNS', self.row_uuid)
|
||||
dns.external_ids = self.external_ids
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
msg = "DNS %s does not exist" % self.row_uuid
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(msg) from e
|
||||
|
||||
|
||||
class PgAddCommand(cmd.AddCommand):
|
||||
table_name = 'Port_Group'
|
||||
|
||||
def __init__(self, api, name, may_exist=False, **columns):
|
||||
super(PgAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.may_exist = may_exist
|
||||
self.columns = columns
|
||||
@ -1288,7 +1287,7 @@ class PgDelCommand(cmd.BaseCommand):
|
||||
table_name = 'Port_Group'
|
||||
|
||||
def __init__(self, api, name, if_exists=False):
|
||||
super(PgDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -1296,17 +1295,18 @@ class PgDelCommand(cmd.BaseCommand):
|
||||
try:
|
||||
pg = self.api.lookup(self.table_name, self.name)
|
||||
pg.delete()
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
raise RuntimeError('Port group %s does not exist' % self.name)
|
||||
raise RuntimeError(
|
||||
'Port group %s does not exist' % self.name) from e
|
||||
|
||||
|
||||
class _PgUpdatePortsHelper(cmd.BaseCommand):
|
||||
method = None
|
||||
|
||||
def __init__(self, api, port_group, lsp=None, if_exists=False):
|
||||
super(_PgUpdatePortsHelper, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port_group = port_group
|
||||
self.lsp = [] if lsp is None else self._listify(lsp)
|
||||
self.if_exists = if_exists
|
||||
@ -1323,20 +1323,20 @@ class _PgUpdatePortsHelper(cmd.BaseCommand):
|
||||
elif utils.is_uuid_like(port):
|
||||
try:
|
||||
port = self.api.lookup('Logical_Switch_Port', port)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
raise RuntimeError(
|
||||
'Port %s does not exist' % port)
|
||||
'Port %s does not exist' % port) from e
|
||||
|
||||
getattr(pg, self.method)('ports', port)
|
||||
|
||||
def run_idl(self, txn):
|
||||
try:
|
||||
pg = self.api.lookup('Port_Group', self.port_group)
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
raise RuntimeError('Port group %s does not exist' %
|
||||
self.port_group)
|
||||
self.port_group) from e
|
||||
|
||||
for lsp in self.lsp:
|
||||
self._run_method(pg, lsp)
|
||||
@ -1359,7 +1359,7 @@ class GatewayChassisAddCommand(cmd.AddCommand):
|
||||
|
||||
def __init__(self, api, name, chassis_name, priority=0, may_exist=False,
|
||||
**columns):
|
||||
super(GatewayChassisAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.chassis_name = chassis_name
|
||||
self.priority = priority
|
||||
@ -1385,7 +1385,7 @@ class HAChassisGroupAddCommand(cmd.AddCommand):
|
||||
table_name = 'HA_Chassis_Group'
|
||||
|
||||
def __init__(self, api, name, may_exist=False, **columns):
|
||||
super(HAChassisGroupAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.may_exist = may_exist
|
||||
self.columns = columns
|
||||
@ -1409,7 +1409,7 @@ class HAChassisGroupDelCommand(cmd.BaseCommand):
|
||||
table_name = 'HA_Chassis_Group'
|
||||
|
||||
def __init__(self, api, name, if_exists=False):
|
||||
super(HAChassisGroupDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.name = name
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -1417,11 +1417,11 @@ class HAChassisGroupDelCommand(cmd.BaseCommand):
|
||||
try:
|
||||
hcg = self.api.lookup(self.table_name, self.name)
|
||||
hcg.delete()
|
||||
except idlutils.RowNotFound:
|
||||
except idlutils.RowNotFound as e:
|
||||
if self.if_exists:
|
||||
return
|
||||
raise RuntimeError(
|
||||
'HA Chassis Group %s does not exist' % self.name)
|
||||
'HA Chassis Group %s does not exist' % self.name) from e
|
||||
|
||||
|
||||
class HAChassisGroupGetCommand(cmd.BaseGetRowCommand):
|
||||
@ -1432,7 +1432,7 @@ class HAChassisGroupAddChassisCommand(cmd.AddCommand):
|
||||
table_name = 'HA_Chassis'
|
||||
|
||||
def __init__(self, api, hcg_id, chassis, priority, **columns):
|
||||
super(HAChassisGroupAddChassisCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.hcg_id = hcg_id
|
||||
self.chassis = chassis
|
||||
self.priority = priority
|
||||
@ -1463,7 +1463,7 @@ class HAChassisGroupDelChassisCommand(cmd.BaseCommand):
|
||||
table_name = 'HA_Chassis'
|
||||
|
||||
def __init__(self, api, hcg_id, chassis, if_exists=False):
|
||||
super(HAChassisGroupDelChassisCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.hcg_id = hcg_id
|
||||
self.chassis = chassis
|
||||
self.if_exists = if_exists
|
||||
|
@ -20,7 +20,7 @@ class ChassisAddCommand(cmd.AddCommand):
|
||||
|
||||
def __init__(self, api, chassis, encap_types, encap_ip, may_exist=False,
|
||||
**columns):
|
||||
super(ChassisAddCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.chassis = chassis
|
||||
self.encap_types = encap_types
|
||||
self.encap_ip = encap_ip
|
||||
@ -57,7 +57,7 @@ class ChassisAddCommand(cmd.AddCommand):
|
||||
|
||||
class ChassisDelCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, chassis, if_exists=False):
|
||||
super(ChassisDelCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.chassis = chassis
|
||||
self.if_exists = if_exists
|
||||
|
||||
@ -83,7 +83,7 @@ class ChassisListCommand(cmd.ReadOnlyCommand):
|
||||
|
||||
class LspBindCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, chassis, may_exist=False):
|
||||
super(LspBindCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.chassis = chassis
|
||||
self.may_exist = may_exist
|
||||
@ -102,7 +102,7 @@ class LspBindCommand(cmd.BaseCommand):
|
||||
|
||||
class LspUnbindCommand(cmd.BaseCommand):
|
||||
def __init__(self, api, port, if_exists=False):
|
||||
super(LspUnbindCommand, self).__init__(api)
|
||||
super().__init__(api)
|
||||
self.port = port
|
||||
self.if_exists = if_exists
|
||||
|
||||
|
@ -25,23 +25,23 @@ def normalize_ip(ip):
|
||||
def normalize_ip_port(ipport):
|
||||
try:
|
||||
return normalize_ip(ipport)
|
||||
except netaddr.AddrFormatError:
|
||||
except netaddr.AddrFormatError as e:
|
||||
# maybe we have a port
|
||||
if ipport[0] == '[':
|
||||
# Should be an IPv6 w/ port
|
||||
try:
|
||||
ip, port = ipport[1:].split(']:')
|
||||
except ValueError:
|
||||
raise netaddr.AddrFormatError("Invalid Port")
|
||||
except ValueError as e2:
|
||||
raise netaddr.AddrFormatError("Invalid Port") from e2
|
||||
ip = "[%s]" % normalize_ip(ip)
|
||||
else:
|
||||
try:
|
||||
ip, port = ipport.split(':')
|
||||
except ValueError:
|
||||
raise netaddr.AddrFormatError("Invalid Port")
|
||||
except ValueError as e3:
|
||||
raise netaddr.AddrFormatError("Invalid Port") from e3
|
||||
ip = normalize_ip(ip)
|
||||
if int(port) <= 0 or int(port) > 65535:
|
||||
raise netaddr.AddrFormatError("Invalid port")
|
||||
raise netaddr.AddrFormatError("Invalid port") from e
|
||||
return "%s:%s" % (ip, port)
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ class OvsVenvFixture(fixtures.Fixture):
|
||||
return 'unix:' + os.path.join(self.venv, 'db.sock')
|
||||
|
||||
def _setUp(self):
|
||||
super(OvsVenvFixture, self)._setUp()
|
||||
super()._setUp()
|
||||
self.addCleanup(self.deactivate)
|
||||
if not os.path.isdir(self.venv):
|
||||
os.mkdir(self.venv)
|
||||
@ -160,7 +160,7 @@ class OvsOvnVenvFixture(OvsVenvFixture):
|
||||
# Use OVN source dir
|
||||
self.PATH_VAR_TEMPLATE += (
|
||||
":{0}/controller:{0}/northd:{0}/utilities".format(ovndir))
|
||||
super(OvsOvnVenvFixture, self).__init__(venv, **kwargs)
|
||||
super().__init__(venv, **kwargs)
|
||||
self.ovndir = self._share_path(self.OVN_PATHS, ovndir,
|
||||
[self.SBSCHEMA, self.NBSCHEMA])
|
||||
self.env.update({'OVN_RUNDIR': self.venv})
|
||||
@ -182,12 +182,12 @@ class OvsOvnVenvFixture(OvsVenvFixture):
|
||||
return 'unix:' + os.path.join(self.venv, 'ovnsb_db.sock')
|
||||
|
||||
def setup_dbs(self):
|
||||
super(OvsOvnVenvFixture, self).setup_dbs()
|
||||
super().setup_dbs()
|
||||
self.create_db('ovnsb.db', self.ovnsb_schema)
|
||||
self.create_db('ovnnb.db', self.ovnnb_schema)
|
||||
|
||||
def start_ovsdb_processes(self):
|
||||
super(OvsOvnVenvFixture, self).start_ovsdb_processes()
|
||||
super().start_ovsdb_processes()
|
||||
self.call(['ovsdb-server', '--detach', '--no-chdir', '-vconsole:off',
|
||||
'--pidfile=%s' % os.path.join(self.venv, 'ovnnb_db.pid'),
|
||||
'--log-file=%s' % os.path.join(self.venv, 'ovnnb_db.log'),
|
||||
@ -210,7 +210,7 @@ class OvsOvnVenvFixture(OvsVenvFixture):
|
||||
'--remote=p' + self.ovnsb_connection, 'ovnsb.db'])
|
||||
|
||||
def init_processes(self):
|
||||
super(OvsOvnVenvFixture, self).init_processes()
|
||||
super().init_processes()
|
||||
self.call(['ovn-nbctl', 'init'])
|
||||
self.call(['ovn-sbctl', 'init'])
|
||||
if self.add_chassis:
|
||||
|
@ -8,7 +8,7 @@ coverage!=4.4,>=4.0 # Apache-2.0
|
||||
isort==4.3.21 # MIT
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
pylint==2.3.0 # GPLv2
|
||||
pylint==2.6.0 # GPLv2
|
||||
stestr>=2.0.0 # Apache-2.0
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
testtools>=2.2.0 # MIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user