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:
1 parent
41d48f2807
commit
db09fd70be
1 file changed
+4
-3
@@ -15,7 +15,7 @@ LOGGER = get_logger(__name__)
|
||||
def increment_soa_serial() -> int:
|
||||
with transaction.atomic():
|
||||
try:
|
||||
soa_serial_obj = (
|
||||
soa_serial_obj, _ = (
|
||||
IntegerKeyValueSetting.objects.select_for_update().get_or_create(
|
||||
key="catalog-zone-soa-serial",
|
||||
defaults={"value": 1},
|
||||
@@ -137,9 +137,10 @@ def update_member_identifier(zone: NBZone) -> None:
|
||||
|
||||
def _create_soa_rdataset() -> dns.rdataset:
|
||||
try:
|
||||
serial = IntegerKeyValueSetting.objects.get_or_create(
|
||||
serial_obj, _ = IntegerKeyValueSetting.objects.get_or_create(
|
||||
key="catalog-zone-soa-serial", defaults={"value": 1}
|
||||
).value
|
||||
)
|
||||
serial = serial_obj.value
|
||||
|
||||
# SOA Record components
|
||||
ttl = 0
|
||||
|
||||
Reference in new issue
Block a user