From b9aa011b45b1779ed571e320daf6f04f767f19be Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Pelayo Date: Tue, 11 Nov 2025 20:21:10 +0100 Subject: [PATCH] flasher driver: always set system date Otherwise, in labs where ntp is not available for the DUTs to use, time setting will be wrong and fls, or CA cert checking will fail. (cherry picked from commit aa8022a176225b24c04e0e2a7ad872e62717866d) --- .../jumpstarter_driver_flashers/client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py b/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py index f150b6fb5..e3dc92752 100644 --- a/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py +++ b/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py @@ -329,6 +329,13 @@ def _perform_flash_operation( self.logger.error(f"Error running udhcpc: {e}") raise FlashRetryableError(f"Error running udhcpc: {e}") from e + # make sure that the remote system has the right time without using NTP + # otherwise SSL certificate verification will fail + self.logger.info("Setting the remote DUT time to match the local system time") + current_timestamp = int(time.time()) + console.sendline(f"date -s @{current_timestamp}") + console.expect(manifest.spec.login.prompt, timeout=EXPECT_TIMEOUT_DEFAULT) + stored_cacert = None if should_download_to_httpd: self._wait_for_storage_thread(storage_thread, error_queue) @@ -383,12 +390,6 @@ def _setup_flasher_ssl(self, console, manifest, cacert_file: str | None) -> str Raises: RuntimeError: If there's an error reading the CA certificate file """ - # make sure that the remote system has the right time without using NTP - # otherwise SSL certificate verification will fail - self.logger.info("Setting the remote DUT time to match the local system time") - current_timestamp = int(time.time()) - console.sendline(f"date -s @{current_timestamp}") - console.expect(manifest.spec.login.prompt, timeout=EXPECT_TIMEOUT_DEFAULT) if cacert_file: cacert = b""