summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
Commit message (Collapse)AuthorAgeFilesLines
* src: add POST cache/fetch methodAlejandro Sirgo Rica2024-08-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | 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'} ] }
* src: add POST cache/delete methodAlejandro Sirgo Rica2024-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | 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'} ] }
* Revert "#1065 linux: add systray icon"Jose M. Guisado2022-02-031-53/+0
| | | | This reverts commit 69d214f63b2aa8ef60489d56468393b70795124a.
* #1065 linux: add shell run operationJose M. Guisado2021-11-151-2/+19
| | | | | | | | | - Executed script runs with same privilege as ogClient process. - Uses subprocess.run instead of subprocess.Popen, it's a bit simpler. We can't specify executable, though. Shouldn't need so in Linux mode. - Uses shell=True, keep in mind security considerations listed at: https://docs.python.org/3/library/subprocess.html#security-considerations (shlex.quote can be used for unix shells)
* #1065 linux: add systray iconJose M. Guisado2021-11-151-0/+52
| | | | | | Adds a systray icon for linux mode. Uses pystray module. Expects a favicon.ico stored in the same folder as the main ogclient python script, but if not found a placeholder image is used.
* #1065 src: add linux modeJose M. Guisado2021-11-151-0/+46
| | | | | | | | | | | | | | | | | | | | | ogClient can run in "linux" mode. In addition to live or virtual. Serves as a substitute to the legacy ogagent, which has not received any updates since 2020/07/23. Linux mode initially supports remote reboot and poweroff. Requires updated ogServer with the Linux ogclient state. ogClient can be set up to run in linux mode by specifying it in ogclient.json: { "opengnsys": { "ip": "192.168.56.10", "port": 8889, "log": "DEBUG", "mode": "linux", ... }
* Rename 'linux' folder and operations to 'live'Jose M. Guisado2020-12-031-275/+0
| | | | | | | | | | | ogLive related operations are named inside a 'Linux' folder, also its python class is named OgLinuxOperations. Rename every 'linux' occurrence with live to further clarify this folder and operations. - OgLinuxOperations -> OgLiveOperations - src/linux/ -> src/live/ Fixes: 1377acee ('Rename 'linux' mode to 'live' mode')
* #1008 Add support to work with GPT tableJavier Sánchez Parra2020-11-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | ogClient /setup in linux mode do not support to indicate which table type the user want to use. It always supposes that the partition table is MBR/MSDOS. Add ogClient support to work with GPT tables. Add new field table type to /setup linux mode that expects a string with "MSDOS" or "GPT". Example old JSON: { "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] } Example new JSON: { "type": "GPT", "disk": "1", "cache": "0", "cache_size": "0", "partition_setup": [...] }
* #1008 Add support for several disksJavier Sánchez Parra2020-11-181-2/+2
| | | | | | | | ogClient expect to receive information of 1 disk from the Cloning Engine's script "getConfiguration". ogAdmClient, the deprecated ogLive client daemon, supported for several disk. Add ogClient support for several disk.
* #1004 Add new fields to /image/create responseJavier Sánchez Parra2020-09-101-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | Extend ogClient to include more information about the image that has been created. This patch modifies ogClient to read an info file created by image creation script, add this info to the JSON response and then remove the file. Example of new /image/create response: { "disk": "1", "partition": "1", "code": "131", "id": "1", "name": "ubuntu", "repository": "192.168.56.10", "software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...", "clonator": "PARTCLONE", "compressor": "LZOP", "filesystem": "EXTFS", "datasize": 2100000 } New fields are "clonator", "compressor", "filesystem" and "datasize".
* Check return code on restore image commandJavier Sánchez Parra2020-06-231-0/+2
| | | | | | | | | | | | When restore image command was sent and the restoration failed, you could see in WebConsole the image as restored and the command completed, as it if had not failed. This happened because ogClient did not check the return code of restoration script. This commit adds return code check on restore image. So, when return code is a non-zero value ogClient responses with an error 500. When ogServer receives this error response, it did not set in the database the image as restored and command as completed without errors.
* Delete ogConfig.pyRoberto Hueso Gómez2020-06-051-16/+16
| | | | | This file is only used for its OG_PATH variable, this variable is now in ogClient.
* Fix OgLinuxOperations class paramsJavier Sánchez Parra2020-05-201-15/+15
| | | | | | | | | Commit 621fb7a7 added class initialization with two parameters. These two parameters were wrongly initialized, "self." was missing. The call of these params in other functions of the class was also wrong. This commit fix the initialization of the parameters of OgLinuxOperations and fix the calls to these params.
* Adapt ogLinuxOperation to work with json config fileJavier Sánchez Parra2020-05-181-6/+4
| | | | | | | ogClient changed its config file format to json. This patch adapts ogLinuxOperation to use new config file. Co-authored-by: Roberto Hueso <rhueso@soleta.eu>
* Fix typo on linux shellrun operationRoberto Hueso Gómez2020-05-141-1/+1
|
* Rename operation 'execCMD' to 'shellrun'Roberto Hueso Gómez2020-05-131-1/+1
| | | | This patch also ignores calls to shellrun when virtual mode is activated.
* Add realtime log menuJavier Sánchez Parra2020-04-221-6/+26
| | | | | | | | | | | We observed that with the new ogClient the ogLive did not show the realtime log menu*. This commit changes the ogClient to launch the browser and show the realtime log menu when some commands are executed. * The realtime log menu is a menu that shows current status and info about the command that the ogLive is executing.
* Avoid writting /software output to a fileRoberto Hueso Gómez2020-04-171-1/+4
|
* Increase HTML menu regeneration casesJavier Sánchez Parra2020-04-161-0/+4
| | | | | | | | | | We have observed that the ogLive browser did not show the changes when an image restoration o script execution was called. The problem was that the HTML menu was not updated/regenerated in these cases. This commit adds the call to the HTML regeneration function to image restore and script execution commands. This way, when the browser is restarted it loads the updated HTML menu.
* Change browser behaviourJavier Sánchez Parra2020-04-161-0/+21
| | | | | | | | | | We have observed that the browser did not show changes. This happens because the ogClient opens the browser at the beginning and forget about it. To show correctly the changes ogClient had to restart the browser every time the menu html changes. This commit changes the behaviour to restart the browser when the menu html has changed.
* Encapsulate operations in classesRoberto Hueso Gomez2020-04-081-198/+199
|
* missing update to use ogConfig.OG_PATH in linux/ogOperations.pyOpenGnSys Support Team2020-03-201-1/+1
|
* Make OG_PATH publicJavier Sanchez Parra2020-03-201-13/+13
| | | | | This commit changes the OG_PATH to a public varible of the class ogConfig. This way we improve the configurability of the path.
* Handle scripts that end in \rRoberto Hueso Gómez2020-02-251-1/+1
|
* Use 'bash' as the default shell for operations scriptsRoberto Hueso Gómez2020-02-091-12/+28
|
* Use python f-strings for commands compositionRoberto Hueso Gómez2020-02-051-14/+13
|
* Fix /session executionRoberto Hueso Gómez2020-02-051-1/+4
| | | | The script now reads arguments correctly.
* Fix /image/restore execution and responseRoberto Hueso Gómez2020-02-051-1/+5
|
* Fix /image/create execution and responseRoberto Hueso Gómez2020-02-051-2/+10
|
* (BUG) Rename OG_SCRIPT_PATH to OG_PATHAlvaro Neira Ayuso2020-02-041-2/+2
|
* Fix /setup execution and responseRoberto Hueso Gómez2020-02-031-8/+15
|
* Fix parseGetConf(...) configuration parsingRoberto Hueso Gómez2020-02-031-21/+22
| | | | This patch also reformats the response to the /refresh command.
* Change POST /refresh to GET /refreshRoberto Hueso Gómez2020-01-211-4/+4
| | | | | This patch changes the HTTP method for /refresh and cleans up the implementation of the /refresh Linux operator.
* Fix /software command Linux operationRoberto Hueso Gómez2020-01-211-1/+7
| | | | | This patch runs the script InventarioSoftware with the right arguments. This also increases the recv buffer size for the test server.
* Fix /shell/run commands splittingRoberto Hueso Gómez2020-01-211-1/+1
| | | | This patch splits shell commands either with ';' or '\n'.
* Fix /hardware command Linux operationRoberto Hueso Gómez2020-01-211-1/+4
| | | | This patch runs the script InventarioHardware with the right arguments.
* (Clean-Up) Rename all the functions in ogRest to new ones more clearsAlvaro Neira Ayuso2020-01-191-7/+7
|
* (Clean-Up) Rename HTTPParser to restRequestAlvaro Neira Ayuso2020-01-191-26/+26
|
* (Clean-Up) Rename cmd function/variables to use "run" syntaxAlvaro Neira Ayuso2020-01-191-1/+1
|
* Add Refresh commandAlvaro Neira Ayuso2020-01-191-16/+38
| | | | | | | | | | | | This patch allows us to execute refresh command using ogClient. This command gets all the configuration in our machine and send this information to the server. The format of the message that ogClient will send to the server will be: {"disk": "1", "partition_setup": [{"partition": "1", "code": "LINUX", "filesystem": "NTFS", "size": "498688", "format": "0"}, {"partition": "2", "code": "LINUX", "filesystem": "NTFS", "size": "498688", "format": "0"}, {"partition": "3", "code": "LINUX", "filesystem": "NTFS", "size": "498688", "format": "0"}]}
* Add image/create command for creating a new imageAlvaro Neira Ayuso2020-01-191-0/+23
| | | | | | | | | | | | | | | | This patch allows us to use a new support for creating images using ogClient. ogClient receives from the server a message which json body must be: {"disk" : "1", "partition" : "1", "code" : "1", "id" : "1", "name" : "test", "repository" : "192.168.2.4" } ogClient returns to the server the software inventory executed before create the image. The message for the server is: { "disk" : "0", "partition" : "1", "software" : "xyz" } "xyz" will be the output saved during the execution of InventarioSoftware in a specific path.
* Include License headerAlvaro Neira Ayuso2020-01-191-0/+8
|
* Add stop commandAlvaro Neira Ayuso2020-01-191-17/+26
| | | | | This patch includes a new support for stopping all the process running on the ogClient.
* Improve setup command responseAlvaro Neira Ayuso2020-01-191-1/+22
| | | | | | | | | | This patch adds a new response support. This way allows us to send a new response message with more information about the partitions already set up. The format of the response is: { "disk" : "1", "cache" : "1", "cache_size" : "0", "partition_setup": [{"partition": "1", "code": "LINUX", "filesystem": "EMPTY", "size": "498688", "format": "0"}...]
* Catch execution errors during restore image commandAlvaro Neira Ayuso2020-01-191-1/+5
| | | | | | This patch allows us to send feedback to the server in case of error during the execution of the command. In case of error, ogClient will send an "Internal Error" http message.
* Improve hardware command response behaviorAlvaro Neira Ayuso2020-01-191-1/+5
| | | | | | | | | | | This patch give us a better support in case of error or success execution. In error cases, the new behavior is to send an Internal Error http message (500). Otherwise, the server will receive a message with a json with this format: { "hardware" : "xyz" } "xyz" is the output saved in a specific path during the execution of InventarioHardware.
* Improve software command response behaviorAlvaro Neira Ayuso2020-01-191-1/+5
| | | | | | | | | | | | | | | During our tests, we found some limitation during the execution of the software command. We don't manage errors during the execution of this command. Moreover, the server needs some information in case that everything is OK. This patch modified the code for controlling the errors during the execution, returning an "Internal Error" http message (500). Moreover, in case that everything is OK, ogClient sends a message with this json body: { "disk" : "0", "partition" : "1", "software" : "xyz" } "xyz" will be the output saved during the execution of InventarioSoftware in a specific path.
* Catch execution errors during init session commandAlvaro Neira Ayuso2020-01-191-1/+5
| | | | | | This patch allows us to catch an exception when something wrong is happening executing the init session command. In error cases, ogClient sends an internal error http message to the server. Otherwise, an OK http message.
* Modify methods to use less argumentsAlvaro Neira Ayuso2020-01-191-5/+25
| | | | | | Now, all the arguments are received from httpparser. Those arguments convert the function in long lines of codes. Passing directly the httpparser, all the function will have less arguments and will be more clear the code.
* Add restore/image command for restoring images on the machineAlvaro Neira Ayuso2020-01-191-0/+4
| | | | | | | | | ogAdmClient has a support to restore image on the machine. This new command allows the new ogClient to execute the same script to restore the images on the machine. The json format sent from the server must be: { "disk" : "1", "partition" : "1", "name" : "test",\ "repository" : "192.168.56.10", "type" : "UNICAST", "profile": "1", "id": "1"}