summaryrefslogtreecommitdiffstats
path: root/src/json.c
Commit message (Collapse)AuthorAgeFilesLines
* client: move image list to cache data to consolidate itOpenGnSys Support Team2024-09-251-4/+9
| | | | | Move list of images in the cache to cache_data. Add new functions to initialize cache data (image list) and release it.
* src: add used_size and free_size to partition dataAlejandro Sirgo Rica2024-09-251-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend database table ordenadores_particiones to add new "used_size" and "free_size" fields. FIELD TYPE | tamano | bigint | | uso | tinyint | | used_size | bigint | | free_size | bigint | "tamano" is the field storing the total size of the partition. "uso" is a field storing the integer percentage of use, it is preserved for backwards compatibility with scritps that access the database. "used_size" and "free_size" contain the used and free partition size in bytes. 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'} ] } } Parse the new "free_size" and "used_size" fields of each partition data in the response payload of /refresh Parse "free_size" and "used_size" fields of the cache data in the reponse payload of /image/restore, /cache/delete and /cache/fetch Replace "used_size" field of GET /client/setup with the value of the new database field "used_size"
* rest: remove scheduler codeOpenGnSys Support Team2024-09-171-0/+1
| | | | Put ogserver into diet, remove this feature, including pending command queue.
* rest: add GET /efiAlejandro Sirgo Rica2024-09-111-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add GET /efi request to obtain information about the client's boot entries. Field inside the /refresh payload '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. GET /efi resquest payload structure: { 'clients': ['10.141.10.21', '10.141.10.22'] } GET /efi response's structure: { 'clients': [ { 'ip': '10.141.10.21', 'entries': [ { "order": 0, "name": "Boot0000", "active": false, "description": "grub" }, { "order": 1, "name": "Boot0001", "active": true, "description": "UEFI: PXE IP4 Realtek PCIe GBE Family Controller" } ] }, { 'ip': '10.141.10.22', 'entries': [] } ] } The client with ip 10.141.10.22 is a BIOS system. If an entry does not appear in the boot order it won't have the 'order' field.
* client: store image cache data in databaseAlejandro Sirgo Rica2024-05-301-0/+67
| | | | | | | | | | | | | | | | | | | | | | Parse the 'cache' field of the refresh payload sent by the clients. Cache field structure in the payload: { ... 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}, ] ... } Store that data in the 'cache' table of the database so it can be obtained later on. The table contains the following fields: - clientid: the numeric identifier of the client. - imagename: name of the image in cache. - size: size in bytes of the image in cache. - checksum: checksum of the image in cache.
* #915 Add POST /task/add methodJavier Sánchez Parra2021-07-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the possibility to create a task with procedures and other tasks integrated as steps. Note: "steps" parameter is optional and "steps" array object order defines execution order. Request: POST /task/add { "center": "1", "name": "task", "description": "My task", "steps": [ { "procedure": 4 }, { "task": 1 }, { "procedure": 24 } ] } Response: 200 OK This commit also add task case to procedure's step processing. Otherwise, gcc prints the following warning: src/rest.c: In function ‘og_procedure_add_steps’: src/rest.c:4089:17: warning: enumeration value ‘OG_STEP_TASK’ not handled in switch [-Wswitch] 4089 | switch (step->type) { | ^~~~~~
* constify json parse helper functionOpenGnSys Support Team2021-06-101-5/+5
| | | | | json_t * parameter is not modified, constify to allow compiler to spew warnings in case the function tries to modify it.
* #915 Add commands and procedures to procedure creationJavier Sánchez Parra2021-06-101-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the possibility to create a procedure with commands and other procedures integrated as steps. Note: "steps" parameter is optional and "steps" array object order defines execution order. Request: POST /procedure/add { "center": "1", "name": "procedure", "description": "My procedure", "steps": [ { "command": "wol", "params": { "type": "broadcast" } }, { "procedure": 22 }, { "command": "poweroff", "params": {} } ] } Response: 200 OK This commit also updates unit tests for /procedure/add POST method to include steps.
* #1037 Add disk typeJavier Sánchez Parra2021-05-261-0/+3
| | | | | | | Add ogServer support for parsing and storing in the DB disk type data from ogClient refresh response. See also commits with #1037 in ogClient and WebConsole repo.
* #1037 Make partition parameter validation permissiveJavier Sánchez Parra2021-05-261-1/+1
| | | | | Otherwise, ogServer rejects the response if ogClient sends more parameters than required.
* ogServer is AGPLv3+OpenGnSys Support Team2021-05-041-2/+3
| | | | Update license header in files.
* #941 Add og_json_parse_string_copy(...) functionRoberto Hueso Gómez2020-10-061-0/+15
| | | | | This function provides an easy way to copy the content of a json string into a regular C string.
* #1004 Handle new fields in /image/create responseJavier Sánchez Parra2020-09-101-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | ogClient now includes more information regarding the new image. This patch modifies ogServer to support new elements sent in ogClient /image/create response and store them in the database. 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".
* Add POST /modes REST requestRoberto Hueso Gómez2020-07-061-0/+29
| | | | | | | | | | | | | This patch implements HTTP POST /modes request which can change the mode of any particular scope. Request: POST /modes { "scope": {"id": 1, "type": "computer"}, "mode": "pxe" } Response: 200 OK
* #971 rename sources folder to srcOpenGnSys Support Team2020-06-261-0/+85
Use the same folder as in ogClient.