update image: add optional --backup parameter

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
master v0.3
Jose M. Guisado 2023-07-19 17:46:24 +02:00
parent 5e546fbee2
commit 82e8880841
1 changed files with 11 additions and 5 deletions

View File

@ -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)