mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-29 02:44:43 +00:00
Merge pull request #1142 from t-woerner/Do_not_use_del_os.environ
Do not use "del os.environ" as the variable might not exist
This commit is contained in:
@@ -226,7 +226,7 @@ def temp_kdestroy(ccache_dir, ccache_name):
|
|||||||
"""Destroy temporary ticket and remove temporary ccache."""
|
"""Destroy temporary ticket and remove temporary ccache."""
|
||||||
if ccache_name is not None:
|
if ccache_name is not None:
|
||||||
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
||||||
del os.environ['KRB5CCNAME']
|
os.environ.pop('KRB5CCNAME', None)
|
||||||
if ccache_dir is not None:
|
if ccache_dir is not None:
|
||||||
shutil.rmtree(ccache_dir, ignore_errors=True)
|
shutil.rmtree(ccache_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
get_ca_certs(fstore, options, servers[0], basedn, realm)
|
get_ca_certs(fstore, options, servers[0], basedn, realm)
|
||||||
changed = True
|
changed = True
|
||||||
del os.environ['KRB5_CONFIG']
|
os.environ.pop('KRB5_CONFIG', None)
|
||||||
except errors.FileError as e:
|
except errors.FileError as e:
|
||||||
module.fail_json(msg='%s' % e)
|
module.fail_json(msg='%s' % e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ def temp_kdestroy(ccache_dir, ccache_name):
|
|||||||
"""Destroy temporary ticket and remove temporary ccache."""
|
"""Destroy temporary ticket and remove temporary ccache."""
|
||||||
if ccache_name is not None:
|
if ccache_name is not None:
|
||||||
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
||||||
del os.environ['KRB5CCNAME']
|
os.environ.pop('KRB5CCNAME', None)
|
||||||
if ccache_dir is not None:
|
if ccache_dir is not None:
|
||||||
shutil.rmtree(ccache_dir, ignore_errors=True)
|
shutil.rmtree(ccache_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ def main():
|
|||||||
get_ca_cert(fstore, options, servers[0], basedn)
|
get_ca_cert(fstore, options, servers[0], basedn)
|
||||||
else:
|
else:
|
||||||
get_ca_certs(fstore, options, servers[0], basedn, realm)
|
get_ca_certs(fstore, options, servers[0], basedn, realm)
|
||||||
del os.environ['KRB5_CONFIG']
|
os.environ.pop('KRB5_CONFIG', None)
|
||||||
except errors.FileError as e:
|
except errors.FileError as e:
|
||||||
module.fail_json(msg='%s' % e)
|
module.fail_json(msg='%s' % e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ def main():
|
|||||||
raise errors.ACIError(info="Not authorized")
|
raise errors.ACIError(info="Not authorized")
|
||||||
|
|
||||||
if installer._ccache is None:
|
if installer._ccache is None:
|
||||||
del os.environ['KRB5CCNAME']
|
os.environ.pop('KRB5CCNAME', None)
|
||||||
else:
|
else:
|
||||||
os.environ['KRB5CCNAME'] = installer._ccache
|
os.environ['KRB5CCNAME'] = installer._ccache
|
||||||
|
|
||||||
@@ -873,7 +873,7 @@ def main():
|
|||||||
if add_to_ipaservers:
|
if add_to_ipaservers:
|
||||||
# use user's credentials when the server host is not ipaservers
|
# use user's credentials when the server host is not ipaservers
|
||||||
if installer._ccache is None:
|
if installer._ccache is None:
|
||||||
del os.environ['KRB5CCNAME']
|
os.environ.pop('KRB5CCNAME', None)
|
||||||
else:
|
else:
|
||||||
os.environ['KRB5CCNAME'] = installer._ccache
|
os.environ['KRB5CCNAME'] = installer._ccache
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ def temp_kdestroy(ccache_dir, ccache_name):
|
|||||||
"""Destroy temporary ticket and remove temporary ccache."""
|
"""Destroy temporary ticket and remove temporary ccache."""
|
||||||
if ccache_name is not None:
|
if ccache_name is not None:
|
||||||
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
|
||||||
del os.environ['KRB5CCNAME']
|
os.environ.pop('KRB5CCNAME', None)
|
||||||
if ccache_dir is not None:
|
if ccache_dir is not None:
|
||||||
shutil.rmtree(ccache_dir, ignore_errors=True)
|
shutil.rmtree(ccache_dir, ignore_errors=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user