Compare commits

...

4 Commits

Author SHA1 Message Date
Alejandro Sirgo Rica 4e0bb82f9f views: skip invalid partitions in software inventory
Skip the invalid partition types in the list of selectable
partitions in software inventory.
2025-02-14 13:41:48 +01:00
Alejandro Sirgo Rica c6adc0f29b views: remove outdated ogLive checks
Remove checks for a running ogLive based on an empty client setup
reponse. The check is dead code as the partition setup is cached in
the database so the payload always constains the information.
2025-02-14 13:41:48 +01:00
Alejandro Sirgo Rica 35269b31a7 views: validate client partitions in /action/software
Redirect the user when /action/software is accessed on a client
without valid partitions.
2025-02-14 13:41:48 +01:00
Alejandro Sirgo Rica 1cf6fbc49e views: remove rendundant partition checks in image/restore
Partition validation is already performed before the removed checks
image restore, additional checks are redundant.
Remove redundant partition validation.
2025-02-14 13:39:46 +01:00
1 changed files with 11 additions and 15 deletions

View File

@ -774,10 +774,6 @@ def action_setup_show():
setup_data = get_client_setup(base_client)
if not setup_data:
flash(_('Partition information is not available. Boot client in ogLive mode to obtain it'), category='error')
return redirect(url_for('commands'))
selected_disk = 1
common_disk_data = get_common_disk_data(ips)
@ -1112,10 +1108,6 @@ def action_image_restore():
reference_patitioning = part_collection.get_partition_setup(0)
if not reference_patitioning:
flash(_(f'No valid partition found'), category='error')
return redirect(url_for('commands'))
for disk_id, part_id, part_type, fs_type, part_size in reference_patitioning:
form.partition.choices.append(
(f"{disk_id} {part_id} {part_size} {has_cache}",
@ -1124,10 +1116,6 @@ def action_image_restore():
f"{fs_type}")
)
if not form.partition.choices:
flash(_(f'No valid partition available'), category='error')
return redirect(url_for('commands'))
return render_template('actions/image_restore.html', form=form,
selected_clients=selected_clients,
scopes=scopes)
@ -1193,20 +1181,28 @@ def action_software():
server = get_server_from_clients(ips)
r = server.get('/client/setup', payload={'client': list(ips)})
if not r.json()['partitions']:
flash(_('Software inventory is not available. Boot client in ogLive mode to obtain it'), category='error')
return redirect(url_for('commands'))
invalid_part_types = get_invalid_image_partition_types()
for part in r.json()['partitions']:
part_id = part['partition']
if part_id == 0:
continue
part_type = PART_TYPE_CODES.get(int(part.get('code')), 'UNKNOWN')
if part_type in invalid_part_types:
continue
form.os.choices.append(
(f"{part.get('disk')} {part.get('partition')}",
f"Disk {part.get('disk')} | Partition {part.get('partition')} "
f"| {PART_TYPE_CODES.get(part.get('code'), 'UNKNOWN')} "
f"{FS_CODES.get(part.get('filesystem'), 'UNKNOWN')}")
)
if not form.os.choices:
flash(_(f'No valid partition available'), category='error')
return redirect(url_for('commands'))
return render_template('actions/software.html', form=form, scopes=scopes)
@app.route('/action/session', methods=['GET', 'POST'])