| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update live shell run mode for the new REST API interface.
Evaluate the "inline" field to diferentiate between execution of
script in /opt/opengnsys/shell/ and a cmd execution.
Remove usage of echo argument of the API REST.
Update Windows and Linux mode for direct command execution.
Set OutputEncoding environment variable to 'utf-8' in Windows to
unify the encoding of stdout for the invoked programs.
Decode stdout to utf-8-sig to remove potential BOM.
While at this, remove strange legacy ;|\n\r terminator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Detect user login and logout for Linux and Windows.
Report an active interactive session through the /refresh response
so a new ogserver instance can update the session status.
Poll the session change in 5 second intervals in a thread. Use the
same event socket previously used by the old session detection
mechanism to notify a session change.
Use the method check_interactive_session_change in each
ogOperations.py to report the session status.
Return values:
None: no session changes are found
True: login
False: logout
Windows
Verify if psutil.users() has any value.
Linux
Verify all the psutil.users() asociated to a terminal.
|
|
|
|
|
|
|
|
| |
This error is bogus:
(2024-11-14 09:05:37) ogClient: [ERROR] - Partition query error for /dev/sdb: No medium found
skip if device cannot be opened instead.
|
|
|
|
| |
Fix error codepath and properly mark the operation as failed.
|
|
|
|
|
| |
this is a workaround for the new live system to make a hardware reboot
that allows UEFI to pick up, otherwise it performs a kernel reboot instead.
|
|
|
|
|
|
|
|
| |
Add update_live_cache() implementing the legacy script
updateBootCache()
Copy the ogvmlinuz and oginitrd.img files into cache after
a partition and format command with an available cache partition.
|
|
|
|
| |
no need to wait for reboot/poweroff to enable wake-on-lan.
|
|
|
|
|
|
|
|
|
|
| |
python-libfdisk does not close file descriptor until the cxt
object goes out of scope.
Define get_partition_data and get_disk_data functions to isolate
the python-libfdisk logic and return the data as an object.
Improve error handling of libfdisk operaions in refresh.
|
|
|
|
| |
Report the partition number of the missing partition.
|
|
|
|
|
|
|
| |
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().
|
|
|
|
| |
this never returns -1 on error, an exception is rised instead
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
- enable WoL
- check for poweroff and reboot before checking for busybox.
- call new shutdown method
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Log the correct partition size unit. Use MiB instead of MB.
|
|
|
|
|
|
| |
Use a python function to obtain the main net interface. Detect
the first ethernet inferface in use.
Stop using the DEVICE environment variable.
|
|
|
|
| |
unused since ogserver's commit 87be2ce08 #980 Change initial probe to refresh
|
| |
|
|
|
|
|
| |
Add shutils.which checks before every browser operations to
skip the subprocess call if the binary is missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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'}
]
}
}
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
f2a2f5307464 ('live: remove file from cache with no checksum file') broke
indentation which breaks ogClient.
|
|
|
|
|
| |
Add disk index bounds checks for setup() and image_create().
Prevent backtrace logging when an invalid disk index is used.
|
|
|
|
|
| |
Maybe result of a partial download? then, remove it to leave cache in consistent
state.
|
| |
|
|
|
|
|
|
|
| |
logging.warn() is deprecated since 3.3.
And use .error() instead when command is unsupported or client is busy, that
should not ever happen.
|
| |
|
|
|
|
| |
remove call to custom version of legacy script, display warning.
|
|
|
|
| |
Remove image files after a failed image copy operation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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'}
]
}
|
|
|
|
| |
just a clean up.
|
|
|
|
| |
instead of using info to report errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
this restore method is unreliable, add warning to the logs.
|
|
|
|
|
| |
after copying file to cache, validate that file exists in cache and checksum
correct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Use a more consistent name format for the ogExtendFs function.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Provide a bit more logging to make it easier to debug issues.
|
|
|
|
| |
For consistency with tiptorrent download.
|
|
|
|
| |
Report image checksum to ogserver through HTTP response.
|
|
|
|
| |
check sufficient permissions and bail out in case of issues.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
echo command that has been run for storage in ogserver, until GET /shell/output
is invoked.
|
|
|
|
|
|
|
|
| |
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.
|