Implement reboot command
This commit is contained in:
@@ -124,12 +124,18 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
FLAGS.boot_dir)
|
FLAGS.boot_dir)
|
||||||
update.Update()
|
update.Update()
|
||||||
|
|
||||||
|
def _OnCommand(self, data):
|
||||||
|
if data['command'] == 'reboot':
|
||||||
|
subprocess.check_call(['reboot'])
|
||||||
|
|
||||||
def received_message(self, msg):
|
def received_message(self, msg):
|
||||||
parsed = json.loads(msg.data.decode('utf8'))
|
parsed = json.loads(msg.data.decode('utf8'))
|
||||||
if parsed['type'] == 'image_types':
|
if parsed['type'] == 'image_types':
|
||||||
self._OnImageTypes(parsed['data'])
|
self._OnImageTypes(parsed['data'])
|
||||||
elif parsed['type'] == 'new_manifest':
|
elif parsed['type'] == 'new_manifest':
|
||||||
self._OnNewManifest(parsed['data'])
|
self._OnNewManifest(parsed['data'])
|
||||||
|
elif parsed['type'] == 'command':
|
||||||
|
self._OnCommand(parsed['data'])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user