Exit if config doesn't exist
This commit is contained in:
parent
e9c23c3247
commit
785b1fbc57
1 changed files with 4 additions and 1 deletions
|
@ -92,7 +92,7 @@ class WallabyClient:
|
||||||
self.sock = ESock(socket.create_connection(host_port_pair), debug=debug)
|
self.sock = ESock(socket.create_connection(host_port_pair), debug=debug)
|
||||||
self.connected = True
|
self.connected = True
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.sync = SyncClient(self.sock, sys.argv[1], "w_sync", debug=True)
|
self.sync = SyncClient(self.sock, PATH, "w_sync", debug=True)
|
||||||
self.routes = {"wallaby_control" : WallabyControl(), "w_sync" : self.sync,
|
self.routes = {"wallaby_control" : WallabyControl(), "w_sync" : self.sync,
|
||||||
"get_info" : GetInfo()}
|
"get_info" : GetInfo()}
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ class WallabyClient:
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONFIG_PATH = "wallaby.cfg"
|
CONFIG_PATH = "wallaby.cfg"
|
||||||
|
|
||||||
config = Config.Config()
|
config = Config.Config()
|
||||||
|
@ -124,6 +125,8 @@ try:
|
||||||
config = config.read_from_file(CONFIG_PATH)
|
config = config.read_from_file(CONFIG_PATH)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
config.write_to_file(CONFIG_PATH)
|
config.write_to_file(CONFIG_PATH)
|
||||||
|
Logging.info("Config file created. Please modify to reflect your setup.")
|
||||||
|
exit(1)
|
||||||
config = config.read_from_file(CONFIG_PATH)
|
config = config.read_from_file(CONFIG_PATH)
|
||||||
|
|
||||||
wallaby_client = WallabyClient(config.server_address, debug=config.debug)
|
wallaby_client = WallabyClient(config.server_address, debug=config.debug)
|
||||||
|
|
Reference in a new issue