#9450 Find and replace del os.environ['foo'] with os.environ.pop('foo', None)
Opened a year ago by rcritten. Modified a year ago

Issue

A new change included code that called "del os.environ['KRB5CCNAME']" where there was no such value in the environment. This caused an unnecessary installation failure.

commit https://pagure.io/freeipa/c/f248b22ef4d98293224b49576f5e6a1b8d672d76 addressed this issue by using pop instead.

There are other occurrences of this code style spread around various utilities. While it may be fair to assume that a given environment variable will always be present, using pop should be a safer route.

We should find and replace them. From a quick search there are only a few.

$ git grep "del os.environ"
install/certmonger/dogtag-ipa-ca-renew-agent-submit.in:            
del os.environ['CERTMONGER_CA_PROFILE']
ipaclient/install/ipa_certupdate.py:                del os.env
iron['KRB5CCNAME']
ipaserver/install/server/upgrade.py:            del os.environ
['KRB5CCNAME']
ipatests/test_ipaserver/test_ipap11helper.py:            del o
s.environ['SOFTHSM2_CONF']

Log in to comment on this ticket.

Metadata