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

fix for test

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