summaryrefslogtreecommitdiffstats
path: root/src/utils/tiptorrent.py
Commit message (Collapse)AuthorAgeFilesLines
* utils: return False instead of rising exceptionOpenGnSys Support Team2024-08-211-2/+4
| | | | | if image file and checksum are not found in the cache, then report checksum validation has failed so it can proceed to fetch new files from server.
* live: remove old image and checksum file on downloadOpenGnSys Support Team2024-07-301-0/+6
| | | | | | | Restoring an updated image file (with different checksum) could fail while the old checksum file could remain in place. Remove image and checksum file before fetching the new files.
* utils: tip_check_csum() uses local checksum fileOpenGnSys Support Team2024-07-301-4/+13
| | | | | | | | | | | | | | | | | | | .full.sum file in the local cache contains the local checksum for this file, this checksum is calculated by tip_write_csum(), therefore, there is no need to calculate this checksum again from the image file in the cache, use this checksum content instead. if .full.sum is not available, then cache is inconsistent, tip_check_csum() is called after checking if image file exists, raise an exception. checksum could mismatch in two situations: a) new image version (checksum is different) b) image is corrupted in both cases, a new fresh image needs to be retrieved. this speeds up checksum validation.
* utils: enhance logging for checksum mismatchOpenGnSys Support Team2024-07-301-0/+1
| | | | display checksum for server and local file when checksum mismatches.
* utils: consolidate logging to write checksum file to cacheOpenGnSys Support Team2024-07-211-2/+3
| | | | Move log message to function that is called both by unicast and tiptorrent.
* utils: clean up error reporting related to checksumOpenGnSys Support Team2024-07-151-2/+2
| | | | | | | | When checksum is not available, it displays: (2024-07-15 09:04:14) ogClient: [ERROR] - URL error when fetching checksum: Not Found "URL error" is leaking an internal implementation details, reword this report.
* live: revisit error log when failing to validate checksumOpenGnSys Support Team2024-06-271-1/+4
| | | | | | | | Add explicit check for .full.sum after downloading it. Rewrite errors log, one of them is misleading when checksum validation fails, it refers to missing .full.sum, but it could be a different reason.
* src: stop using hardcoded paths to cache image directoryAlejandro Sirgo Rica2024-05-301-4/+4
| | | | | | Use the constant OG_CACHE_IMAGE_PATH from cache.py to obtain the location of the directory where images are stored. This way the path can be changed from one single point.
* tiptorrent: check cache availability in tip_write_csumAlejandro Sirgo Rica2024-05-301-3/+4
| | | | | | Remove old TODO message. Check if the cache is available before trying to generate an image's checksum.
* utils: add error checks to checksum file creation in tip_write_csumAlejandro Sirgo Rica2024-05-071-2/+5
| | | | | Add a check for potential permission or IO errors during the creation of the image checksum.
* utils: add logging for checksum validationOpenGnSys Support Team2024-04-221-3/+9
| | | | Display if checksum validation is correct or not.
* src: log backtrace in unhandled error casesAlejandro Sirgo Rica2024-04-031-6/+7
| | | | | | | | | | | | | | | | | | | Log an error message in known error cases and log a backtrace otherwise. Define a new error type OgError to be used in all the 'raise' blocks to define the error message to log. The exception propagates until it reaches send_internal_server_error() where the exception type is checked. If the type is OgError we log the exception message. Logs the backtrace for other types. The initial error implementation printed a backtrace everytime an error ocurred. The next iteration changed it to only print a backtrace in a very particular case but ended up omiting too much information such as syntax errors or unknown error context. The actual implementation only logs the cases we already cover in the codebase and logs a bracktrace in the others, enabling a better debugging experience.
* src: centralize error logging into send_internal_server_errorAlejandro Sirgo Rica2024-03-211-13/+7
| | | | | | | | | | | | | | | | | | | | Use only the exception messages as the main resource for error messages. The previous error code had string duplication in the form of: logging.error('msg here') raise Exception('msg here') That approach also has the downside of having log duplication as it had the local logging.err() and a global logging.exception() inside send_internal_server_error capturing the exception message. The actual code only requires raising an exception with a proper error message. Improve exception messages to give more error context. Log every AssertionError as a backtrace. Use the 'raise Exception from e' syntax to modify the a previously raised exception 'e' into an exception with aditional context or different type. This also prevents the message that warns about newer exceptions being launch after an initial exception.
* src: improve logging messagesJose M. Guisado2023-08-011-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Some users have mistakenly reported tiptorrent problems when the process takes a long time. Specifically by rebooting or powering off the client in the middle of the md5sum computation stage, just after the tiptorrent transfer. Same problem occurs when image creation command takes a long period of time. In order to help the user understand the different stages of commands such as image creation or image restore using tiptorrent, the following changes have been made to the current logging solution: - Add log messages to warn users not to reboot or shut down the client during a tiptorrent transfer, and also during the md5sum computation stage. - Add a log message telling the user that the image creation processes have started. - Use logging.exception inside "except:" blocks to print a traceback with the log messsage. (https://docs.python.org/3/library/logging.html#logging.exception)
* src: add missing copyright noticesv1.2.8Jose M. Guisado2023-04-181-0/+8
|
* live: improve error pathsv1.2.3Jose M. Guisado2022-11-171-2/+9
| | | | | | | | | | | | | Fix error paths in live operations which do not reset the "browser" to the main page (one with the menu). Add error logging messages when: * _restartBrowser fails. * ogChangeRepo fails. Improve checksum fetch error handling. For example, when an invalid repository IP is specified.
* tiptorrent: improve raised exceptions for tip_client_getJose M. Guisado2022-09-291-4/+2
| | | | | | Raise exception when tiptorrent-client subprocess runs normally but exits with non-zero code. (For example, if download file allocation failed)
* live: rewrite image_restoreJose M. Guisado2022-09-141-6/+3
| | | | | | | | Integrates image restore command into native ogClient code. Further reduces the need for external Bash scripts. After a succesful image restore, OS configuration is still using external Bash script "osConfigure/osConfigureCustom".
* utils: add tiptorrent.pyJose M. Guisado2022-09-141-0/+90
Utility and wrapper functions related to the usage of tiptorrent. To be used by the image restore command.