diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-10 15:48:22 +0200 |
---|---|---|
committer | Jose M. Guisado Gomez <guigom@riseup.net> | 2022-05-10 16:19:17 +0200 |
commit | fca68171b66db9b39d6b13aa55ec1525f04b0d45 (patch) | |
tree | c0cf66b60099c04cfdc29f70bbd2fb911cd4c329 | |
parent | 5c1137662e3f5c6c0793b038944853b43c391239 (diff) |
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)
-rw-r--r-- | cli/objects/images.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/objects/images.py b/cli/objects/images.py index 4383d4c..cf42dd4 100644 --- a/cli/objects/images.py +++ b/cli/objects/images.py @@ -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) |