Commit 8739a96e authored by Lisa Casino's avatar Lisa Casino

fix for test

parent c4213291
......@@ -241,6 +241,7 @@ class RunPromise(GenericPromise):
def sense(self):
# find if a disk is mounted on the path
self.logger.info("Debut")
disk_partition = ""
db_path = self.getConfig('collectordb')
check_date = self.getConfig('test-check-date')
......@@ -274,6 +275,8 @@ class RunPromise(GenericPromise):
currenttime = now - datetime.timedelta(minutes=1)
currenttime = currenttime.time().strftime('%H:%M')
self.logger.info("Vérification du disk size va commencer")
disk_size = self.getDiskSize(disk_partition, db_path)
default_threshold = None
if disk_size is not None:
......@@ -283,6 +286,7 @@ class RunPromise(GenericPromise):
free_space = self.getFreeSpace(disk_partition, db_path, currentdate,
currenttime)
self.logger.info("Free space checked")
if free_space == 0:
return
elif free_space > threshold*1024*1024*1024:
......@@ -317,6 +321,8 @@ class RunPromise(GenericPromise):
message = "Free disk space low: remaining %.2f G (disk size: %.2f G, threshold: %s G)." % (
free_space/(1024*1024*1024), disk_size/(1024*1024*1024), threshold)
self.logger.info("Peut-être va afficher les grosses partitions")
display_partition = bool(int(self.getConfig('display-partition'), 0))
self.logger.info("Enable to display the 3 biggest partitions: %s" % display_partition)
if display_partition:
......
......@@ -89,6 +89,8 @@ class RunPromise(GenericPromise):
database = Database(db_path, create=False, timeout=10)
try:
disk_size = self.getDiskSize(disk_partition, db_path)
if disk_size is None:
return None
database.connect()
result = database.select(
"folder",
......
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