diff --git a/client/lib/engine/bin/StringLib.py b/client/lib/engine/bin/StringLib.py index 49505d2..eda1c93 100755 --- a/client/lib/engine/bin/StringLib.py +++ b/client/lib/engine/bin/StringLib.py @@ -1,31 +1,5 @@ import re -def ogCheckStringInGroup(element, group): - """ - Función para determinar si el elemento pertenece a un conjunto. - - :param element: elemento a comprobar - :param group: grupo de elementos para comprobar tipo "valor1 valor2 valor3" - :return: True si pertenece al grupo, False si NO pertenece al grupo - """ - if not isinstance(element, str) or not isinstance(group, str): - raise ValueError("Formato incorrecto, ambos parámetros deben ser cadenas.") - - return element in group.split() - -def ogCheckStringInReg(element, regex): - """ - Función para determinar si el elemento contiene una "expresión regular". - - :param element: elemento a comprobar - :param regex: expresión regular - :return: True si coincide con la expresión, False si NO coincide con la expresión - """ - if not isinstance(element, str) or not isinstance(regex, str): - raise ValueError("Formato incorrecto, ambos parámetros deben ser cadenas.") - - return re.match(regex, element) is not None - #/** diff --git a/client/lib/engine/bin/SystemLib.py b/client/lib/engine/bin/SystemLib.py index 811ddcd..9524949 100755 --- a/client/lib/engine/bin/SystemLib.py +++ b/client/lib/engine/bin/SystemLib.py @@ -236,15 +236,17 @@ def ogRaiseError (logtypes, code, msg): MSG = ogGlobals.lang.MSG_ERR_GENERIC CODE = ogGlobals.OG_ERR_GENERIC + # Obtener lista de funciones afectadas, incluyendo el script que las llama. call_stack = [i[3] for i in inspect.stack()] if len (call_stack) < 2: return ## shouldn't happen call_stack.pop() ## remove '' call_stack.pop(0) ## remove 'ogRaiseError' str_call_stack = ' '.join (call_stack) + # Mostrar mensaje de error si es función depurable y salir con el código indicado. if code == ogGlobals.OG_ERR_FORMAT or \ - StringLib.ogCheckStringInGroup (str_call_stack, ogGlobals.NODEBUGFUNCTIONS) or \ - not (len(call_stack)>0 and StringLib.ogCheckStringInGroup (call_stack[0], ogGlobals.NODEBUGFUNCTIONS)): + (str_call_stack in ogGlobals.NODEBUGFUNCTIONS) or \ + not (len(call_stack)>0 and (call_stack[0] in ogGlobals.NODEBUGFUNCTIONS)): ogEcho (logtypes, "error", f"{str_call_stack.replace(' ', '<-')}: {MSG}") return code diff --git a/client/lib/engine/bin/ogGlobals.py b/client/lib/engine/bin/ogGlobals.py index 41b0d4b..cbce1ff 100755 --- a/client/lib/engine/bin/ogGlobals.py +++ b/client/lib/engine/bin/ogGlobals.py @@ -45,7 +45,7 @@ MCASTWAIT=30 # timeout (segundos) para abortar la la tran #BACKUP=False # Realizar copia de seguridad antes de crear la imagen. #IMGFS='EXT4' # Sistema de archivo de la imagenes sincronizadas. EXT4 o BTRFS #OGSLEEP=20 # Tiempo de sleep antes de realizar el reboot -NODEBUGFUNCTIONS='ogCreateImageSyntax ogGetHivePath ogGetOsType ogRestoreImageSyntax ogUnmountAll ogUnmountCache' # Funciones que no deben mostrar salida de avisos si son llamadas por otras funciones. +NODEBUGFUNCTIONS=['ogCreateImageSyntax', 'ogGetHivePath', 'ogGetOsType', 'ogRestoreImageSyntax', 'ogUnmountAll', 'ogUnmountCache'] # Funciones que no deben mostrar salida de avisos si son llamadas por otras funciones. #DEFAULTSPEED='' ## /engine.cfg