Report status when applicable
This commit is contained in:
@@ -71,13 +71,15 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
self._SendReport()
|
self._SendReport()
|
||||||
time.sleep(5.0)
|
time.sleep(5.0)
|
||||||
|
|
||||||
def _SendReport(self):
|
def _SendReport(self, status=None):
|
||||||
report = {
|
report = {
|
||||||
'hostname': socket.gethostname(),
|
'hostname': socket.gethostname(),
|
||||||
'uptime_seconds': self._Uptime(),
|
'uptime_seconds': self._Uptime(),
|
||||||
'next_timestamp': self._NextTimestamp(),
|
'next_timestamp': self._NextTimestamp(),
|
||||||
'next_volume_id': lib.GetVolumeID('/isodevice/iconograph/current'),
|
'next_volume_id': lib.GetVolumeID('/isodevice/iconograph/current'),
|
||||||
}
|
}
|
||||||
|
if status:
|
||||||
|
report['status'] = status
|
||||||
report.update(self._config)
|
report.update(self._config)
|
||||||
self.send(json.dumps({
|
self.send(json.dumps({
|
||||||
'type': 'report',
|
'type': 'report',
|
||||||
@@ -130,8 +132,10 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
fetch = self._GetFetcher()
|
fetch = self._GetFetcher()
|
||||||
fetch.Fetch(data['timestamp'])
|
fetch.Fetch(data['timestamp'])
|
||||||
self._UpdateGrub()
|
self._UpdateGrub()
|
||||||
|
self._SendReport('Rebooting into %d...' % data['timestamp'])
|
||||||
|
else:
|
||||||
|
send._SendReport('Rebooting...')
|
||||||
|
|
||||||
self._SendReport()
|
|
||||||
subprocess.check_call(['reboot'])
|
subprocess.check_call(['reboot'])
|
||||||
|
|
||||||
def received_message(self, msg):
|
def received_message(self, msg):
|
||||||
|
|||||||
Reference in New Issue
Block a user