summaryrefslogtreecommitdiffstats
path: root/src/restRequest.py
Commit message (Collapse)AuthorAgeFilesLines
* src: add support for direct command executionv1.3.2-25Alejandro Sirgo Rica2 days1-4/+4
| | | | | | | | | | | | | | | | 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.
* 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/+7
| | | | | | | | | | | | | | | | | | | | 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'} ] }
* rest: add backup parameterJose M. Guisado2023-07-061-0/+7
| | | | | | | Support parsing of "backup" parameter inside incoming requests. Prepare ogClient support for backup image creation in "image create" operation.
* ogclient: add support for X-Sequence headerv1.3.0Jose M. Guisado2023-06-141-0/+5
| | | | | | | | | | | | | | | Enable parsing of "X-Sequence" HTTP headers from incoming requests. Add "seq" field in restRequest class. Enable adding "X-Sequence" to outgoing responses. Add "seq" field inside restResponse class. Store current client sequence number inside ogClient class. Ideally, the restRequest object should be used to retrieve the sequence number but not all processing functions inside ogRest.py receive the request as parameter (eg: process_refresh). In the other hand, all processing functions receive the ogClient object.
* src: improve loggingJose M. Guisado2022-06-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adds new logging handler redirecting messages to the log file located in the Samba shared directory (applies to live mode clients, i.e: ogLive) Parses log level configuration from ogclient.json. See: { "opengnsys": { ... "log": "INFO", ... } ... } Adds --debug option to set root logger level to DEBUG when starting ogClient. Overrides log level from config file. In addition: - Replaces any occurence of print with a corresponding logging function. - Unsets log level for handlers, use root logger level instead. - Default level for root logger is INFO. - Replaces level from response log messages to debug (ogRest)
* ogClient is AGPLv3+OpenGnSys Support Team2021-05-141-3/+3
| | | | Update license header in files.
* rename getURI to get_uri in restRequestOpenGnSys Support Team2020-03-091-1/+1
|
* use lowercase attribute name in restRequestOpenGnSys Support Team2020-03-091-13/+13
|
* Rename operation to methodOpenGnSys Support Team2020-02-261-3/+3
| | | | As defined by the HTTP standard.
* Search the key in the parsed jsonJavier Sanchez Parra2020-02-261-13/+12
| | | | | | | | | | | | | | | | | | | | | Testing the ogClient I found that if a value of the json match a key the ogClient has an exception. For example: body = "... shell/run {"run": "fdisk -l"} ..." CURRENT Enters in if "disk" in body:... if "run" in body:... EXPECTED Enters in if "run" in body:... This commit changes the behaviour to search for the keys in the dictionary returned by json.loads() instead of searching in the raw string. This way the ogClient looks for the keys without searching in the values.
* remove unused gettersOpenGnSys Support Team2020-02-211-18/+0
|
* Fix parseGetConf(...) configuration parsingRoberto Hueso Gómez2020-02-031-1/+1
| | | | This patch also reformats the response to the /refresh command.
* (Clean-Up) Rename HTTPParser file to restRequestAlvaro Neira Ayuso2020-01-191-0/+165