refs #946 return cfg as json, not the legacy text string
parent
376dec466f
commit
a2df6afda7
|
@ -318,7 +318,7 @@ class ogAdmClientWorker (ogLiveWorker):
|
||||||
'nfn': 'RESPUESTA_status',
|
'nfn': 'RESPUESTA_status',
|
||||||
'mac': self.mac,
|
'mac': self.mac,
|
||||||
'ip': self.IPlocal,
|
'ip': self.IPlocal,
|
||||||
'cfg': cfg,
|
'cfg': self.cfg2obj (cfg),
|
||||||
'threads': thr_status,
|
'threads': thr_status,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,30 @@ class ogLiveWorker(ServerWorker):
|
||||||
logger.debug ('parametroscfg ({})'.format (parametroscfg))
|
logger.debug ('parametroscfg ({})'.format (parametroscfg))
|
||||||
return parametroscfg
|
return parametroscfg
|
||||||
|
|
||||||
|
def cfg2obj (self, cfg):
|
||||||
|
obj = []
|
||||||
|
ptrPar = cfg.split ('\n')
|
||||||
|
for line in ptrPar:
|
||||||
|
elem = {}
|
||||||
|
ptrCfg = line.split ('\t')
|
||||||
|
|
||||||
|
## Si la 1ª línea solo incluye el número de serie del equipo; actualizar BD.
|
||||||
|
#if es_la_primera_iteracion and 1 == len (ptrCfg):
|
||||||
|
# elem['ser'] = ptrCfg[0].split ('=')[1]
|
||||||
|
# continue ## si hemos entrado en este if, entonces no hacemos todo lo demas de particiones y tal: iteramos el bucle de nuevo
|
||||||
|
|
||||||
|
elem['disk'] = ptrCfg[0].split ('=')[1] ## Número de disco
|
||||||
|
elem['par'] = ptrCfg[1].split ('=')[1] ## Número de partición
|
||||||
|
elem['cpt'] = ptrCfg[2].split ('=')[1] or 0 ## Código de partición
|
||||||
|
elem['sfi'] = ptrCfg[3].split ('=')[1] ## Sistema de ficheros
|
||||||
|
elem['soi'] = ptrCfg[4].split ('=')[1] ## Nombre del S.O. instalado
|
||||||
|
elem['tam'] = ptrCfg[5].split ('=')[1] ## Tamaño de la partición
|
||||||
|
elem['uso'] = ptrCfg[6].split ('=')[1] ## Porcentaje de uso del S.F.
|
||||||
|
|
||||||
|
obj.append (elem)
|
||||||
|
|
||||||
|
return obj
|
||||||
|
|
||||||
def onActivation (self):
|
def onActivation (self):
|
||||||
if not os.path.exists ('/scripts/oginit'):
|
if not os.path.exists ('/scripts/oginit'):
|
||||||
## no estamos en oglive, este modulo no debe cargarse
|
## no estamos en oglive, este modulo no debe cargarse
|
||||||
|
|
Loading…
Reference in New Issue