summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-03-31 10:40:19 +0000
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-03-31 15:07:40 +0200
commitc4179641790274f53cb325570c2fda24a10f1f92 (patch)
tree6a42ceb28fa51e5667c901961671617e84a2792e /cli
parent6fd3cb7a251c3c0e6b98947f420c3d5f3146e582 (diff)
Fix fallback --repo value in 'restore image'
'--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.
Diffstat (limited to 'cli')
-rw-r--r--cli/objects/images.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/objects/images.py b/cli/objects/images.py
index 723a7b0..b4ce469 100644
--- a/cli/objects/images.py
+++ b/cli/objects/images.py
@@ -41,7 +41,7 @@ class OgImage():
help='Image id to be restored')
parser.add_argument('--repo',
nargs='?',
- default=urlparse(rest.URL).netloc,
+ default=urlparse(rest.URL).netloc.split(':')[0],
help='Images repository ip')
group = parser.add_argument_group('clients', 'Client selection args')
group.add_argument('--center-id',