Commit 3af7db9f authored by Christopher Turner's avatar Christopher Turner

Add load state script

parent 920c3efb
#!/usr/bin/env python2
# Script to restore the state of the given Panda.
import argparse
import socket
# Argument processing
parser = argparse.ArgumentParser(
description = 'Restore Panda configuration state from file')
parser.add_argument(
'--port', '-p', default = 8888, help = 'Configuration port number')
parser.add_argument(
'hostname', help = 'Name or IP address of Panda device')
parser.add_argument(
'state', help = 'Filename to load')
args = parser.parse_args()
# Connect to requested Panda
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((args.hostname, args.port))
for line in open(args.state):
sock.sendall(line)
# We don't actually need to wait around for the response! Of course, this does
# mean that if the file is malformed, our error responses go unseen. Ho hum.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment