summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/objects/images.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/cli/objects/images.py b/cli/objects/images.py
index dff2f9c..cebe64c 100644
--- a/cli/objects/images.py
+++ b/cli/objects/images.py
@@ -58,10 +58,6 @@ class OgImage():
'unicast-direct', 'tiptorrent'],
default='tiptorrent',
help='Transfer method. (Default: tiptorrent)')
- parser.add_argument('--repo',
- nargs='?',
- required=False,
- help='Repository IP address')
group = parser.add_argument_group('clients', 'Client selection args')
group.add_argument('--center-id',
type=int,
@@ -109,17 +105,20 @@ class OgImage():
else:
found_image = found_image[0]
- if not parsed_args.repo:
- repository = get_repository(found_image['repo_id'], rest)
- if not repository:
- print(f'Could not find repository for image {found_image["name"]}')
+ selected_repo_id = 0
+ for ip in parsed_args.client_ip:
+ r = rest.get('/client/info', payload={'client': ip)
+ repo_id = r.json()['repo_id']
+ if selected_repo_id == 0:
+ selected_repo_id = repo_id
+ elif selected_repo_id != repo_id:
+ print(f'cannot restore clients assigned to different repositories')
return
- parsed_args.repo = repository['ip']
payload = {'disk': parsed_args.disk, 'partition': parsed_args.part,
'id': str(parsed_args.id), 'name': found_image['name'],
'profile': str(found_image['software_id']),
- 'repository': parsed_args.repo,
+ 'repository_id': repo_id,
'type': parsed_args.type.upper(), 'clients': list(ips)}
r = rest.post('/image/restore', payload=payload)