Commit Graph

108 Commits (7d2678422eb26f0930932fd8814c68eae0ea3dda)

Author SHA1 Message Date
Alejandro Sirgo Rica 7d2678422e cli: cleanup http error handling
Use more specific exception request exception handling to provide
better error messages.

Define an interal request function for get, post and delete to
reuse code.
2024-12-16 12:49:46 +01:00
Alejandro Sirgo Rica 2f870d7b6a cli: add lives alias to the live command argument 2024-12-13 13:59:54 +01:00
Alejandro Sirgo Rica 80a68ceb5a live: use human readable date in live list
Parse the unix timestamp into a human readable format like
"2024-11-25 12:28:19".

Make print_json() print from string and from a json object to
enable manipulation of data before printing.
2024-12-13 13:59:39 +01:00
Alejandro Sirgo Rica 12d965ce1c cli: improve HTTP status code error logging
Use a different message for each status code when the request is
not successful.
2024-12-10 11:28:44 +01:00
Alejandro Sirgo Rica 4b77e1bca8 folder: fix add folder command
Fix typo causing an error in the add folder command.
2024-12-10 10:45:31 +01:00
Alejandro Sirgo Rica 0225502832 cli: add live set --default command
Add command to set a new default live.

Command example:
ogcli set live --default --name ogLive-5.4.0-r20220408
2024-12-05 13:25:46 +01:00
Alejandro Sirgo Rica 85d910d020 cli: add live management commands
Add new parameters to the config file ogcli.json with the
following default values:
'local_live': '/var/www/html/ogrelive'
'server_live': 'https://opengnsys.soleta.eu/ogrelive'

Add command to install the files of a live system. Example:
ogcli install live --name ogrelive-6.1.0-26

Perform an update if live files are already present.

Add command to delete the files of a live system. Example:
ogcli delete live --name ogrelive-6.1.0-26

Update ogcli list live to show the lives in the server when
invoked with the --remote flag. Example:
ogcli list live --remote
2024-11-21 17:05:26 +01:00
Alejandro Sirgo Rica c4eb5d165a ogcli: move configuration data into a different file
Move the configuration into its own file so it is easier to access
from multiple files.
2024-11-21 17:05:26 +01:00
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
OpenGnSys Support Team ea8210a805 Revert "cli: rename ogcli list scopes to ogcli list scope"
This reverts commit 8f5b709212.
2024-11-21 16:44:59 +01:00
Alejandro Sirgo Rica 59f2f501aa scopes: add scope filtering by name
Implement the --name flag in scope list to filter by client name.

Example usage:
ogcli list scope --name test
2024-09-12 13:26:42 +02:00
Alejandro Sirgo Rica 8f5b709212 cli: rename ogcli list scopes to ogcli list scope
Use the word "scope" to keep the format coherent with the other
commands.
2024-09-12 13:06:02 +02: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 7f09d148b4 server: validate IP address
Add IP validation after input parsing.
2024-09-12 11:30:02 +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 268b76b3ea images: missing curly brace in image command 2024-09-03 17:07:23 +02:00
OpenGnSys Support Team d0e853e9d1 repo: remove --center
legacy option, never used, remove it
2024-09-02 15:19:51 +02:00
OpenGnSys Support Team 784b713c07 images: remove --repo for image create
get repository id through GET /client/info, check that all the clients belong
to the same repository.
2024-09-02 14:31:06 +02:00
OpenGnSys Support Team aec6772edc server: remove 'set server' command
server IP is now inferred from what it is reachable, remove this command.

this revisits a721957cc4 ('cli: add server commands')
2024-09-02 14:31:06 +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 faebdd5a0d cli: remove accents in image name
Remove accents in the --name argument of the create image command.
2024-08-21 13:08:53 +02:00
OpenGnSys Support Team 5226226ab2 utils: print readable output for escaped non-ascii characters
disable ascii_ensure in json dumps so listing of non-ascii characters is human
readable.
2024-08-06 17:01:36 +02:00
OpenGnSys Support Team 488518c625 disk: use NTFS for partition code
ogclient supports NTFS partition code.
2024-08-06 12:01:06 +02:00
Alejandro Sirgo Rica 740b2eab60 utils: place dictionary and list at the end of the json tree
Place dictionaries and lists at the end of the payload to improve
readability when it has a lot of nested components.

Remove and add again every element of type list or dict within a
dict or list in the payload.
Python dictionaries preserve insertion order from 3.7 onwardsi so
it is safe to reorder them by removing and readding an element.
2024-07-09 16:48:29 +02:00
Alejandro Sirgo Rica 6f9da3fdbb objects: fix restore image default repo value
Obtain the image's repository from the API REST.
Don't send 127.0.0.1 as image server when --repo is not defined.
2024-07-04 16:14:20 +02:00
OpenGnSys Support Team f53a60129b images: update command requires string id in server
ogserver expects a string as an id, otherwise it fails to parse it.
2024-06-17 12:35:01 +02:00
Alejandro Sirgo Rica 1fadb06b7e cli: objects: unbreak ogcli with python 3.8
Older versions of Python can't handle interleaved quote types.
Use single quotes as external string delimiter and double quotes
in every part of the strings when quotation is needed.
2024-06-03 21:33:53 +02:00
Alejandro Sirgo Rica 29ab6cc0ed disk: improve disk setup command validation
Checks:
--type is gpt or dos.
--num must have numeric argument.
--part defines 4 coma-separated values.
--part number must be an integer.
--part number is not repeated between partitions.
--part partition type is a known type.
--part filesystem type is a known type.
--part size has a valid format.
2024-06-03 15:51:58 +02:00
Alejandro Sirgo Rica 7ff45e5fcc disk: use proper partition sizes
Use base 2 size units for the partition configuration units.
Using base 10 units causes incoherency with the web.
2024-06-03 15:43:47 +02:00
Alejandro Sirgo Rica 10d7b972ca cli: add list scopes --client-ip
Implement a --client-ip filter to ease the task of finding the
hierarchy associated to a client or list of clients.

Usage:
/ogcli list scopes --client-ip 10.141.10.23

/ogcli list scopes --client-ip 10.141.10.23 --client-ip 10.141.10.22
2024-06-03 12:46:28 +02:00
Alejandro Sirgo Rica e92e38bcca remove whitespace printed after every command execution
The POST handling logic didn't check for empty responses before
printing its contents resulting in a line of whitespace being
written in the output of the program.
2024-03-04 10:43:26 +01:00
Alejandro Sirgo Rica f26a8c3d23 improve missing clients error reporting in multiple commands
All the commands that need target clients now have a more descriptive
error message when the clients of the command are missing.
2024-03-04 10:14:37 +01:00
Alejandro Sirgo Rica 9a11fd8346 rename argument of 'restore' command to 'restore_obj'
The argument was called 'send_obj' probably due to copypaste.
The rename aims to provide a better name for the command.
2024-03-04 10:01:03 +01:00
Alejandro Sirgo Rica b242ee9f6e change 'ogcli send' command into 'ogcli request'
By using the word 'request' the command becomes more semantic and
represents the 'best effort' nature of the communication with
ogserver.
2024-03-04 09:58:41 +01:00
Alejandro Sirgo Rica 9f78cc5ace add 'send session' to request the boot from a client's partition
example to boot OS from 10.141.10.22 disk 1 partition 2

	send session --client-ip 10.141.10.22 --disk 1 --part 2
2024-02-29 12:33:59 +01: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 9be4de87b7 ogcli: add update command for folder, room and center
Expand of the update command to be able to modify the values of
previous folder, room and center configurations.
2024-02-13 12:13:00 +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
Alejandro Sirgo Rica 4881610656 folder: add commands to create and delete folders
add command to add folders

	add folder --name test --room-id 123

to delete

	delete folder --id 456

you can fetch the id with 'list scopes'
2024-02-05 12:58:52 +01:00
Javier Hernandez 642b0a49d4 room: use room_id field in json
instead of group, which is not used by the ogserver anymore.
2024-01-11 17:41:17 +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 020592d6fc live: add command to list available live images
Add new command to display the available live images:

 # ogcli list live
2024-01-02 13:52:36 +01:00
OpenGnSys Support Team 76b4492fe6 cli: remove 'list server'
list servers already provides the same.
2024-01-02 13:38:36 +01:00
Javier Hernandez 717a1021d3 images: Remove option to specify repo
Remove option to specify a repository when creating an image.

Remove option to specify a repository when updating an image.

These features is are not yet supported in ogserver.

With this commit, the image that is created/updated is assigned to the
same repo the client is assigned
2023-12-21 16:58:50 +01:00
OpenGnSys Support Team cf4af2a057 images: use new POST image/update
use POST image/update when updating an image.
2023-12-19 12:49:03 +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
OpenGnSys Support Team 4286c45877 client: remove --netmask
This set from the room --netmask, this is obsolete, remove it.
2023-11-30 22:22:45 +01:00
OpenGnSys Support Team da8f8e8009 client: support for deleting clients
Delete a client with command:

 $ ogcli delete client --ip 1.2.3.4
2023-11-30 22:03:51 +01:00