Commit d1426e56 authored by Alain Takoudjou's avatar Alain Takoudjou

promise check free disk/memory: fix 'attempt to write a readonly database'

Also set database connection timeout to 5 second
parent 8fb20de4
...@@ -17,7 +17,7 @@ from slapos.collect.db import Database ...@@ -17,7 +17,7 @@ from slapos.collect.db import Database
def getMemoryInfo(database, time, date): def getMemoryInfo(database, time, date):
memory_info = {} memory_info = {}
database = Database(database) database = Database(database, create=False, timeout=5)
try: try:
database.connect() database.connect()
query_result = database.select("computer", date, "memory_size", limit=1) query_result = database.select("computer", date, "memory_size", limit=1)
......
...@@ -16,7 +16,7 @@ from slapos.collect.db import Database ...@@ -16,7 +16,7 @@ from slapos.collect.db import Database
def getFreeSpace(disk_partition, database, date, time): def getFreeSpace(disk_partition, database, date, time):
database = Database(database) database = Database(database, create=False, timeout=5)
try: try:
# fetch free disk space # fetch free disk space
database.connect() database.connect()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment