aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2014-12-05 16:22:44 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2014-12-05 16:22:44 +0000
commit8c64d952434e84df643749cf760d60ed5d6f87fc (patch)
treeeb28c8963dc4b1bd4b93e5cdce8b3fea08604bf5 /db
parent7310657d0a0fe9615160944f5559872ed8e4e135 (diff)
Check the port exists in set_port_is_locked
Change-Id: Ie8bedafc0a84bdab537b4152d73718f1b3a399fd
Diffstat (limited to 'db')
-rw-r--r--db/db.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/db/db.py b/db/db.py
index 13d3773..c5db8b3 100644
--- a/db/db.py
+++ b/db/db.py
@@ -330,6 +330,9 @@ class VlanDB:
# settings on the port. Use this to lock down ports that are used
# for PDUs and other core infrastructure
def set_port_is_locked(self, port_id, is_locked):
+ port = self.get_port_by_id(port_id)
+ if port is None:
+ raise InputError("Port %s does not exist" % port_id)
try:
sql = "UPDATE port SET is_locked=%s WHERE port_id=%s"
data = (is_locked, port_id)