Check description before using it in update_zone()

... so that we don't throw a KeyError because the
description key is not in the dictionary.

Closes-Bug: #2120952
Change-Id: Id690070d282ba765eacfdcac8cdee30dd32d544d
Signed-off-by: Tobias Urdin <tobias.urdin@binero.com>
This commit is contained in:
Tobias Urdin
2025-08-19 16:38:20 +02:00
parent 7ef1bf9a07
commit 9f8657df9f

View File

@@ -64,9 +64,10 @@ def update_zone(request, **kwargs):
conn = get_sdk_connection(request)
build_kwargs = dict(
email=data['email'],
description=data['description'],
ttl=data['ttl'],
)
if data.get('description', None):
build_kwargs['description'] = data['description']
zone = conn.dns.update_zone(
zone_id, **build_kwargs)
return zone.to_dict()