allnet: fix dli report logging

This commit is contained in:
Hay1tsme 2023-11-04 12:41:47 -04:00
parent dde397a96c
commit a7b0b1be49

View File

@ -394,7 +394,7 @@ class AllnetServlet:
self.logger.warning(f"Failed to parse DL Report: Invalid format - {rep.err}") self.logger.warning(f"Failed to parse DL Report: Invalid format - {rep.err}")
return "NG" return "NG"
msg = f"{rep.serial} @ {client_ip} reported {rep.__type.name} download state {rep.rf_state.name} for {rep.gd} v{rep.dav}:"\ msg = f"{rep.serial} @ {client_ip} reported {rep.rep_type.name} download state {rep.rf_state.name} for {rep.gd} v{rep.dav}:"\
f" {rep.tdsc}/{rep.tsc} segments downloaded for working files {rep.wfl} with {rep.dfl if rep.dfl else 'none'} complete." f" {rep.tdsc}/{rep.tsc} segments downloaded for working files {rep.wfl} with {rep.dfl if rep.dfl else 'none'} complete."
self.data.base.log_event("allnet", "DL_REPORT", logging.INFO, msg, dl_data) self.data.base.log_event("allnet", "DL_REPORT", logging.INFO, msg, dl_data)
@ -807,7 +807,7 @@ class DLReport:
self.wdav = data.get("wdav") # app only self.wdav = data.get("wdav") # app only
self.dov = data.get("dov") self.dov = data.get("dov")
self.wdov = data.get("wdov") # app only self.wdov = data.get("wdov") # app only
self.__type = report_type self.rep_type = report_type
self.err = "" self.err = ""
def validate(self) -> bool: def validate(self) -> bool:
@ -843,11 +843,11 @@ class DLReport:
self.err = "dov not provided" self.err = "dov not provided"
return False return False
if (self.wdav is None or self.wdov is None) and self.__type == DLIMG_TYPE.app: if (self.wdav is None or self.wdov is None) and self.rep_type == DLIMG_TYPE.app:
self.err = "wdav or wdov not provided in app image" self.err = "wdav or wdov not provided in app image"
return False return False
if (self.wdav is not None or self.wdov is not None) and self.__type == DLIMG_TYPE.opt: if (self.wdav is not None or self.wdov is not None) and self.rep_type == DLIMG_TYPE.opt:
self.err = "wdav or wdov provided in opt image" self.err = "wdav or wdov provided in opt image"
return False return False