Handle storage client exception, write statistics and audit log restored
@@ -30,6 +30,7 @@ from foglamp.common.configuration_manager import ConfigurationManager
from foglamp.common.statistics import Statistics
from foglamp.common.storage_client.payload_builder import PayloadBuilder
from foglamp.common import logger
+from foglamp.common.storage_client.exceptions import *
from foglamp.common.process import FoglampProcess
@@ -109,9 +110,6 @@ class Purge(FoglampProcess):
result = self._readings_storage.purge(age=config['age']['value'], sent_id=last_id, flag=flag)
- if "message" in result.keys() and "409 Conflict" in result["message"]:
- self._logger.error("Purge failed: %s", result["message"])
- else:
total_count = result['readings']
total_rows_removed = result['removed']
unsent_rows_removed = result['unsentPurged']
@@ -119,13 +117,14 @@ class Purge(FoglampProcess):
except ValueError:
self._logger.error("Configuration item age {} should be integer!".format(config['age']['value']))
raise ValueError
+
+ except StorageServerError:
+ pass
+
try:
if int(config['size']['value']) != 0:
result = self._readings_storage.purge(size=config['size']['value'], sent_id=last_id, flag=flag)
- if "message" in result.keys() and "409 Conflict" in result["message"]:
- self._logger.error("Purge failed: %s", result["message"])
- else:
total_count += result['readings']
total_rows_removed += result['removed']
unsent_rows_removed += result['unsentPurged']
@@ -134,6 +133,9 @@ class Purge(FoglampProcess):
self._logger.error("Configuration item size {} should be integer!".format(config['size']['value']))
raise ValueError
+ except StorageServerError:
+ pass
+
end_time = time.strftime('%Y-%m-%d %H:%M:%S.%s', time.localtime(time.time()))
if total_rows_removed > 0:
