| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'--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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
program name of subsequent parsers after the first one need their
"prog=" parameter specified so they do not show sys.argv[0] only.
With this patch, for example:
ogcli list --help
Shows:
usage: ogcli list [-h] {clients,scopes,modes,hardware,client}
...
Instead of:
usage: ogcli [-h] {clients,scopes,modes,hardware,client}
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
This reworks the POST /mode command to the new API:
POST /mode
{
'clients': ['192.168.1.5', '192.168.1.6']
'mode': 'pxe'
}
|
|
|
|
| |
This adapts to the ogServer.
|
|
|
|
|
|
|
|
|
|
| |
This patch adapts the command to the fixed POST /modes request. It can
now be called with something like: ogcli set modes --scope-name=pc12
--mode=pxe
NOTE: This inherits from the legacy setclientmode script and requires
scope names to be unique. This should be fixed in the future in case
it's convenient to have duplicated scope names.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Instead of using query strings we use a json body for GET HTTP requests. This is
allowed under RFCs 7230-7237.
https://stackoverflow.com/questions/978061/http-get-with-request-body
|
|
|
|
|
| |
This requests POST /modes and changes a scope mode by calling something like:
ogcli set modes --scope-id=1 --scope-type=computer --mode=pxe
|
|
|
|
| |
This is a wrapper that provides HTTP POST requests.
|
|
|
|
| |
This uses python3 and improves portability by using '/usr/bin/env'.
|
| |
|
|
|
|
|
| |
This prefix is redundant on almost every file, so the prefix is removed from
filenames and imports.
|
|
|
|
| |
This is consistent with HTTP GET /modes
|
|
|
|
|
| |
In case a required config param is not in ogcli.json config file, this exits
the program with an error code.
|
|
|
|
| |
This is consistent with HTTP GET /scopes
|
|
|
|
| |
These are the ip and port of the ogServer.
|
|
|
|
|
|
|
| |
This commit:
- Adds OgREST class as a wrapper for HTTP REST requests.
- Adds objects folder which will contain available functions for each object in
the OpenGnsys ecosystem (e.g. client, image, etc.).
|
| |
|
|
|
|
| |
Add configuration file template.
|
|
Add basic OgCLI structure.
|