| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Move og_delete_image into dbi.c as og_dbi_delete_image to use it
from client.c
no functional changes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reimplement the legacy funcion actualizaConfiguracion with
og_update_client_config in src/client.c
if disk does not exist, add it, otherwise update disk contents.
if partition size, code, filesystem or os is different, reset image id,
otherwise update partition usage only.
delete partitions that are gone at the end.
|
|
|
|
| |
Put ogserver into diet, remove this feature, including pending command queue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
infer server IP for a given client. User does not have to attach a client to
a given server IP anymore through ordenadores.identorno.
this simplifies previous work to allow a server to have more than one IP address
a0a347068285 ('#1074 rest: set_mode: add support for different ogserver addresses')
44745a3f2287 ('rest: add POST client/server method')
POST /client/server is removed, it is only used by ogcli and explicit association
between server and client is not required.
server_id json attribute is also removed in GET client/info.
|
|
|
|
|
|
|
|
|
|
| |
Repository can have more than one single IP address.
* Add alias field to database to represent the extra IPs that are attached to
the repository, update schema and add version 9.
* Use og_dbi_get_repository_ip() to infer the repository IP address.
* Add helper functions (src/repo.c) to build a list of repositories and update
rest API to use it.
|
|
|
|
|
|
|
|
|
|
| |
If repository_id json field is provided, use it to narrow down the image lookup.
After this, search use this same repository ID to fetch the IP address.
Old web console may not provide repository_id, infer it from the image name.
Always set image id field for creation and update.
|
|
|
|
|
| |
Add a new checksum attribute to GET /images, extend database to add a new
checksum field to images table.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add URI to allow a GET request to obtain info about a center (name, id
and comment of the center as of now).
To use this uri, simply send a GET request with a json containing the id
of the center whose info needs to be consulted:
curl -X GET -H "Authorization: $API_KEY" http://127.0.0.1:8888/center/info -d '{"id":1}'
based on work from Javier Hernandez.
|
|
|
|
|
|
| |
Add support to update computer folder name
Add support to update room folder name
|
|
|
|
|
|
|
|
| |
Change the name of variable 'group', in og_group struct, to 'folder_id'.
Change payload field to 'folder_id'
These changes are to make code easier to understand.
|
|
|
|
|
|
| |
Add support for adding clients that are inside a folder.
Add new folder_id field, if zero it means computer is not in a folder.
|
|
|
|
| |
Add support for adding computer folders and room folders.
|
|
|
|
|
|
|
|
|
| |
do not use description field to decide if this is a new image or an update.
add og_dbi_get_image() to check if the image exists. If it is not found, then
add new image entry to database.
update og_dbi_add_image() to update the image.id field.
|
|
|
|
|
|
| |
Use permissions and last update from client.
update src/schema.c to add a new database version.
|
|
|
|
|
|
|
| |
Add GET /room/info to obtain room information, this includes the name,
gateway and netmask.
curl -X GET -H "Authorization: $API_KEY" http://127.0.0.1:8888/room/info -d '{ "id" : 1 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POST /repository/add checks validity of the repository ip address
specified in the request payload.
/repository/add can optionally receive a center id parameter inside its
request payload. For backward compatibility, the default center id (1)
is used if no center is received inside the request payload.
POST /repository/add returns a JSON response payload containing relevant
fields from the inserted repository.
$ curl -D-
\ -X POST
\ -H "Authorization: a0e9ab768cbe93dab5b1998e952bcdb7"
\ --json '{"name": "helloworld", "ip": "192.168.21.21a", "center": 2}'
\ localhost:8888/repository/add
HTTP/1.1 400 Bad Request
Content-Length: 0
$ curl -D-
\ -X POST
\ -H "Authorization: a0e9ab768cbe93dab5b1998e952bcdb7"
\ --json '{"name": "helloworld", "ip": "192.168.21.21a", "center": 2}'
\ localhost:8888/repository/add
HTTP/1.1 200 OK
Content-Length: 54
{"id": 7, "ip": "192.168.21.21", "name": "helloworld"}
|
|
|
|
|
|
|
|
|
|
| |
Move struct og_repository to dbi.h and use field max length for name and
ip.
Use og_json_parse_string_copy instead of og_json_parse_string to check
maximum length against the request payload.
Fixes: 86ccc3c2e8377623 ("#915 Add POST /repository/add")
|
|
|
|
|
|
|
|
|
| |
Extend og_dbi_get_computer_info to fetch "identorno" column from
"ordenadores". "identorno" holds the row id value from the "entornos"
table (valid ogserver addresses).
Extend og_computer struct with a new field: "server_id" that will store
the value of "identorno" column fetched from the database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
API "GET /images" shows the repository ID the image belongs to, instead
of the IP. This is a preparative commit to the support of repositories
with several IPs.
Request GET /images
Response 200 OK:
{
"images": [
{
"name": "windows10",
"datasize": 0,
"size": 626088433,
"modified": "Fri Jun 10 12:20:32 2022",
"permissions": "744",
"software_id": 1,
"type": 1,
"id": 6,
"repo_id": 1
}
],
"disk": {
"total": 52573995008,
"free": 38964637696
}
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POST /image/create has two modes, image creation and update. You can
find more information about the "creation" mode in commit:
d2f20d0be06617f421eecca111449d94672695eb
On image creation, use the id to identify repositories instead of the
IP. This is a preparative commit to the support of repositories with
several IPs.
On image update, "repository_id" field is not needed because the image
already has the repository assigned.
This commit maintains backward compatibility with the Web Console (old
web interface), because it only use the "update" mode of /image/create.
Request POST /create/image:
{
"clients": [
"192.168.56.11"
],
"disk": "1",
"partition": "1",
"name": "archlinux",
"repository_id": 1,
"id": "0",
"code": "131",
"description": "This is a test",
"group_id": 0,
"center_id": 1
}
Response 200 OK
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This extension adds the field 'repo_ip', indicating which repository has
the image. This new field is useful when restoring an image.
Request:
GET /images
Response:
200 OK
{
"disk": {
"free": 37091418112,
"total": 52573995008
},
"images": [
{
"datasize": 5939200000,
"id": 25,
"modified": "Wed Oct 14 11:49:00 2020",
"name": "archlinux",
"permissions": "744",
"size": 1844222333,
"software_id": 19,
"type": 1
"repo_ip": "192.168.56.10"
}
]
}
|
|
|
|
|
|
|
|
|
|
|
| |
The "code" member of the og_legacy_partition is used to hold the string of
the partition type *name* for legacy parameter strings. Example:
par=2*cpt=LINUX-SWAP*sfi=LINUX-SWAP*tam=10000000*ope=0
Problem: Buffer size is smaller than possible values for this member.
Fix: Increase buffer size up to the max length defined in the DB
for the corresponding column.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds POST method to add rooms (labs), required payload parameters are
name, netmask and center; any additional attributes are optional.
Required JSON:
{ "center": 0,
"name": "classroom10",
"netmask": "255.255.255.0" }
Full JSON:
{ "center": 0,
"name": "classroom11",
"netmask": "255.255.255.0",
"group": 0,
"location": "First floor",
"gateway": "192.168.56.1",
"ntp": "hora.cica.es",
"dns": "1.1.1.1",
"remote": True }
This commit also adds unit tests for /room/add POST method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds database schema management capabilities to ogServer:
- ogServer now tracks the version of its database schema, if no version
is detected, creates a 'version' table with a single row starting at 0.
- ogServer can upgrade its database schema to a newer version if
detected. (ogServer ships required SQL commands to do so)
If ogServer is unable to upgrade the schema at startup (if needed be) it
*will not* start.
Defines schema update v1 which upgrades database engine tables of
ogServer database (usually named 'ogAdmBD') from myISAM to innoDB.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This extension removes replaces the field 'filename' for 'name' and adds
new fields (software_id, type and id). These new fields are useful when
restoring an image.
Request:
GET /images
Response:
200 OK
{
"disk": {
"free": 37091418112,
"total": 52573995008
},
"images": [
{
"datasize": 5939200000,
"id": 25,
"modified": "Wed Oct 14 11:49:00 2020",
"name": "archlinux",
"permissions": "744",
"size": 1844222333,
"software_id": 19,
"type": 1
}
]
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In case the DB entry for an image does not exist when POST /image/create
is called, this patch takes care of calling it.
This adds few optional json parameters to the POST /image/create API. If
optional parameters are included then this patch creates the DB entry,
otherwise it just creates the actual image and updates the existing
entry.
Request:
POST /image/create
{
"clients":["192.168.56.11"],
"disk":"1",
"partition":"1",
"name":"archlinux",
"repository":"192.168.56.10",
"id":"24",
"code":"131",
"description":"This is a test",
"group_id":0,
"center_id":1
}
Response:
200 OK
|
|
|
|
|
| |
Use og_server_cfg everywhere. Convert port to string to make it easy for the
dbi API since it expects a string. Remove legacy example configuration file.
|
|
|
|
|
|
| |
This patch is a refactor for og_computer and og_dbi_get_computer_info.
It now uses fixed lenght strings to make it more reliable and avoid
errors if the DB is not returning a null ended string.
|
|
|
|
|
|
| |
For the strings in og_computer we do not need to know the max size in
advance but instead we need to free up memmory using
og_dbi_free_computer_info(...) function.
|
|
|
|
| |
Reuse the existing dbi handler, instead of opening a new one.
|
|
|
|
| |
Move this function to the dbi.{h,c} files.
|
|
|
|
|
| |
This patch provides functionality to select a database port. It also adds a
default IP for the database.
|
|
Use the same folder as in ogClient.
|