Skip to content

Commit 1682af1

Browse files
Add json file but no track modification
1 parent 6a24ea8 commit 1682af1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

backend/proxmox_api/util.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def check_dns_entry(entry:str) -> bool:
213213
:rtype: Tuple[str, str, str]
214214
"""
215215
def get_vm_state(vmid) :
216-
with open(config.VM_CREATION_STATUS_JSON, mode='a') as jsonFile:
216+
with open(config.VM_CREATION_STATUS_JSON, mode='r') as jsonFile:
217217
jsonObject = json.load(jsonFile)
218218
jsonFile.close()
219219
try :
@@ -250,7 +250,7 @@ def get_vm_state(vmid) :
250250
:rtype: bool
251251
"""
252252
def update_vm_state(vmid, message, errorCode = 0, deleteEntry = False) -> bool:
253-
with open(config.VM_CREATION_STATUS_JSON, mode='a') as jsonFile:
253+
with open(config.VM_CREATION_STATUS_JSON, mode='r') as jsonFile:
254254
jsonObject = json.load(jsonFile)
255255
jsonFile.close()
256256

@@ -267,6 +267,7 @@ def update_vm_state(vmid, message, errorCode = 0, deleteEntry = False) -> bool:
267267
jsonObject[vmid]["errorMessage"] = message
268268
with open(config.VM_CREATION_STATUS_JSON, "w") as outfile:
269269
json.dump(jsonObject, outfile)
270+
outfile.close()
270271
return True
271272
except Exception as e:
272273
print("An error occured while updating the vm creation status dict : " , e)

0 commit comments

Comments
 (0)