Skip to content

Commit

Permalink
add exist_ok=True
Browse files Browse the repository at this point in the history
  • Loading branch information
doomedraven committed Mar 21, 2024
1 parent 9d3ce80 commit c801ad0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def do_mkdir():
try:
mode = int(request.form.get("mode", 0o777))

os.makedirs(request.form["dirpath"], mode=mode)
os.makedirs(request.form["dirpath"], mode=mode, exist_ok=True)
except Exception as ex:
print(f"error creating dir {ex}")
return json_exception("Error creating directory")
Expand Down
2 changes: 1 addition & 1 deletion web/apiv2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def tasks_status(request, task_id):
complete_folder = hashlib.md5(f"cape-{task_id}".encode()).hexdigest()
# ToDo proper OS version join
dest_folder = f"{guest_env['environ']['TMP']}\\{complete_folder}"
r = requests.post(f"http://{machine.ip}:8000/mkdir", data={"dirpath": dest_folder})
r = requests.post(f"http://{machine.ip}:8000/mkdir", data={"dirpath": dest_folder}, exist_ok=True)
resp = {"error": r.status_code == 200, "data": r.text}
except requests.exceptions.ConnectionError as e:
log.error(e)
Expand Down

0 comments on commit c801ad0

Please sign in to comment.