Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PandABox-tst
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PandABox-tst
Commits
3af7db9f
Commit
3af7db9f
authored
Feb 22, 2017
by
Christopher Turner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add load state script
parent
920c3efb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
load-state
load-state
+29
-0
No files found.
load-state
0 → 100755
View file @
3af7db9f
#!/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.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment