Commit Graph

13 Commits (7d2678422eb26f0930932fd8814c68eae0ea3dda)

Author SHA1 Message Date
Alejandro Sirgo Rica 10a3897f92 cli: ensure the program returns 0 on success and 1 on error
propagate a returncode in each operation and make it the
returncode of the program.

Prevent sys.exit calls in post(), get() and delete() request
handlers to enable cleanup code and error handling. Keep a basic
error log inside the request functions if the connection can't
be established or if the response contains an error code.
2024-11-21 17:05:24 +01:00
Alejandro Sirgo Rica 175a38606a repo: server: replace --address with --ip
Make flag format uniform for all the commands.
2024-09-12 11:42:30 +02:00
Alejandro Sirgo Rica 7478b9ce15 repo: overload delete and add repo to modify the addresses
Overload the add repo and delete repo commands to have
different functionality based on the flags.

Add a repo:
ogcli add repo --name test2 --address 192.168.9.140

Add addresses to repo with id 27:
ogcli add repo --address 192.168.9.141 192.168.9.142 --id 27

Delete address from repo with id 27:
ogcli delete repo --address 192.168.9.141 --id 27

Delete repo:
ogcli delete repo --id 27
2024-09-12 10:30:56 +02:00
Alejandro Sirgo Rica 6a96a130b5 repo: fix repo update command prefix
Use the correct command prefix in the command function.
2024-09-11 15:12:51 +02:00
OpenGnSys Support Team d0e853e9d1 repo: remove --center
legacy option, never used, remove it
2024-09-02 15:19:51 +02:00
Alejandro Sirgo Rica 28ec68df42 repo: sync repo with new API
Add repo update.
Example command:
  update repo --id 20 --address 192.168.1.189 192.168.1.191 --name test --center 1

Use addr instead of ip to pass a list of addresses.
2024-09-02 14:30:15 +02:00
Alejandro Sirgo Rica 48f596436c remove duplicated parse_args in repo.py and server.py
Remove the line 'parsed_args = parser.parse_args(args)' parsing the
command line arguments a second time when it is not needed.
2024-02-29 11:26:10 +01:00
Alejandro Sirgo Rica 569b0107c1 ogcli: validate integer type in every --id argument
missing validation of --id, user needs to supply an integer
2024-02-05 13:29:57 +01:00
OpenGnSys Support Team c1aae6e35e src: update copyright statement
use opengnsys@soleta.eu email instead of info@soleta.eu
2024-01-02 14:00:53 +01:00
OpenGnSys Support Team 27f632e3ed repository: fix incorrect help
# ogcli delete repo -h
 [...]
     --id [ID]   room id in scopes

this is not the room id, it should be the repo id.
2023-12-01 10:38:40 +01:00
OpenGnSys Support Team 6b4a7a64ee repository: delete command
Allow to delete a repository with:

 $ ogcli delete repo --id 10
2023-11-30 22:22:45 +01:00
Jose M. Guisado a4bf35ef28 repo: add add_repo function
User can add a new repository to the database using "ogcli add repo":

$ ogcli add repo --name ogcli --address 10.10.10.10
{
    "center": 1,
    "id": 13,
    "ip": "10.10.10.10",
    "name": "ogcli"
}

The --center optional parameter is used to set the center column of
"repositorios" table in the database to the specified value. If this
parameter is missing ogServer API will default to center with id 1 (the
default center). This is to not break the repository in the legacy
webconsole users.
2023-10-11 17:50:47 +02:00
Jose M. Guisado 4e89fe44d0 cli: add repo.py object
A user can list repos using "ogcli list repos":

$ ogcli list repos
{
    "repositories": [
        {
            "id": 1,
            "ip": "10.141.10.1",
            "name": "Repositorio (Default)"
        },
        {
            "id": 3,
            "ip": "127.0.0.1",
            "name": "dummy"
        },
        {
            "id": 4,
            "ip": "192.168.21.21",
            "name": "helloworld"
        }
    ]
}

The repository of a client or group of clients in a room is configured
using "ogcli set repo --id <id> [--client-ip <ip address>, --room-id
<room id>]:

$ ogcli set repo --id 4 --room-id 1
2023-10-11 17:29:49 +02:00