Send report just before reboot

This commit is contained in:
Ian Gulliver
2016-05-11 19:56:32 +00:00
parent aa48483c11
commit 5892e74380

View File

@@ -68,6 +68,10 @@ class Client(threadedclient.WebSocketClient):
self.connect()
self._OnNewManifest2()
while True:
self._SendReport()
time.sleep(5.0)
def _SendReport(self):
report = {
'hostname': socket.gethostname(),
'uptime_seconds': self._Uptime(),
@@ -78,8 +82,7 @@ class Client(threadedclient.WebSocketClient):
self.send(json.dumps({
'type': 'report',
'data': report,
}), False)
time.sleep(5.0)
}))
def _Uptime(self):
with open('/proc/uptime', 'r') as fh:
@@ -128,6 +131,7 @@ class Client(threadedclient.WebSocketClient):
fetch.Fetch(data['timestamp'])
self._UpdateGrub()
self._SendReport()
subprocess.check_call(['reboot'])
def received_message(self, msg):