diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2018-02-07 00:03:49 +0000 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2018-02-07 00:03:49 +0000 |
commit | ca115d29c8db3ddc1797555c2c127d8dba0a8d41 (patch) | |
tree | 032bf00aef43a070d4b340e4af43feffed288561 | |
parent | e6ff7f0c227c5106703f23da17486e59d67cd833 (diff) |
More database fixes for the RealDict database changes
Change-Id: Iae93c819a5b1874ac8ff7fdcec6f08d391c588d6
-rw-r--r-- | db/db.py | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -242,12 +242,12 @@ class VlanDB: port = self.get_port_by_id(int(port_id)) if port is None: raise NotFoundError("Port ID %d does not exist" % int(port_id)) - if not port.is_trunk: + if not port['is_trunk']: raise InputError("Port ID %d is not in trunk mode" % int(port_id)) - if port.is_locked: + if port['is_locked']: raise InputError("Port ID %d is locked" % int(port_id)) - if port.trunk_id != TRUNK_ID_NONE: - raise InputError("Port ID %d is already on trunk ID %d" % (int(port_id), int(port.trunk_id))) + if port['trunk_id'] != TRUNK_ID_NONE: + raise InputError("Port ID %d is already on trunk ID %d" % (int(port_id), int(port['trunk_id']))) try: # Add the trunk itself @@ -305,7 +305,7 @@ class VlanDB: port = self.get_port_by_id(port_id) if port is None: raise NotFoundError("Port ID %d does not exist" % int(port_id)) - if port.is_locked: + if port['is_locked']: raise InputError("Cannot delete port ID %d as it is locked" % int(port_id)) self._delete_row("port", "port_id", port_id) return port_id @@ -702,7 +702,7 @@ class VlanDB: if port is None: raise NotFoundError("Port ID %d does not exist" % int(port_id)) - if port.is_trunk or port.is_locked: + if port['is_trunk'] or port['is_locked']: raise CriticalError("The port is locked") vlan = self.get_vlan_by_id(vlan_id) @@ -734,13 +734,13 @@ class VlanDB: if port is None: raise NotFoundError("Port ID %d does not exist" % int(port_id)) - if port.is_trunk or port.is_locked: + if port['is_trunk'] or port['is_locked']: raise CriticalError("The port is locked") vlan = self.get_vlan_by_id(vlan_id) if vlan is None: raise NotFoundError("VLAN ID %d does not exist" % int(vlan_id)) - if not vlan.is_base_vlan: + if not vlan['is_base_vlan']: raise InputError("VLAN ID %d is not a base VLAN" % int(vlan_id)) try: @@ -764,7 +764,7 @@ class VlanDB: port = self.get_port_by_id(port_id) if port is None: raise NotFoundError("Port ID %d does not exist" % int(port_id)) - if port.is_locked: + if port['is_locked']: raise CriticalError("The port is locked") try: sql = "UPDATE port SET trunk_id=%s WHERE port_id=%s RETURNING port_id" |