Support display when remote already exists.
parent
00d79c8adf
commit
dc8acb7543
|
@ -27,5 +27,9 @@ def remote_add_gen(name:str, rtype:str, info):
|
|||
async def remote_add(con:utils.Connection):
|
||||
result = await con.call({"operation": "remote-add", "name": name, "type": rtype, "info": info})
|
||||
if result["status"] != "success":
|
||||
raise RuntimeError("Wasn't able to add remote.") # TODO: Show error
|
||||
if result["status"] == "fail-already-exists":
|
||||
print("Remote %s already exists." % name)
|
||||
exit(1)
|
||||
else:
|
||||
raise RuntimeError("Wasn't able to add remote.") # TODO: Show error
|
||||
return remote_add
|
|
@ -63,7 +63,7 @@ async def add_remote(data:dict):
|
|||
async with config.config_lock:
|
||||
# Check
|
||||
if name in config.remotes:
|
||||
raise ValueError("'%s' remote already exists." % name)
|
||||
return {"status": "fail-already-exists"}
|
||||
|
||||
# Set remote
|
||||
config.remotes[name] = rem
|
||||
|
|
Loading…
Reference in New Issue