refs #2691 put InventarioHardware to work #60
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -6,6 +6,18 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [8.3.0] - 2025-08-29
|
||||
|
||||
### Changed
|
||||
|
||||
- Put InventarioHardware to work
|
||||
|
||||
## [8.2.0] - 2025-08-29
|
||||
|
||||
### Changed
|
||||
|
||||
- Do git stuffs
|
||||
|
||||
## [8.1.1] - 2025-08-28
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -632,47 +632,25 @@ class ogAdmClientWorker (ogLiveWorker):
|
|||
return self.respuestaEjecucionComando (cmd, herror, ids)
|
||||
|
||||
def do_InventarioHardware (self, post_params):
|
||||
for k in ['nfn', 'ids']:
|
||||
if k not in post_params:
|
||||
logger.error (f'required parameter ({k}) not in POST params')
|
||||
return {}
|
||||
|
||||
nfn = post_params['nfn']
|
||||
ids = post_params['ids']
|
||||
|
||||
self.muestraMensaje (6)
|
||||
|
||||
hrdsrc = f'/tmp/Chrd-{self.IPlocal}' ## Nombre que tendra el archivo de inventario
|
||||
hrddst = f'/tmp/Shrd-{self.IPlocal}' ## Nombre que tendra el archivo en el Servidor
|
||||
try:
|
||||
self.interfaceAdmin (nfn, [hrdsrc])
|
||||
self.interfaceAdmin ('InventarioHardware', [hrdsrc])
|
||||
hrdsrc_contents = Path (hrdsrc).read_bytes()
|
||||
logger.debug (f'hrdsrc_contents 1 ({hrdsrc_contents})')
|
||||
herror = 0
|
||||
except:
|
||||
logger.warning ('Error al ejecutar el comando')
|
||||
self.muestraMensaje (18)
|
||||
herror = 1
|
||||
|
||||
if herror:
|
||||
hrddst = ''
|
||||
else:
|
||||
logger.debug (f'hrdsrc_contents 2 ({hrdsrc_contents})')
|
||||
## Envía fichero de inventario al servidor
|
||||
res = self.enviaMensajeServidor ('recibeArchivo', { 'nfl': hrddst, 'contents': base64.b64encode (hrdsrc_contents).decode ('utf-8') })
|
||||
logger.debug (res)
|
||||
if not res:
|
||||
logger.error ('Ha ocurrido algún problema al enviar un archivo por la red')
|
||||
herror = 12 ## Error de envío de fichero por la red
|
||||
self.muestraMensaje (17)
|
||||
cmd = {}
|
||||
|
||||
if not herror:
|
||||
cmd['hrd'] = base64.b64encode (hrdsrc_contents).decode ('utf-8')
|
||||
|
||||
## Envia respuesta de ejecución de la función de interface
|
||||
cmd = {
|
||||
'nfn': 'RESPUESTA_InventarioHardware',
|
||||
'hrd': hrddst,
|
||||
}
|
||||
self.muestraMenu()
|
||||
return self.respuestaEjecucionComando (cmd, herror, ids)
|
||||
return self.respuestaEjecucionComando (cmd, herror)
|
||||
|
||||
def do_InventarioSoftware (self, post_params):
|
||||
for k in ['nfn', 'dsk', 'par', 'ids']:
|
||||
|
@ -1049,7 +1027,7 @@ class ogAdmClientWorker (ogLiveWorker):
|
|||
@check_secret
|
||||
def process_InventarioHardware (self, path, get_params, post_params, server):
|
||||
logger.debug ('in process_InventarioHardware, path "{}" get_params "{}" post_params "{}" server "{}"'.format (path, get_params, post_params, server))
|
||||
return self._long_running_job ('InventarioHardware', self.do_InventarioHardware, args=(post_params,))
|
||||
return self.do_InventarioHardware (post_params)
|
||||
|
||||
@execution_level('full')
|
||||
@check_secret
|
||||
|
|
Loading…
Reference in New Issue