Fix get_or_create tuple unpacking in catalog_zone_manager

v1.5.6 fixed the wrong RelatedObjectDoesNotExist import and the catz
member-identifier creation, but two get_or_create() calls still used the
returned value directly instead of unpacking the (obj, created) tuple:

- increment_soa_serial(): `soa_serial_obj.value` on a tuple
- _create_soa_rdataset(): `.get_or_create(...).value` on a tuple

Both raised `'tuple' object has no attribute 'value'` at runtime — the
first on every zone save, the second on every catalog-zone (catz) query.
Unpack the tuple in both places.
This commit is contained in:
d_ev committed 2026-07-15 22:44:53 +03:00
1 parent 41d48f2807
commit db09fd70be
1 file changed
+4 -3
+4 -3
View File
@@ -15,7 +15,7 @@ LOGGER = get_logger(__name__)
def increment_soa_serial() -> int: def increment_soa_serial() -> int:
with transaction.atomic(): with transaction.atomic():
try: try:
soa_serial_obj = ( soa_serial_obj, _ = (
IntegerKeyValueSetting.objects.select_for_update().get_or_create( IntegerKeyValueSetting.objects.select_for_update().get_or_create(
key="catalog-zone-soa-serial", key="catalog-zone-soa-serial",
defaults={"value": 1}, defaults={"value": 1},
@@ -137,9 +137,10 @@ def update_member_identifier(zone: NBZone) -> None:
def _create_soa_rdataset() -> dns.rdataset: def _create_soa_rdataset() -> dns.rdataset:
try: try:
serial = IntegerKeyValueSetting.objects.get_or_create( serial_obj, _ = IntegerKeyValueSetting.objects.get_or_create(
key="catalog-zone-soa-serial", defaults={"value": 1} key="catalog-zone-soa-serial", defaults={"value": 1}
).value )
serial = serial_obj.value
# SOA Record components # SOA Record components
ttl = 0 ttl = 0