Avoid fail during yields
This just causes a double-exception, so don't do it.
This commit is contained in:
parent
2a637c62e8
commit
73a4795967
|
@ -152,10 +152,7 @@ def chroot(destination):
|
||||||
os.fchdir(fake_root)
|
os.fchdir(fake_root)
|
||||||
yield
|
yield
|
||||||
except Exception:
|
except Exception:
|
||||||
fail(
|
raise
|
||||||
None,
|
|
||||||
f"Failed to chroot into {destination}",
|
|
||||||
)
|
|
||||||
finally:
|
finally:
|
||||||
os.fchdir(real_root)
|
os.fchdir(real_root)
|
||||||
os.chroot(".")
|
os.chroot(".")
|
||||||
|
@ -187,10 +184,7 @@ def open_db(config):
|
||||||
try:
|
try:
|
||||||
yield cur
|
yield cur
|
||||||
except Exception:
|
except Exception:
|
||||||
fail(
|
raise
|
||||||
None,
|
|
||||||
"Failed to yield database handle",
|
|
||||||
)
|
|
||||||
finally:
|
finally:
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
|
@ -213,10 +207,7 @@ def open_zk(config):
|
||||||
try:
|
try:
|
||||||
yield zkhandler
|
yield zkhandler
|
||||||
except Exception:
|
except Exception:
|
||||||
fail(
|
raise
|
||||||
None,
|
|
||||||
"Failed to yield Zookeeper connection",
|
|
||||||
)
|
|
||||||
finally:
|
finally:
|
||||||
zkhandler.disconnect()
|
zkhandler.disconnect()
|
||||||
del zkhandler
|
del zkhandler
|
||||||
|
|
Loading…
Reference in New Issue