Commit Graph

16 Commits (48f596436c06ddb36329ec7422259dbbb5fb27bc)

Author SHA1 Message Date
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 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
Javier Hernandez 4bf4f91f54 client: support for adding clients
Add a new client with command:

$ ogcli add client --repo-id <repo id>
      --netmask <netmask>
      --room-id <room id>
      --hostname <hostname>
      --mac <mac address>
      --ip <ip address>
      --boot-mode <boot mode>

For example: To add a new client with hostname "javipc", netmask
255.255.255.0, mac address a2:54:00:2e:05:7a, ip address 192.168.56.101,
assign it to repo id 1, room id 1 and set its boot mode to oglive
use:

$ ogcli add client --hostname javipc --netmask 255.255.255.0 --mac
a2:54:00:2e:05:7a --ip 192.168.56.101 --repo-id 1 --room-id 1
--boot-mode oglive

Notes:

- ogserver API REST json payload does not allow to specify a server
  (table 'entorno') for the client. It will automatically assign
  client to server with id 1

- ogserver API REST json payload specifies mac address without ':'.

- payload must contain 'netiface', ogcli specifies 'eth0' is specified
  which is the default value in netiface column in db (table 'ordenadores')

- netdriver column uses "generic" as default, this field is not used
  anymore, but it is set to "generic" by now.

- ogserver should validate that boot mode set is correct.
2023-10-27 11:57:25 +02:00
Jose M. Guisado b1fc9cabb4 objects: add missing prog parameter in subcommands
The specific subcommand name is missing in some of the subcommands help
message. For example:

	$ ogcli list hardware
	usage: ogcli [-h] --client-ip CLIENT_IP
	ogcli: error: the following arguments are required: --client-ip

Fix this by adding the missing prog= parameter so argparse use this
instead of argv[0]. If no prog parameter is specified then argv[0] is
printed (i.e: "ogcli").
2023-10-05 11:21:19 +02:00
Jose M. Guisado d90ab82cec format: use autopep8
Use autopep8 for coding format, and only for whitespace changes. This
change drops use of tabs in favor of spaces.

Doesn't use autopep8 --aggresive option.

Format command:

$ autopep8 --inline --recursive .

When using git-blame, use --ignore-rev in order to ignore this
reformatting commit.
2022-05-20 10:22:42 +02:00
Jose M. Guisado 397663fd37 send: add send refresh
Send refresh to a given client.

$ ogcli send refresh --client-ip 192.168.56.11
2022-05-20 08:52:23 +02:00
Jose M. Guisado b765ee50d3 utils: add print_json
Adds a pretty printing function for JSON data.

Replaces print for print_json in corresponding cli objects.

Follows commit 828d6c0ce7
("list scopes: pretty print scope tree")
2022-05-17 11:24:49 +02:00
OpenGnSys Support Team 5f922571e2 ogCLI is AGPLv3+
Update license header in files.
2021-05-14 00:26:33 +02:00
Jose M. Guisado 565e798ef9 Print json instead of python dict in responses
r.json() decodes the responses json and passes it to json.loads() which
will convert the content into a python dictionary.

Print the literal JSON text so that output can be further manipulated by
other tools like jq.
2021-03-18 15:40:35 +01:00
Jose M. Guisado c80f27c98c Make client and center params more specific
Non specific parameter names like '--center' or '--client' should not be
used to specify an ip or id, only a literal name.

Rename --client to --client-ip and --center to --center-id to leave
unspecific parameters free to later implement --center or --client using
names.
2021-03-03 11:17:05 +01:00
Jose M. Guisado f6fa795803 Bring clients.py up to date with ogServer API
get_client_properties is not using a valid API resource to fetch
computer details. Use /client/info.

list_client_hardware is not building a valid payload. Drop
payload building using 'scope' as key and updates o that its
uses "{ client : ip }" scheme for specifying a client. This is the
standard way of specifying a client in ogServer.
2021-02-26 15:34:02 +01:00
Roberto Hueso Gómez 513308fe81 Add ogcli list client command
This requests GET /client/properties by calling something like:
ogcli list client --id=6

It is important to notice that 'id' must be a "computer" type
scope id.
2020-07-14 11:21:16 +02:00
Roberto Hueso Gómez f4e1bb767b Add ogcli list hardware command
This requests GET /hardware by calling something like:
ogcli list hardware --scope-id=6

It is important to notice that 'scope-id' must be a "computer" type scope id.
2020-07-08 13:38:50 +02:00
OpenGnSys Support Team 14b7729a71 add license header to source code files 2020-07-01 12:34:46 +02:00
Roberto Hueso Gómez dbf0f00650 Rename files to remove 'og' prefix
This prefix is redundant on almost every file, so the prefix is removed from
filenames and imports.
2020-06-30 12:51:51 +02:00