summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-02-19 11:15:56 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-02-19 12:31:21 +0100
commit8fa2d071344675200e15b23343cc92dace0e7d65 (patch)
treeb41bcdd21ab8b9a4206705636f2910bc76423a28 /ogcp
parent6ec26d161e148d7e428ace954fb19b9edb5d4b67 (diff)
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.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py10
1 files changed, 9 insertions, 1 deletions
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