From dfd38cb9020e7c86235130f4a1fc1d784c9cbb7b Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Wed, 13 Nov 2024 14:14:29 +0000 Subject: [PATCH] ota_core: fix update/rollback not sending session start status report --- src/otaclient/ota_core.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/otaclient/ota_core.py b/src/otaclient/ota_core.py index a716c82ee..9ae6e36e0 100644 --- a/src/otaclient/ota_core.py +++ b/src/otaclient/ota_core.py @@ -731,7 +731,15 @@ def update(self, request: UpdateRequestV2) -> None: return new_session_id = self._gen_session_id(request.version) - logger.info(f"{new_session_id=}") + self._status_report_queue.put_nowait( + StatusReport( + payload=OTAStatusChangeReport( + new_ota_status=OTAStatus.UPDATING, + ), + session_id=new_session_id, + ) + ) + logger.info(f"start new OTA update session: {new_session_id=}") try: logger.info("[update] entering local update...") @@ -767,6 +775,17 @@ def rollback(self): if self.is_busy: return + new_session_id = self._gen_session_id("___rollback") + self._status_report_queue.put_nowait( + StatusReport( + payload=OTAStatusChangeReport( + new_ota_status=OTAStatus.ROLLBACKING, + ), + session_id=new_session_id, + ) + ) + logger.info(f"start new OTA rollback session: {new_session_id=}") + try: logger.info("[rollback] entering...") self._live_ota_status = OTAStatus.ROLLBACKING