diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2023-12-19 13:15:09 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2023-12-19 13:22:01 +0100 |
commit | 906c3070edd8973df823f60ea935f1985625c8d6 (patch) | |
tree | e057339a2184488a633bdc6439217e3a3a7ba4cf /ogcp | |
parent | 3c7e3e1e3b64a1570834cf07a0002e296136c935 (diff) |
views: Fix bug in client detail with non existing imagesv1.1.3-10
Fix client detail form failing in some cases. It would fail if the user
wanted to view the details of a client, that had a partition using an
image that is no longer in the list of all images stored by the servers.
This could happen if the image was deleted, but the client still was using
the image in one of its partitions
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 7345700..766db70 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -888,8 +888,11 @@ def action_client_info(): for entry in setup: if images and entry['image'] != 0: - image = next(img for img in images if img['id'] == entry['image']) - entry['image'] = image['name'] + image = next((img for img in images if img['id'] == entry['image']), None) + if image: + entry['image'] = image['name'] + else: + entry['image'] = "" else: entry['image'] = "" |