From 8fa2d071344675200e15b23343cc92dace0e7d65 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Mon, 19 Feb 2024 11:15:56 +0100 Subject: views: call POST /refresh from get_client_setup() Refresh the disk layout before any command that displays it, no need to manually call command -> refresh. this cannot be skipped, POST /setup is an asynchronous invocation in ogserver is asynchronous, POST /refresh provides the existing disk layout, otherwise it shows the existing layout in the database which is not complete. this is also good in case someone manipulates the disk from the command line. --- ogcp/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ogcp/views.py b/ogcp/views.py index 2dbe342..42dd160 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -120,8 +120,16 @@ def parse_elements(checkboxes_dict): return elements def get_client_setup(ip): - payload = {'client': [ip]} server = get_server_from_clients([ip]) + + payload = {'clients': [ip]} + r = server.post('/refresh', payload) + if not r: + raise ServerError + if r.status_code != requests.codes.ok: + raise ServerErrorCode + + payload = {'client': [ip]} r = server.get('/client/setup', payload) if not r: raise ServerError -- cgit v1.2.3-18-g5258