api: cleanup already started servers when some later failed
This commit is contained in:
parent
d7b968d867
commit
e6d5337fa7
@ -398,7 +398,18 @@ def create_servers(*args, force=False, loop=None, **kwargs):
|
|||||||
shutil.chown(sock.getsockname(), group='qubes')
|
shutil.chown(sock.getsockname(), group='qubes')
|
||||||
|
|
||||||
servers.append(server)
|
servers.append(server)
|
||||||
|
except:
|
||||||
|
for server in servers:
|
||||||
|
for sock in server.sockets:
|
||||||
|
try:
|
||||||
|
os.unlink(sock.getsockname())
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
server.close()
|
||||||
|
if servers:
|
||||||
|
yield from asyncio.wait([
|
||||||
|
server.wait_closed() for server in servers])
|
||||||
|
raise
|
||||||
finally:
|
finally:
|
||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user