Close the session once snap connections are acquired (#8438)

This PR uses the context manager available for `requests.Session` to close properly the `session` once snap connections have been acquired.
This commit is contained in:
Adrien Ferrand
2020-11-11 12:54:29 -08:00
committed by GitHub
parent db2ffea351
commit 2a118f3e83
+1 -1
View File
@@ -49,7 +49,7 @@ def prepare_env(cli_args):
os.environ['CERTBOT_AUGEAS_PATH'] = '{0}/usr/lib/{1}/libaugeas.so.0'.format(
os.environ.get('SNAP'), _ARCH_TRIPLET_MAP[snap_arch])
session = Session()
with Session() as session:
session.mount('http://snapd/', _SnapdAdapter())
try: