diff options
-rw-r--r-- | ogcp/views.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index e3f1626..a0dface 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -503,7 +503,17 @@ def action_setup_select(): form = SelectClientForm() form.ips.data = " ".join(ips) - form.selected_client.choices = list(ips) + + server = get_server_from_clients(list(ips)) + client_choices = [] + for ip in ips: + r = server.get('/client/info', payload={'client': [ip]}) + if r.status_code != requests.codes.ok: + flash(('Cannot talk to ogserver. Is ogserver down?'), category='error') + return redirect(url_for('commands')) + client_name = r.json()['name'] + client_choices.append((ip, f"{client_name} ({ip})")) + form.selected_client.choices = client_choices scopes, _ = get_scopes(ips) selected_clients = list(get_selected_clients(scopes['scope']).items()) |