Commit Graph

15 Commits (1ce56240323c21e3e3251dfd6173cb45ae959574)

Author SHA1 Message Date
Jose M. Guisado 4cc2ca61fd dbi: add server_id to og_computer struct
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.
2023-08-23 15:34:44 +02:00
Javier Sánchez Parra 52a38d3e57 #915 Use the repository id on image creation
POST /image/create has two modes, image creation and update. You can
find more information about the "creation" mode in commit:
d2f20d0be0

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
2022-06-20 10:41:32 +02:00
Javier Sánchez Parra c0573b9ef0 #915 Set repository on image creation
Assign to the image the repository indicated in the JSON body instead of
a default one.
2022-05-26 15:15:52 +02:00
Jose M. Guisado cb7fa569b2 #941 Free dbi_inst when og_dbi_open fails to connect
When trying to open a connection to a database, an instance of
libdbi is created before any connection attempt. If connection is
unsuccessful then the og_dbi struct is freed but not the
libdbi instance member, thus leaking its memory.

Use libdbi dbi_shutdown_r to shutdown libdbi instance member
before freeing og_dbi struct inside og_dbi_open.
2021-06-01 14:14:15 +02:00
OpenGnSys Support Team a7cce8d442 ogServer is AGPLv3+
Update license header in files.
2021-05-04 17:59:11 +02:00
Jose M. Guisado 11d6e84b8e #915 Avoid duplicate db entries in /create/image
/create/image adds an entry to the database for the given partition
image created when payload contains a "description" attribute. This
insertion into the database is lacking a check for duplicates, which are
not supported for the images table.

Add a prior duplicate check before inserting. Exit with -1 code if an
image with the same name is found.
2021-04-06 13:11:50 +02:00
Javier Sánchez Parra 4f5c357dcd #941 Fix get computer center id
Creating a software profile failed. ogServer obtained the information of
a computer without center id because commit cbd9421 removed it
unintentionally, making all computer had center id equal to zero.

This commit restores the gathering of computer center id from the
database.
2020-10-27 17:04:26 +01:00
Roberto Hueso Gómez d2f20d0be0 #942 Create DB image when calling POST /image/create
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
2020-10-14 12:05:25 +02:00
OpenGnSys Support Team fe1ce97c50 #988 remove legacy configuration
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.
2020-10-07 11:17:00 +02:00
Roberto Hueso Gómez f537dafa77 #941 Use fixed length strings in og_computer and og_dbi_get_computer_info
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.
2020-10-06 16:04:17 +02:00
Roberto Hueso Gómez cbd9421bae #941 Extend og_dbi_get_computer_info(...)
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.
2020-09-22 15:20:57 +02:00
OpenGnSys Support Team d7e2022bdd #941 pass og_dbi to og_dbi_get_computer_info()
Reuse the existing dbi handler, instead of opening a new one.
2020-09-18 15:38:16 +02:00
OpenGnSys Support Team 3cb98c7187 #941 move og_dbi_get_computer_info() to dbi
Move this function to the dbi.{h,c} files.
2020-09-18 15:34:30 +02:00
Roberto Hueso Gómez 0631b0e8e6 #988 Add DB port option to ogserver.json config file
This patch provides functionality to select a database port. It also adds a
default IP for the database.
2020-07-10 16:21:58 +02:00
OpenGnSys Support Team 37e91b2ebb #971 rename sources folder to src
Use the same folder as in ogClient.
2020-06-26 20:13:42 +02:00