diff options
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 8a7463a..d22cc23 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1300,8 +1300,14 @@ def action_session(): valid_ips = [] excluded_ips = [] - for os, ip in zip(sessions, ips): - if os['disk'] == int(disk) and os['partition'] == int(partition) and os['name'] == os_name: + for client_sessions in sessions: + ip = client_sessions['addr'] + os_found = False + for p_data in client_sessions['partitions']: + if p_data['disk'] == int(disk) and p_data['partition'] == int(partition) and p_data['name'] == os_name: + os_found = True + break + if os_found: valid_ips.append(ip) else: excluded_ips.append(ip) @@ -1338,17 +1344,22 @@ def action_session(): return redirect(url_for('commands')) os_groups = {} - for os, ip in zip(sessions, ips_list): - item_key = f"{os['disk']} {os['partition']} {os['name']}" + for client_sessions in sessions: + ip = client_sessions['addr'] + for p_data in client_sessions['partitions']: + if p_data['name'] == 'unknown': + continue - if item_key in os_groups: - os_groups[item_key].append(ip) - else: - os_groups[item_key] = [ip] + item_key = f"{p_data['disk']} {p_data['partition']} {p_data['name']}" + + if item_key in os_groups: + os_groups[item_key].append(ip) + else: + os_groups[item_key] = [ip] - choice = (item_key, - f"{os['name']} (Disk:{os['disk']}, Partition:{os['partition']})") - form.os.choices.append(choice) + choice = (item_key, + f"{p_data['name']} (Disk:{p_data['disk']}, Partition:{p_data['partition']})") + form.os.choices.append(choice) scopes, clients = get_scopes(set(ips)) selected_clients = list(get_selected_clients(scopes['scope']).items()) |