Replace instances of del os.environ with os.environ.pop

Fixes: https://pagure.io/freeipa/issue/9450

Signed-off-by: Ian Brown <ian.brown@templeandwebster.com.au>
Signed-off-by: Ian Brown <ianbrown78@gmail.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Ian Brown authored and Rob Crittenden committed 2024-10-14 22:02:07 -04:00
1 parent a2d498e0cb
commit f3ec6ae8d0
5 files changed
+5 -5

No files matched your search

@@ -475,7 +475,7 @@ def renew_ca_cert(reuse_existing, force_self_signed, **kwargs):
if profile is not None:
os.environ['CERTMONGER_CA_PROFILE'] = profile
else:
del os.environ['CERTMONGER_CA_PROFILE']
os.environ.pop('CERTMONGER_CA_PROFILE', None)
if result[0] == WAIT:
return (result[0], '%s:%s' % (state, result[1]))
+1 -1
View File
@@ -70,7 +70,7 @@ class CertUpdate(admintool.AdminTool):
raise
finally:
if old_krb5ccname is None:
del os.environ['KRB5CCNAME']
os.environ.pop('KRB5CCNAME', None)
else:
os.environ['KRB5CCNAME'] = old_krb5ccname
+1 -1
View File
@@ -2061,7 +2061,7 @@ def empty_ccache():
if old_path:
os.environ['KRB5CCNAME'] = old_path
else:
del os.environ['KRB5CCNAME']
os.environ.pop('KRB5CCNAME', None)
shutil.rmtree(kpath_dir)
+1 -1
View File
@@ -275,7 +275,7 @@ class test_x509:
if tz:
os.environ['TZ'] = tz
else:
del os.environ['TZ']
os.environ.pop('TZ', None)
# ensure the timezone doesn't mess with not_before and not_after
assert cert.not_valid_before == not_before
assert cert.not_valid_after == not_after
+1 -1
View File
@@ -84,7 +84,7 @@ def p11(request, token_path):
[SOFTHSM2_UTIL, '--delete-token', '--label', 'test'],
cwd=token_path
)
del os.environ['SOFTHSM2_CONF']
os.environ.pop('SOFTHSM2_CONF', None)
request.addfinalizer(fin)