| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
use opengnsys@soleta.eu email instead of info@soleta.eu
|
|
|
|
|
|
| |
Add new command to display the available live images:
# ogcli list live
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
use POST image/update when updating an image.
|
|
|
|
|
|
|
|
| |
# ogcli delete repo -h
[...]
--id [ID] room id in scopes
this is not the room id, it should be the repo id.
|
|
|
|
|
|
| |
Allow to delete a repository with:
$ ogcli delete repo --id 10
|
|
|
|
| |
This set from the room --netmask, this is obsolete, remove it.
|
|
|
|
|
|
| |
Delete a client with command:
$ ogcli delete client --ip 1.2.3.4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Try to reduce the usage of different parameter names due to the
OpenGnsys database using different column names for similar purposes.
Any database field regarding a description of some sort will use the
parameter --desc, even if the DB uses another column name (for example,
comment column in center table).
Use --folder parameter when requiring a folder id. The database uses
"grupo" as table name but present this to the user as folder, so use
--folder instead of --group.
Also, add 'location' field in the payload of "add room" command, it was
missing the addition of 'location' field in the JSON payload.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
add functionality to add and remove a room
to add a new room use the command: ogcli add room --name <name>
--netmask <netmask> --center <center> --gateway <gateway> [--location
<location>] [--ntp <ntp>] [--dns <dns>] [--group <group>]
for instance, to create a room with name 'dummyroom', netmask
'255.255.255.0' and gateway 10.141.10.1 that is inside the center with
id 1, use:
$ ogcli add room --name dummyroom --netmask 255.255.255.0 --gateway
10.141.10.1 --center 1
Optionally, it is possible to provide additional information such as
location (--location <location>), ntp server (--ntp <ntp>), dns server
(--dns <dns>), and a group to contain the room (--group <group>).
to delete a room use: ogcli delete room --id <id>
for instance, to delete room with id 4 use:
$ ogcli delete room --id 4
|
|
|
|
|
|
|
|
|
| |
command to delete center
ogcli delete center --id <center id>
To delete the center with id 6
$ ogcli delete center --id 6
|
|
|
|
|
|
|
|
|
| |
command to add center, specifying name and optionally a description
ogcli add center --name <name> [--comment <name>]
For example, to add a center with name "foocenter" and comment "foocenter description" type
$ ogcli add center --name foocenter --comment "foocenter description"
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every partition will be formatted since disk setup command was rewritten
into Python code in ogClient. This makes "ogcli setup disk" --format
parameter unusable.
As the time of this commit, for backward compatibility (with the legacy
web console interface) ogServer expects the "format" field inside the
partition json objects conforming the "partition_setup" array. For this
reason, ogCLI still adds the "format" field into the partition objects
present in the partition_setup array, but using a default value which
will have no effect whatsoever.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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").
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add OgServer class inside cli/objects/server.py
This OgServer class implements add, list, set and delete commands
related to the server API (/server and /client/server) exposed by the
ogServer. These server endpoints correspond with the "entornos" table and
"identorno" foreign key in the "ordenadores" tables.
To list all rows from the "entornos" table. i.e: Listing all stored
addresses for the ogServer:
ogcli list servers
{
"servers": [
{
"address": "192.168.2.240",
"id": 1
},
{
"address": "1.1.1.1",
"id": 2
}
]
}
To store a new ip address for the ogServer, ogCLI will reply with the
new id:
ogcli add server --address "10.141.10.1"
{"id", "2"}
To set a client's associated ogServer address using the server id:
ogcli set server --id 2 --client-ip 10.141.10.100
To set the associated server of a whole room use --room-id parameter:
ogcli set server --id 2 --room-id 1
To remove any existing address (which is not currently set as the
ogServer addres for any client) using the server id:
ogcli delete server --id 2
To determine a client's associated server just list the client's
information (this requires an updated ogServer):
ogcli list client --client-ip 10.141.10.100
{
"boot": "oglive",
"center": 1,
...
"server_id": 1
}
|
|
|
|
|
|
|
|
|
|
| |
Add support for backup image file when running the image update command.
For this optional parameter to be useful, the target ogServer
and ogClient must also support the 'backup' parameter. See commits:
ogServer 74b6e3ec7275164e2ecbf6f98b24357b2a9bb174
ogClient 035995fc8c55740693575ca5f7b408bfc46c1f7d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Image creation example:
ogcli create image
--disk
--part 1
--name 18oct2
--desc 18oct2
--repo-id 1
--client-ip 192.168.56.11
Image update example:
ogcli update image
--disk 1
--part 1
--id 20
--client-ip 192.168.56.11
|
|
|
|
|
|
|
|
|
|
| |
Adds 'repository_id' parameter when creating a *new* image (ie: using
--desc).
Removes unused --repo parameter.
See ogServer commit: 52a38d3e574fb25b47d230bc87754583eb17b4a6
("Use the repository id on image creation")
|
|
|
|
|
|
| |
--client-ip option is required when parsing a 'create image' command,
it is the only client selection option for 'create image'
command.
|
|
|
|
|
|
|
|
|
| |
Takes usual client options
(--client-ip, --room-id, --center-id)
Example:
> ogcli send reboot --client-ip 192.168.56.11
|
|
|
|
|
| |
Follows commit b765ee50d31b1b629b7572c231d2cf2840a4146f
(utils: add print_json)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
'set mode' --help does not show the correct program name:
ogcli [-h] [--center-id CENTER_ID] [--room-id ROOM_ID]
^^^^^ [--client-ip CLIENT_IP] --mode MODE
Adds full program name (ogcli set mode) in missing prog option
when creating the argparse object.
|
|
|
|
|
|
| |
Send refresh to a given client.
$ ogcli send refresh --client-ip 192.168.56.11
|
|
|
|
|
|
|
| |
ogServer expects a 4-partition setup. When specifying less than that,
the partition setup needs to be padded with EMPTY partitions.
Fixes a bug in which this padding is not valid.
|
|
|
|
|
|
|
|
|
| |
Adds a pretty printing function for JSON data.
Replaces print for print_json in corresponding cli objects.
Follows commit 828d6c0ce7d4a6b4bcd95e97155460fd59856bdd
("list scopes: pretty print scope tree")
|
|
|
|
|
|
|
|
|
|
|
| |
rest.URL is the ip and port of the ogServer like: 192.168.56.10:8888,
specified in ogcli.json.
As long as the host and port is specified in rest.URL, split by the ':'
character and extract the ip.
Fixes OpenGnsys clients failing to execute the command due to invalid
repository IP being fed to the underlying bash scripts.
|
|
|
|
|
| |
Use json module to pretty print the scope tree. JSON keys are ordered
and two-space indentation is used.
|
|
|
|
|
| |
Makes --type optional, defaults to tiptorrent when option
is missing.
|
|
|
|
|
|
|
|
|
|
| |
--desc option is used only when creating a new image.
A new image is any image that is not defined in the
OpenGnsys DB.
See commit d2f20d0be06617f421eecca111449d94672695eb
(#942 Create DB image when calling POST /image/create)
|
|
|
|
| |
Update license header in files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enables sending format and partition commands to the ogServer.
Syntax: ogcli setup disk {options}
Options are:
--type [{dos,gpt}] Disk partition scheme
--num [NUM] Disk number (defaults to 1)
--format [FORMAT] Indicates which partitions to reformat if they
are already present. Use --part alone to mean all
partitions.
--part PART [PART ...]
Partition definition (syntax:
"num,part_scheme,fs,size")
size is specified as a positive digit followed by a size unit
like [MGT]
512M, 50G, 1T, etc.
ogcli accepts {LINUX,WINDOWS,EFI,CACHE} as part types and {EXT4,
NTFS, FAT32, CACHE} as filesystem types inside the partition
definition string
1,LINUX,EXT4,50G => partition 1, of type linux with ext4 fs of
50 GB size
If you wanted to add a partition cache (OpenGnsys usually
mandates this partition to be number 4) you can omit partitions
up to that number and ogcli will fill with EMPTY partitions.
So if you define the following parts:
--part 1,...
--part 4,...
ogcli will fill parts 2 and 3 with EMPTY part type and fs.
Client selection argument follow previous used options
--center-id CENTER_ID
--room-id ROOM_ID
--client-ip CLIENT_IP
|
|
|
|
|
|
|
|
|
|
| |
Enables sending poweroff commands to clients.
Only arguments required are the usual client selection like:
--client-ip
--room-id
--center-id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enables creation of images using /image/create from ogServer API.
Summary of the options:
--disk
Disk number
--part
Partition number
--name
Image name which will be used for the .img file.
--desc
Description of the image. This option enables ogServer to store
an entry in the database regarding this image.
--repo
Optional. Holds the ip address of the repo which will store the
created image. Defaults to ogserver address specified inside
ogcli.json
--client-ip
Client ip for which we want to create a partition image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enables consuming /client/setup API from ogServer in order to fetch
partition and disk setup information from a given client.
Example, if pc11 is a client with 1 disk, 4 part (1:linux,2-3:empty,4:cache):
ogcli list disk --client-ip 192.168.56.11
{
"partitions": [
{
"disk": 1,
"partition": 0,
"code": 1,
"size": 52428800,
"used_size": 0,
"filesystem": 0,
"os": 0,
"image": 0,
"software": 0
},
{
"disk": 1,
"partition": 1,
"code": 131,
"size": 40000000,
"used_size": 4,
"filesystem": 6,
"os": 8,
"image": 0,
"software": 0
},
{
"disk": 1,
"partition": 2,
"code": 0,
"size": 0,
"used_size": 0,
"filesystem": 1,
"os": 0,
"image": 0,
"software": 0
},
{
"disk": 1,
"partition": 3,
"code": 0,
"size": 0,
"used_size": 0,
"filesystem": 1,
"os": 0,
"image": 0,
"software": 0
},
{
"disk": 1,
"partition": 4,
"code": 202,
"size": 10000000,
"used_size": 1,
"filesystem": 2,
"os": 0,
"image": 0,
"software": 0
}
]
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'--repo' was an optional argument to specify the ip of the machine
holding the image to be restored. In case it was not specified it
defaults to the ip specified inside ogcli.json for the ogServer
(ie. As fallback, we assume the repo is in the same machine as the
ogServer)
We retrieve the ip using urlparse from urllib.parse module. The parse
result has a 'netloc' member which holds the ip, but also any specified
port.
This resulted in a payload like:
> ogcli restore image --id 3 --disk 1 --part 1
--type unicast-direct --client-ip 192.168.56.11
{"disk": "1", "partition": "1", "id": "1", "name": "pc11bak",
"profile": "3", "repository": "192.168.56.10:8888", "type":
"UNICAST-DIRECT", "clients": ["192.168.56.11"]}
Split netloc to avoid copying the ogServer port.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds cli capability to send image restore commands to the ogServer.
It has the following options:
--id
To specify image id
--disk
Target disk
--part
Target partition
--type
To specify type of restore to send. UNICAST-DIRECT or
UNICAST-CACHE are supported as of this patch.
--repo
Optional argument to specify image repo to fetch the image. This
applies for UNICAST-DIRECT cases. (not restoring from a cache
partition). If not specified it will default to rest.URL ip
(ie. ogServer ip)
--client-ip, --room-id and --center-id
Target client args
|
|
|
|
|
| |
ogServer exposes a list of known partition images at /images, use it to
implement 'list images' command.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When utils.py was created, moved functions declaration was not kept for
scope_lookup by mistake, in previous commit it was named
'scope_lookup_id'.
ips_in_scope is a function that maps a list of scopes to the list of ips
contained in it, recursively. (if the scope is a room it will gather all
computers ips in that room). Add 'None' check for its scope param,
avoiding duplication of this check in several other objects using this
function.
Also import utils in 'modes' object, which was not added previously.
Fixes: be84b0a ("Add utils.py")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Builds a json payload to consume the ogServer API to send
WoL packets.
Adds 'send' as a command:
ogcli send
Adds a wol object for to the 'send' command, so that sending a wol can
be specified as:
ogcli send wol
* WoL packet type is specified with --type option.
* Specifying targets follows same parameters as 'set modes' with:
--client-ip
--room-id
--center-id
|
|
|
|
|
|
|
|
| |
Move auxiliary code that will be used by several objects. In this case,
scope filtering and searching by id is going to be used by 'send wol'
too.
Avoid duplicating this code creating utils.py
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
--room will be used to specify the room name instead of the id.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New arguments to make specifying the target machines more flexible when
changing their boot mode (known as "set client mode"). These argument
are optional although any of them must be used to specify some target.
--client IP
--room id
--center id
The arguments can be specified several times like "--client ip --client
ip --room id --room id --room id", etc.
Center or room id can be obtained via /scopes.
As of this patch, set_modes does iterate through the whole /scopes
output and then filters ips with those that were specified by user.
|
|
|
|
|
|
|
|
|
|
| |
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.
|