-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpolyrestremote.py
More file actions
executable file
·28 lines (23 loc) · 885 Bytes
/
polyrestremote.py
File metadata and controls
executable file
·28 lines (23 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
from poly.remotecontroller import RemoteController
import polyinterface
import click
import sys
import yaml
@click.command()
@click.option('-sc', '--serverConfig', help='Server config file', type=click.File('r'), required=True)
@click.option('-c', '--config', help='Config file', type=click.File('r'), required=False)
def PolyRemote(serverconfig, config):
configData = yaml.safe_load(serverconfig)
if config:
configData.update(yaml.safe_load(config))
try:
polyglot = polyinterface.Interface(configData['controller']['name'])
polyglot.start()
controller = RemoteController(polyglot, configData, config is not None)
controller.name = configData['controller']['name']
controller.runForever()
except (KeyboardInterrupt, SystemExit):
sys.exit(0)
if __name__ == '__main__':
PolyRemote()