refs #634 - Modify 'getRepoStatus.py' and documentation

pull/6/head
Gerardo GIl Elizeire 2024-11-20 12:50:32 +01:00
parent e49bde25e3
commit d1fa8a6037
3 changed files with 5 additions and 5 deletions

View File

@ -116,7 +116,7 @@ curl -X GET -H "Authorization: $API_KEY" http://example.com/ogrepository/v1/stat
"udp-sender": "stopped",
"uftp": "stopped",
"bttrack": "stopped",
"btlaunchmany": "stopped"
"btlaunchmany.bittornado": "stopped"
}
}
```

View File

@ -138,7 +138,7 @@ paths:
bttrack:
type: string
example: "stopped"
btlaunchmany:
btlaunchmany.bittornado:
type: string
example: "stopped"
"500 (Error)":

View File

@ -59,10 +59,10 @@ def get_service_status(service):
def get_process_status(process):
""" Obtiene y retorna el estado del proceso que recibe como parámetro.
"""
#for proc in psutil.process_iter(['pid', 'name', 'status']):
for proc in psutil.process_iter(['name']):
if proc.info['name'] == process:
if proc.info['name'] in process:
return 'running'
# Esto no debe ir asociado a un "else" (porque comprueba todos los procesos):
return 'stopped'
@ -88,7 +88,7 @@ def main():
services_status = {service: get_service_status(service) for service in service_list}
# Obtenemos el estado de los procesos listados, que almacenamos en un diccionario:
process_list = ['udp-sender', 'uftp', 'bttrack', 'btlaunchmany']
process_list = ['udp-sender', 'uftp', 'bttrack', 'btlaunchmany.bittornado']
process_status = {process: get_process_status(process) for process in process_list}
# Creamos un diccionario con toda la información obtenida: