From 683252671f1594bf32330db03321e2b119f3f042 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 11 May 2016 00:33:53 +0000 Subject: [PATCH] Implement reboot command --- client/client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/client.py b/client/client.py index 9dc8d3b..1d886aa 100755 --- a/client/client.py +++ b/client/client.py @@ -124,12 +124,18 @@ class Client(threadedclient.WebSocketClient): FLAGS.boot_dir) update.Update() + def _OnCommand(self, data): + if data['command'] == 'reboot': + subprocess.check_call(['reboot']) + def received_message(self, msg): parsed = json.loads(msg.data.decode('utf8')) if parsed['type'] == 'image_types': self._OnImageTypes(parsed['data']) elif parsed['type'] == 'new_manifest': self._OnNewManifest(parsed['data']) + elif parsed['type'] == 'command': + self._OnCommand(parsed['data']) def main():