From 9e7fda89446ba5482f2b57745fe56c2c43f2bfcd Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Thu, 10 Jul 2025 14:44:37 +0200 Subject: [PATCH] refs #2414 fail early when requested some wrong scenarios --- ogclient/interfaceAdm/Configurar.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ogclient/interfaceAdm/Configurar.py b/ogclient/interfaceAdm/Configurar.py index 63a4bf8..b613d31 100755 --- a/ogclient/interfaceAdm/Configurar.py +++ b/ogclient/interfaceAdm/Configurar.py @@ -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