summaryrefslogtreecommitdiffstats
path: root/src/live
Commit message (Collapse)AuthorAgeFilesLines
* live: improve part not found log in image_createAlejandro Sirgo Rica2024-10-081-1/+1
| | | | Report the partition number of the missing partition.
* src: fix cache mount in new ogLiveAlejandro Sirgo Rica2024-10-081-1/+7
| | | | | | | Mount cache in image_create() image_restore() and cache_fetch(). Remove init_cache() and ensure /opt/opengnsys/images/ exists within the cache mountpoint if it does not exists in cache_mount().
* live: remove useless check in compute_md5OpenGnSys Support Team2024-10-051-2/+0
| | | | this never returns -1 on error, an exception is rised instead
* src: consolidate compute_md5 functionsAlejandro Sirgo Rica2024-10-021-17/+1
| | | | | | | | | | Add compute_md5 function in src/utils/fs.py Remove identical md5 functions from src/live/ogOperations.py and src/utils/tiptorrent.py Move error checks from ogOperations.py into compute_md5 function in src/utils/fs.py
* src: check if the system is hibernated before /image/createAlejandro Sirgo Rica2024-10-021-0/+10
| | | | | | | Mount the system partition in readonly mode and check for the hiberfil.sys file if the target system is a Windows. Fail the image creation process if the target system is hibernated.
* live: refactor poweroff and rebootOpenGnSys Support Team2024-10-011-14/+40
| | | | | | - enable WoL - check for poweroff and reboot before checking for busybox. - call new shutdown method
* live: fix EBUSY error in newer kernels with mkfsOpenGnSys Support Team2024-10-011-19/+21
| | | | | | | | | | | | python-libfdisk does not close file descriptor to /dev/sda after completing partitioning. This results EBUSY errors when formatting partitions with mkfs in newer kernels. Encapsulate code to partition in method so python garbage collection knows ctx objects can be release then close file descritor to /dev/sda. ogRest is not accessible from _partition(), remove check to ogRest.terminated, actually no need to terminate inmediately when formatting is ongoing, better leave things in consistent state when stop command is received.
* live: report correct partition size unit in setup() logAlejandro Sirgo Rica2024-10-011-1/+1
| | | | Log the correct partition size unit. Use MiB instead of MB.
* src: replace DEVICE env variable with get_ethernet_interface()Alejandro Sirgo Rica2024-10-011-3/+3
| | | | | | Use a python function to obtain the main net interface. Detect the first ethernet inferface in use. Stop using the DEVICE environment variable.
* live: remove unused probeOpenGnSys Support Team2024-09-301-8/+0
| | | | unused since ogserver's commit 87be2ce08 #980 Change initial probe to refresh
* live: use busybox otherwise poweroff/reboot commandsOpenGnSys Support Team2024-09-301-4/+4
|
* live: disable browser operations if the binary is missingAlejandro Sirgo Rica2024-09-271-1/+4
| | | | | Add shutils.which checks before every browser operations to skip the subprocess call if the binary is missing.
* src: report used and free partition data in bytesAlejandro Sirgo Rica2024-09-251-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Add "used_size" and "free_size" to the partition data and the cache data. Old response from ogClient for /cache/delete, /cache/fetch and /image/restore: { 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] } New response: { 'cache': { 'used_size': 4520232322423, 'free_size': 48273465287452945, 'images': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] } }
* src: verify the fields of the efibootmgr json in /refreshAlejandro Sirgo Rica2024-09-251-3/+3
| | | | | | | Don't send the efi data in the /refresh payload if efibootmgr is missing any of the json keys. Log the missing keys in case of missing some.
* live: add boot entries into /refresh payloadAlejandro Sirgo Rica2024-09-101-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Add 'efi' key into the refresh payload. The value for that key has the following structure: 'efi': { 'entries': [ { "order": 0, "name": "Boot0000", "active": false, "description": "grub" }, { "order": 1, "name": "Boot0001", "active": true, "description": "UEFI: PXE IP4 Realtek PCIe GBE Family Controller" } ] } If the client is not a EFI system it won't add the 'efi' field. If an entry is not in the boot order it won't have the 'order' field.
* live: use correct variable name in restore unicast cachev1.3.2-18OpenGnSys Support Team2024-09-091-1/+1
| | | | | | | | | | | | | | fe40f9c5 ('src: add POST cache/fetch method') broke unicast cache restore. (2024-09-09 10:05:22) ogClient: [ERROR] - name 'image_name' is not defined Traceback (most recent call last): File "/opt/opengnsys/ogClient/src/ogRest.py", line 175, in image_restore payload = ogRest.operations.image_restore(request, ogRest) File "/opt/opengnsys/ogClient/src/live/ogOperations.py", line 520, in image_restore self._restore_image_unicast(repo, name, partdev, cache) File "/opt/opengnsys/ogClient/src/live/ogOperations.py", line 242, in _restore_image_unicast image_path = f'{OG_CACHE_IMAGE_PATH}{image_name}.img' NameError: name 'image_name' is not defined
* live: incorrect indentationv1.3.2-17OpenGnSys Support Team2024-09-031-4/+4
| | | | | f2a2f5307464 ('live: remove file from cache with no checksum file') broke indentation which breaks ogClient.
* live: add disk index bounds checkv1.3.2-16Alejandro Sirgo Rica2024-09-021-4/+10
| | | | | Add disk index bounds checks for setup() and image_create(). Prevent backtrace logging when an invalid disk index is used.
* live: remove file from cache with no checksum fileOpenGnSys Support Team2024-09-021-1/+10
| | | | | Maybe result of a partial download? then, remove it to leave cache in consistent state.
* src: append .img to log that report image fetchingOpenGnSys Support Team2024-08-291-1/+1
|
* src: use logging.warning()OpenGnSys Support Team2024-08-271-2/+2
| | | | | | | logging.warn() is deprecated since 3.3. And use .error() instead when command is unsupported or client is busy, that should not ever happen.
* live: report that up-to-date image already exists in cachev1.3.2-15OpenGnSys Support Team2024-08-211-0/+1
|
* src: remove call to restoreImageCustom scriptOpenGnSys Support Team2024-08-211-2/+3
| | | | remove call to custom version of legacy script, display warning.
* live: clean files after a failed cache image copyAlejandro Sirgo Rica2024-08-091-0/+7
| | | | Remove image files after a failed image copy operation.
* src: add POST cache/fetch methodAlejandro Sirgo Rica2024-08-091-16/+39
| | | | | | | | | | | | | | | | | | | | | | Add API REST method to fetch an image. Consolidate image fetch loging for cache/fetch and image/restore. Resquest payload structure: { 'image': 'linux.img' 'type': 'TIPTORRENT' 'repository': '12.141.10.2' } The client will try to fetch'image' from 'repository' into cache. Resquest response structure: { 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] }
* live: move filesystem expansion out of OS configurationOpenGnSys Support Team2024-08-061-0/+2
| | | | just a clean up.
* live: use correct loglevel when reporting issues with listing cache contentsv1.3.2-14OpenGnSys Support Team2024-07-311-2/+2
| | | | instead of using info to report errors.
* live: validate checksum only once if image is already in cacheOpenGnSys Support Team2024-07-301-10/+15
| | | | | | | | | | | | | if image already exists in the cache, skip a second checksum validation. log shows duplicated entries: Verifying checksum for example.img, please wait... Checksum is OK for example.img Verifying checksum for example.img, please wait... Checksum is OK for example.img because tip_check_csum() is called twice in this case.
* live: remove old image and checksum file on downloadOpenGnSys Support Team2024-07-301-1/+9
| | | | | | | 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.
* live: unicast-direct does not validate checksumOpenGnSys Support Team2024-07-301-0/+1
| | | | this restore method is unreliable, add warning to the logs.
* live: validate file existence and checksum for unicast cacheOpenGnSys Support Team2024-07-301-0/+5
| | | | | after copying file to cache, validate that file exists in cache and checksum correct.
* utils: add postinstall.pyAlejandro Sirgo Rica2024-07-291-4/+5
| | | | | | | | | | | | | | | Replace ConfigureOs script by native calls to: - update BCD via hivex using bcd.py and winreg.py infrastructure. - restore efi bootloader restore_windows_efi_bootloader(). Call legacy scripts for remaining postinstall procedures to replace them incrementally. Define variable CONFIGUREOS_LEGACY_ENABLED as False by default. Run legacy configureOs when CONFIGUREOS_LEGACY_ENABLED = True. This serves as a auxiliar method to keep the restoration functional in case of problems with the new configure_os logic.
* utils: rename ogExtendFs to extend_filesystemAlejandro Sirgo Rica2024-07-291-1/+1
| | | | Use a more consistent name format for the ogExtendFs function.
* utils: fs: error out if mkfs failsOpenGnSys Support Team2024-07-291-2/+5
| | | | | | | | | | If formatting fails, log shows: mkfs.ntfs reports return code 1 for /dev/sda2 but ogclient reports success to the ogserver. Raise an exception so front-end gets an indication that formatting has failed.
* live: improve logging for file removal from cacheOpenGnSys Support Team2024-07-211-2/+8
| | | | Provide a bit more logging to make it easier to debug issues.
* live: add logging to indicate image file copy from sambaOpenGnSys Support Team2024-07-211-0/+2
| | | | For consistency with tiptorrent download.
* live: add checksum field to image/create responseOpenGnSys Support Team2024-07-151-4/+15
| | | | Report image checksum to ogserver through HTTP response.
* 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-271-1/+1
| | | | | | | | 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-211-1/+1
| | | | | 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-211-1/+1
| | | | | | | | 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: fix get_image_info regressionv1.3.2-10Alejandro Sirgo Rica2024-06-031-1/+0
| | | | | | | 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-301-16/+1
| | | | | | 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-301-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-301-5/+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.
* src: add cache info to the image/restore responseAlejandro Sirgo Rica2024-05-301-0/+8
| | | | | | | | | | | | | | | | 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'} ] ... }