From 717a1021d30069bb1fa35df56a0ba61062fea84f Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Thu, 21 Dec 2023 13:40:38 +0100 Subject: images: Remove option to specify repo 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 --- cli/objects/images.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'cli/objects/images.py') diff --git a/cli/objects/images.py b/cli/objects/images.py index 78c6135..a094469 100644 --- a/cli/objects/images.py +++ b/cli/objects/images.py @@ -118,11 +118,6 @@ class OgImage(): nargs='?', required=True, help='Image description') - parser.add_argument('--repo-id', - nargs='?', - default=1, - type=int, - help='Images repository id (Default: 1)') group = parser.add_argument_group('clients', 'Client selection args') group.add_argument('--client-ip', action='append', @@ -133,6 +128,7 @@ class OgImage(): r = rest.get('/client/info', payload={'client': parsed_args.client_ip}) center_id = r.json()['center'] + repo_id = r.json()['repo_id'] r = rest.get('/client/setup', payload={'client': parsed_args.client_ip}) @@ -147,10 +143,9 @@ class OgImage(): payload = {'clients': parsed_args.client_ip, 'disk': parsed_args.disk, 'center_id': center_id, 'partition': parsed_args.part, 'code': str(fs_code), 'name': parsed_args.name, - 'id': '0'} + 'id': '0', 'repository_id': repo_id} if parsed_args.desc: payload['description'] = parsed_args.desc - payload['repository_id'] = parsed_args.repo_id rest.post('/image/create', payload=payload) @@ -174,11 +169,6 @@ class OgImage(): required=False, default=False, help='Create a backup before updating the image (No backup is created by default)') - parser.add_argument('--repo-id', - nargs='?', - default=1, - type=int, - help='Images repository id (Default: 1)') group = parser.add_argument_group('clients', 'Client selection args') group.add_argument('--client-ip', action='append', @@ -189,6 +179,7 @@ class OgImage(): r = rest.get('/client/info', payload={'client': parsed_args.client_ip}) center_id = r.json()['center'] + repo_id = int(r.json()['repo_id']) r = rest.get('/client/setup', payload={'client': parsed_args.client_ip}) @@ -215,7 +206,7 @@ class OgImage(): else: print(f'Updating {image_name} image') - payload = {'repository_id': parsed_args.repo_id, + payload = {'repository_id': repo_id, 'clients': parsed_args.client_ip, 'partition': parsed_args.part, 'backup': parsed_args.backup, -- cgit v1.2.3-18-g5258