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):
|
async def remote_add(con:utils.Connection):
|
||||||
result = await con.call({"operation": "remote-add", "name": name, "type": rtype, "info": info})
|
result = await con.call({"operation": "remote-add", "name": name, "type": rtype, "info": info})
|
||||||
if result["status"] != "success":
|
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
|
return remote_add
|
|
@ -63,7 +63,7 @@ async def add_remote(data:dict):
|
||||||
async with config.config_lock:
|
async with config.config_lock:
|
||||||
# Check
|
# Check
|
||||||
if name in config.remotes:
|
if name in config.remotes:
|
||||||
raise ValueError("'%s' remote already exists." % name)
|
return {"status": "fail-already-exists"}
|
||||||
|
|
||||||
# Set remote
|
# Set remote
|
||||||
config.remotes[name] = rem
|
config.remotes[name] = rem
|
||||||
|
|
Loading…
Reference in New Issue