create image: make --desc option optional

--desc option is used only when creating a new image.

A new image is any image that is not defined in the
OpenGnsys DB.

See commit d2f20d0be06617f421eecca111449d94672695eb
(#942 Create DB image when calling POST /image/create)
master
Jose M. Guisado 2022-05-10 15:48:22 +02:00 committed by Jose M. Guisado Gomez
parent 5c1137662e
commit fca68171b6
1 changed files with 6 additions and 3 deletions

View File

@ -112,8 +112,8 @@ class OgImage():
help='Image name')
parser.add_argument('--desc',
nargs='?',
required=True,
help='Image description')
required=False,
help='Image description (for new images)')
parser.add_argument('--repo',
nargs='?',
default=urlparse(rest.URL).netloc,
@ -141,5 +141,8 @@ 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,
'repository': parsed_args.repo, 'id': '0', 'description': parsed_args.desc}
'repository': parsed_args.repo, 'id': '0'}
if parsed_args.desc:
payload['description'] = parsed_args.desc
rest.post('/image/create', payload=payload)