diff options
Diffstat (limited to 'scenarios/fragments')
-rw-r--r-- | scenarios/fragments/garage.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scenarios/fragments/garage.py b/scenarios/fragments/garage.py index cd8b888..f886b33 100644 --- a/scenarios/fragments/garage.py +++ b/scenarios/fragments/garage.py @@ -30,7 +30,7 @@ keys = key_api.KeyApi(api) # Setup, launch on import storage_path = Path(shared.storage_path) / "garage" / env['HOST'] -if 'ZONE' in env: +if 'ZONE' in env and env['ZONE'] != "": storage_path = Path(shared.storage_path) / "garage" / env['ZONE'] / env['HOST'] config = storage_path / "garage.toml" env['GARAGE_CONFIG_FILE'] = str(config) @@ -117,14 +117,17 @@ admin_token = "{admin}" f.write(json.dumps({ "node_addr": f"{node_id}@{env['IP']}:3901", "node_id": node_id, - "zone": env['ZONE'], + "zone": env['ZONE'] if 'ZONE' in env and env['ZONE'] != "" else env['HOST'], "host": env['HOST'], })) def destroy(): dpid = Path(storage_path) / "daemon.pid" if exists(dpid): - shared.exec(f"kill -9 $(cat {dpid})") + try: + shared.exec(f"kill -9 $(cat {dpid})") + except: + pass shared.exec(f"rm -f {dpid}") if len(str(storage_path)) < 8: # arbitrary, stupid safe guard print(storage_path) |