Fixed open tempfile.NamedTemporaryFile as text in Python3
Python3 opens tempfile by default as binary[1] and not as ascii, and nvmetcli writes json output as ascii. This issue was overlooked with Python2, since binary and ascii variables are less distiguished there. [1] https://docs.python.org/3/library/tempfile.html [2] https://bugs.python.org/issue29245 Change-Id: Ia1f280ab64f0dc90824d4cb9ed20a8537af32ef6 Closes-Bug: 1855855
This commit is contained in:
parent
40c3e4b34c
commit
195e12b1c1
|
@ -83,7 +83,7 @@ class NVMET(nvmeof.NVMeOF):
|
|||
|
||||
def _restore(self, nvmf_subsystems):
|
||||
# Dump updated JSON dict to append new subsystem
|
||||
with tempfile.NamedTemporaryFile() as tmp_fd:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as tmp_fd:
|
||||
tmp_fd.write(json.dumps(nvmf_subsystems))
|
||||
tmp_fd.flush()
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue