Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

config temp file check existence #119

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ def _create_temp_file_with_content(content):
# Because we may change context several times, try to remember files we
# created and reuse them at a small memory cost.
content_key = str(content)
if content_key in _temp_files:
return _temp_files[content_key]
temp_file_name = _temp_files.get(content)
if temp_file_name and os.path.isfile(temp_file_name):
return temp_file_name
_, name = tempfile.mkstemp()
_temp_files[content_key] = name
with open(name, 'wb') as fd:
Expand Down