Split master and slave websockets. Pass through reports.

This commit is contained in:
Ian Gulliver
2016-05-05 00:01:12 +00:00
parent 546f032b4f
commit 1a6f1b55c1
2 changed files with 45 additions and 18 deletions

View File

@@ -28,6 +28,11 @@ parser.add_argument(
dest='https_client_key',
action='store',
required=True)
parser.add_argument(
'--image-type',
dest='image_type',
action='store',
required=True)
FLAGS = parser.parse_args()
@@ -42,6 +47,7 @@ class Client(threadedclient.WebSocketClient):
'data': {
'hostname': socket.gethostname(),
'uptime_seconds': self._Uptime(),
'image_type': FLAGS.image_type,
},
}), False)
time.sleep(5.0)
@@ -50,6 +56,11 @@ class Client(threadedclient.WebSocketClient):
with open('/proc/uptime', 'r') as fh:
return int(float(fh.readline().split(' ', 1)[0]))
def received_message(self, msg):
parsed = json.loads(str(msg))
if parsed['type'] == 'image_types':
assert FLAGS.image_type in parsed['data']['image_types']
def main():
ssl_options = {