fix(ota-hil): fallback date comparison#934
Draft
chrisgalanis wants to merge 13 commits intochris/ota-hilfrom
Draft
fix(ota-hil): fallback date comparison#934chrisgalanis wants to merge 13 commits intochris/ota-hilfrom
chrisgalanis wants to merge 13 commits intochris/ota-hilfrom
Conversation
d887214 to
208ddcd
Compare
This pull request introduces improvements to the OTA update process and device reboot logic, with a focus on configurability, reliability, and robustness around time synchronization and FTDI device handling. The most important changes are grouped below: **OTA Update Process Improvements:** * Added a `--skip-time-sync-before-reboot` flag to the `Ota` command, allowing users to optionally skip the NTP time synchronization check before the first reboot. Time sync is still enforced after reboot and before starting the update. [[1]](diffhunk://#diff-4417a067e971532511cd378570394d24d393625d1e510ecc9475239495917805R72-R76) [[2]](diffhunk://#diff-4417a067e971532511cd378570394d24d393625d1e510ecc9475239495917805L108-R132) * Ensured that the log directory is created or verified before starting the OTA process, improving reliability of log file handling. **Device Reboot and FTDI Handling:** * Refactored the reboot logic to use named constants for timing delays and clarified the handling of the recovery pin state, making the reboot process more maintainable and readable. [[1]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cR26-R28) [[2]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL40-R48) [[3]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL49-R68) [[4]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL77-R85) **Time Synchronization Robustness:** * Enhanced the time synchronization check to detect and use either `chronyc` or `timedatectl` (preferring `chronyc` if available), with robust error handling and command timeouts. This ensures the system waits for accurate time sync using the best available tool.
…re into chris/pearl-hil-ota
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the system time synchronization logic in
hil/src/commands/ota/system.rsby introducing a fallback mechanism when NTP/chrony-based sync fails. Instead of failing immediately, the code now compares the device's time with the local PC and allows a tolerance of up to one month. This makes the OTA process more robust to minor time discrepancies.Enhancements to time synchronization robustness:
wait_for_time_syncto log a warning and fall back to a date comparison instead of failing immediately if NTP/chrony sync does not complete.check_time_difference_fallbackfunction, which compares the Orb's time with the local PC and accepts a difference of up to 30 days. This helps avoid unnecessary failures due to minor clock drift.Logging improvements:
warnfromtracingand added more informative logging to indicate fallback behavior and time difference results. [1] [2]