summaryrefslogtreecommitdiff
path: root/opendc/models/machine.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-23 18:08:28 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-06-23 18:08:28 +0200
commit565ede0dc50c3b2df09c066ea3a28a4901cce547 (patch)
treee81a1bbed43d2eaf7e2be0bc61007963f807b62d /opendc/models/machine.py
parent6f41be7d9c244b67bfa5ff72f1e90d18fa45b590 (diff)
Add DB handlers and rename to v2
Diffstat (limited to 'opendc/models/machine.py')
-rw-r--r--opendc/models/machine.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/opendc/models/machine.py b/opendc/models/machine.py
index f233d329..e6e49c4b 100644
--- a/opendc/models/machine.py
+++ b/opendc/models/machine.py
@@ -64,7 +64,7 @@ class Machine(Model):
try:
statement = 'SELECT id FROM machines WHERE rack_id = %s AND position = %s'
- machine_id = database.fetchone(statement, (rack.id, position))[0]
+ machine_id = database.fetch_one(statement, (rack.id, position))[0]
except:
return cls(id=-1)
@@ -102,7 +102,7 @@ class Machine(Model):
for device_table in self.device_table_to_attribute.keys():
statement = 'SELECT * FROM machine_{} WHERE machine_id = %s'.format(device_table)
- results = database.fetchall(statement, (self.id,))
+ results = database.fetch_all(statement, (self.id,))
device_ids = []