[V3 instance setup] Warn and request confirmation if instance name already in use (#1469)

This commit is contained in:
palmtree5 2018-03-28 15:13:34 -08:00 committed by Will
parent 61b34e835e
commit 9ecea9e1d5

View File

@ -63,6 +63,14 @@ def save_config(name, data, remove=False):
if remove and name in config: if remove and name in config:
config.pop(name) config.pop(name)
else: else:
if name in config:
print(
"WARNING: An instance already exists with this name. "
"Continuing will overwrite the existing instance config."
)
if not confirm("Are you absolutely certain you want to continue (y/n)? "):
print("Not continuing")
sys.exit(0)
config[name] = data config[name] = data
JsonIO(config_file)._save_json(config) JsonIO(config_file)._save_json(config)