refs #2414 fail early when requested some wrong scenarios

particionador
Natalia Serrano 2025-07-10 14:44:37 +02:00
parent df36d74d7c
commit 9e7fda8944
1 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,6 @@
import os
import sys
import subprocess
import ogGlobals
import SystemLib
@ -80,6 +79,7 @@ sparams = sparam.split('%')
maxp=0
sum_tam = 0
do_sum_tam = True
cache_seen = extended_seen = False
for item in sparams:
if not item: continue ## por si nos pasan un '%' al final de todo
# Leer datos de la partición, separados por "*".
@ -110,12 +110,20 @@ for item in sparams:
# Componer datos de particionado.
if 'CACHE' == cpt:
if cache_seen:
SystemLib.ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'se ha solicitado más de una partición de cache')
sys.exit (1)
cache_seen = True
tch = tam
else:
tbp.append (f'{cpt}:{tam}')
if do_sum_tam:
sum_tam += tam
if 'EXTENDED' == cpt:
if extended_seen:
SystemLib.ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'se ha solicitado más de una partición extendida')
sys.exit (1)
extended_seen = True
do_sum_tam = False ## don't sum sizes anymore
if ope:
@ -133,6 +141,10 @@ if is_there_cache and 0 == tch:
if not cache_seen and not tbp:
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'No se ha solicitado ninguna partición')
sys.exit (1)
cur_ptt = DiskLib.ogGetPartitionTableType (dis)
ptt = 'GPT' if InventoryLib.ogIsEfiActive() else 'MSDOS'
recreate_partition_table = False