fix 2705 & 2706

This commit is contained in:
Arseniy Fomchenko 2017-04-05 23:02:30 +03:00
parent 64e14cde5e
commit 6e6bcdc737
3 changed files with 13 additions and 3 deletions

View File

@ -591,3 +591,6 @@ class OverloadClient(APIClient):
def lock_target(self, target, duration, trace=False):
return
def unlock_target(self, *args, **kwargs):
return

View File

@ -137,6 +137,7 @@ class MonitoringCollector(object):
data = copy.deepcopy(self.__collected_data)
self.__collected_data = []
for listener in self.listeners:
# 2nd deep copy to ensure each listener gets it's own copy
listener.monitoring_data(copy.deepcopy(data))
def hash_hostname(self, host):
@ -145,6 +146,14 @@ class MonitoringCollector(object):
else:
return host
def not_empty(self):
return len(self.__collected_data) > 0
def send_rest_data(self):
while self.not_empty():
logger.info("Sending monitoring data rests...")
self.send_collected_data()
class StdOutPrintMon(MonitoringDataListener):
"""Simple listener, writing data to stdout"""

View File

@ -230,9 +230,7 @@ class Plugin(AbstractPlugin):
for log in self.monitoring.artifact_files:
self.core.add_artifact_file(log)
while self.monitoring.__collected_data:
logger.info("Sending monitoring data rests...")
self.monitoring.send_collected_data()
self.monitoring.send_rest_data()
if self.mon_saver:
self.mon_saver.close()
return retcode