summaryrefslogtreecommitdiffstats
path: root/cli/objects/images.py
Commit message (Collapse)AuthorAgeFilesLines
* utils: add print_jsonJose M. Guisado2022-05-171-1/+1
| | | | | | | | | 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")
* create image: fix --repo default ip valueJose M. Guisado2022-05-161-1/+1
| | | | | | | | | | | 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.
* restore image: add tiptorrent transfer methodJose M. Guisado2022-05-161-3/+4
| | | | | Makes --type optional, defaults to tiptorrent when option is missing.
* create image: make --desc option optionalJose M. Guisado2022-05-101-3/+6
| | | | | | | | | | --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)
* ogCLI is AGPLv3+OpenGnSys Support Team2021-05-141-4/+3
| | | | Update license header in files.
* Add 'create image'Jose M. Guisado2021-04-061-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix fallback --repo value in 'restore image'Jose M. Guisado2021-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | '--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.
* Add 'restore image' commandJose M. Guisado2021-03-301-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add list imagesJose M. Guisado2021-03-301-0/+14
ogServer exposes a list of known partition images at /images, use it to implement 'list images' command.