summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-07-19 17:46:24 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-07-20 12:05:45 +0200
commit82e8880841e31a37060b3d2e5b7dd25abd9b91cf (patch)
tree07d5005dc013ed1bd8dba3e01fa511fd99d3e6ad
parent5e546fbee20bce6c78ccf562c9cde43500fe1b0c (diff)
update image: add optional --backup parameterv0.3
Add support for backup image file when running the image update command. For this optional parameter to be useful, the target ogServer and ogClient must also support the 'backup' parameter. See commits: ogServer 74b6e3ec7275164e2ecbf6f98b24357b2a9bb174 ogClient 035995fc8c55740693575ca5f7b408bfc46c1f7d
-rw-r--r--cli/objects/images.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/cli/objects/images.py b/cli/objects/images.py
index 3bed476..f0e2076 100644
--- a/cli/objects/images.py
+++ b/cli/objects/images.py
@@ -169,6 +169,11 @@ class OgImage():
nargs='?',
required=True,
help='Image id')
+ parser.add_argument('--backup',
+ action='store_true',
+ 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,
@@ -210,13 +215,14 @@ class OgImage():
else:
print(f'Updating {image_name} image')
- payload = {'clients': parsed_args.client_ip,
+ payload = {'repository_id': parsed_args.repo_id,
+ 'clients': parsed_args.client_ip,
+ 'partition': parsed_args.part,
+ 'backup': parsed_args.backup,
'disk': parsed_args.disk,
'center_id': center_id,
- 'partition': parsed_args.part,
- 'code': str(fs_code),
'id': parsed_args.id,
- 'name': image_name,
- 'repository_id': parsed_args.repo_id}
+ 'code': str(fs_code),
+ 'name': image_name}
rest.post('/image/create', payload=payload)