summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* live: check permissions when trying to fetch file via unicastv1.3.2-12OpenGnSys Support Team2024-06-271-0/+4
| | | | check sufficient permissions and bail out in case of issues.
* live: revisit error log when failing to validate checksumOpenGnSys Support Team2024-06-272-2/+5
| | | | | | | | 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.
* live: add restricted execution mode to shell/runAlejandro Sirgo Rica2024-06-251-4/+19
| | | | | | | | | | | | | | | Try to find the script to run for a shell/run request in /opt/opengnsys/shell/, restricted mode is enabled if the script is found. Excute the script without shell=True and executable=OG_SHELL in restricted mode. Restricted mode is a safer execution method as it only executes code manually defined by the administrator. Each script needs to define a shebang, this way more than just bash is supported.
* rest: add cmd field to POST /shell/runOpenGnSys Support Team2024-06-214-4/+5
| | | | | echo command that has been run for storage in ogserver, until GET /shell/output is invoked.
* rest: add retcode field to POST /shell/runOpenGnSys Support Team2024-06-214-4/+5
| | | | | | | | provide return code as result to ogserver. Update virtual mode driver to return dummy value, although this command is unimplemented, this seems to be broken due to possible TypeError when accessing result from caller.
* live: handle no cache in tiptorrent and unicast restorev1.3.2-11Alejandro Sirgo Rica2024-06-071-1/+4
| | | | | | Properly report the lack of cache partition when restoring an image using TIPTORRENT and UNICAST as methods. Abort any restore in case of no cache partition.
* utils: remove bogus cache not found error after refresh commandAlejandro Sirgo Rica2024-06-071-1/+0
| | | | | | Remove log message "Cannot find device path to cache" spamming logs during operations such as refresh in clients without CACHE partition.
* utils: fix get_image_info regressionv1.3.2-10Alejandro Sirgo Rica2024-06-032-6/+6
| | | | | | | Fix image size, permissions and creation time. Improve error report related to these parameters now showing the exact cause of the problem if any occurred during the definition of image size, file permissions or image creation time values.
* live: add winrecov partition typeOpenGnSys Support Team2024-06-021-0/+1
| | | | | DE94BBA4-06D1-4D40-A16A-BFD50179D6AC is already set in in GUID_MAP as partition code, but not in GPT_PARTTYPES.
* live: revisit logging for checksum file creationv1.3.2-9OpenGnSys Support Team2024-05-311-4/+8
| | | | | Add logging before calculating checksum to provide a hint to user on what is going on while ogClient is still busy.
* src: cleanup ogGetImageInfoAlejandro Sirgo Rica2024-05-302-18/+12
| | | | | | Rename ogGetImageInfo to get_image_info. Move code from ogOperations.py to obtain image data into get_image_info.
* src: rename legacy.py into image.pyAlejandro Sirgo Rica2024-05-302-1/+1
| | | | | legacy.py contais mostly functions related to system images. Rename the file to better represent the contents in it.
* src: stop using hardcoded paths to cache image directoryAlejandro Sirgo Rica2024-05-302-9/+8
| | | | | | 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.
* src: add cache info to the image/restore responseAlejandro Sirgo Rica2024-05-303-6/+18
| | | | | | | | | | | | | | | | Add a 'cache' field into the json payload the client sends to the server after a restore operation so the server can update the new cache contents. Resquest response structure: { ... 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] ... }
* virtual: handle copy error in image restoreAlejandro Sirgo Rica2024-05-301-3/+4
| | | | | Add a proper error report for the shutil.copy operation in image_restore() instead of silently returning.
* src: add POST cache/delete methodAlejandro Sirgo Rica2024-05-306-0/+74
| | | | | | | | | | | | | | | | | | | | Add API REST method to delete cache contents. Resquest payload structure: { 'images': ['windows.img', 'linux.img'] } The client will try to delete as many images in cache as available with names matching the list of filenames in the 'images' field. Resquest response structure: { 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] }
* live: add cache contents to the /refresh payloadAlejandro Sirgo Rica2024-05-301-1/+41
| | | | | | | | | | | | | | | | | Add the list of images in the client's cache partition in the payload sent to the server. The information sent is a list of {image_name, img_size, checksum} elements where img_size is the size of the respective image in bytes. Resquest response structure: { ... 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] ... }
* utils: cache: redefine cache path constantsAlejandro Sirgo Rica2024-05-271-8/+9
| | | | | | | | | Rename OGIMG as OG_IMAGE_PATH. Rename OGCACHE_MOUNTPOINT as OG_CACHE_PATH. Define OG_CACHE_IMAGE_PATH as OG_CACHE_PATH + OG_IMAGE_PATH. This will serve to have a unique point to obtain cache related paths.
* live: remove unused return value in image_restore()OpenGnSys Support Team2024-05-271-2/+1
| | | | Never used what configureOs() returns, remove it.
* live: incorrect reference to image checksum file in logsOpenGnSys Support Team2024-05-251-1/+1
| | | | checksum file name end by .img.full.sum, not .full.sum
* live: rename variable that stores json body in refresh()OpenGnSys Support Team2024-05-211-5/+5
| | | | Just a simple cleanup.
* live: parttypes: add EFI partition type in MBR partition schemeOpenGnSys Support Team2024-05-141-0/+1
| | | | Add 0xef partition type for EFI in MBR.
* live: partcodes: remove reference to websiteOpenGnSys Support Team2024-05-141-1/+0
| | | | Remove reference to external website in code.
* utils: rename cache_probe() to get_cache_dev_path()OpenGnSys Support Team2024-05-093-8/+11
| | | | | | | | This method reports the /dev path to cache partition, rename it. Add explicit check if blkid is successful. And add logging to report that device path to cache is not found.
* 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 mkdir error report in mount_mkdirAlejandro Sirgo Rica2024-05-071-1/+5
| | | | | | Add exception checks to the os.mkdir operation and log the error found. The previous implementation was too optimistic and only handled mount related errors.
* utils: remove unused json importAlejandro Sirgo Rica2024-05-071-1/+0
| | | | | The json library was a dependency during the development of the boot OS functions and it is no longer needed in that file.
* utils:fs: fix logging statement in get_filesystem_typeAlejandro Sirgo Rica2024-05-071-1/+1
| | | | | Call the error() logging function from the logging object instead of the non existent log variable previously referenced.
* utils:fs: add mkfs logs when return code is not 0Alejandro Sirgo Rica2024-05-071-12/+24
| | | | | | Report mkfs failure for every partition. This does not raise an exception as that would skip partprobe operations and the mkfs operations in the next potentially well formated partitions.
* live: report LINUX-SWAP instead of SWAPv1.3.2-8OpenGnSys Support Team2024-05-071-0/+3
| | | | | | | ogCP expects LINUX-SWAP to specify a swap filesystem. Add a similar workaround to the one that is done for VFAT for symmetry between inputs and outputs that circulate over the API.
* live: rewrite log in case tiptorrent client failsOpenGnSys Support Team2024-05-061-1/+1
| | | | | Specify that image file cannot be found in cache because tiptorrent has failed, otherwise it is confusing.
* live: restore partprobe before building filesystemOpenGnSys Support Team2024-05-061-1/+4
| | | | Otherwise mkfs silently fails because OS reports out-of-sync partition table.
* live: force flush to disk after partition table is writtenOpenGnSys Support Team2024-05-061-0/+1
|
* live: partprobe breaks with mounted partitionsOpenGnSys Support Team2024-05-061-2/+11
| | | | | | | | | | partprobe requires that all disk partitions are unmounted. partprobe needs to be called to report the OS that the partition table has changed, otherwise ogclient reports incorrect partition information. iterate over the partition list and mount cache after partprobe is called.
* live: umount all partitions before partition setupOpenGnSys Support Team2024-05-061-2/+3
| | | | | If new partition layout is specified, unmount cache and any other partition under /mnt.
* live: fix omited error report in tip_client_getAlejandro Sirgo Rica2024-05-061-7/+6
| | | | | | | tip_client_get raises the proper error exceptions but the except block in _restore_image_tiptorrent overwrites the reported error. Move the raise statements in _restore_image_tiptorrent outside of the except block.
* live: add fat32 to get_parttype()OpenGnSys Support Team2024-04-231-0/+2
| | | | | | Use "Microsoft basic data partition" to store FAT32 in case of GPT partition scheme and 0xB according in case of MBR partition scheme according to documentation.
* live: revisit logging for partition setup, image create and restoreOpenGnSys Support Team2024-04-231-7/+5
|
* utils: add logging for checksum validationOpenGnSys Support Team2024-04-221-3/+9
| | | | Display if checksum validation is correct or not.
* utils: fs: incorrect indentationOpenGnSys Support Team2024-04-221-1/+1
|
* utils: fs: skip shrink/extend operation for fatOpenGnSys Support Team2024-04-191-0/+4
| | | | fat does not support this operation, skip it
* utils: fs: remove unused variable in _reduce_resize2fsv1.3.2-7OpenGnSys Support Team2024-04-191-1/+0
| | | | ret is set but never used in this method
* utils: fs: report error when failing to growOpenGnSys Support Team2024-04-191-2/+2
| | | | not really a warning, report an error instead
* utils: fs: set return value in ogReduceFsOpenGnSys Support Team2024-04-191-2/+3
| | | | | | | | otherwise error path uses uninitialized variable File "/opt/opengnsys/ogClient/src/utils/fs.py", line 112, in ogReduceFs return ret UnboundLocalError: local variable 'ret' referenced before assignment
* live: improve exception handling in image_createAlejandro Sirgo Rica2024-04-031-27/+34
| | | | | | | | | | | | | | | | | Reduce the scope of the try except block that controls the case of deleting the image backup in case of error. Now it only covers the section of code after backup creation and up to image verification. Check when the Exception is an OgError to raise with added context. Prevent the deletion of the target image in case of error before the backup creation. Bundle the backup creation on its own try except block to give more feedback on a failed backup creation. Enables a better error management allowing unhandled exceptions to be reported properly.
* src: use explicit exception types in except Exception blocksAlejandro Sirgo Rica2024-04-033-6/+6
| | | | | | | | Capture only the relevant exception types in each except block. The capture of the Exception type means hiding information for unhandled error cases, even for syntax errors in the codebase. Using a more fine grained exception filtering improves error traceability.
* src: log backtrace in unhandled error casesAlejandro Sirgo Rica2024-04-0315-93/+110
| | | | | | | | | | | | | | | | | | | 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.
* qmp: incorrect copyright headerOpenGnSys Support Team2024-04-021-7/+5
| | | | Replace incorrect copyright header in qmp.py file.
* utils: refine log when booting windows UEFI from DOS partitionOpenGnSys Support Team2024-04-011-1/+1
| | | | | | Refine 97647c32aa2c utils: add enforce_gpt argument to get_efi_partition() to provide more explicit error when trying to boot Windows UEFI from DOS partition.