KSP-CKAN / NetKAN-Infra

NetKAN Infrastructure Repo
MIT License
3 stars 6 forks source link

Ensure ModStatus.resources isn't None #330

Closed HebaruSan closed 8 months ago

HebaruSan commented 8 months ago

Problem

Instead of working, the Indexer has been spamming errors:

netkan.status.ModStatus.DoesNotExist: Item does not exist

During handling of the above exception, another exception occurred:

  File "/home/netkan/.local/lib/python3.10/site-packages/netkan/indexer.py", line 152, in _process_ckan
    ModStatus(**self.status_attrs(True)).save()

pynamodb.exceptions.AttributeNullError: Attribute 'resources' cannot be None

Cause

The ModStatus.resources pynamodb column both defaults to None and forbids it as a value. Somehow this was tripped after KSP-CKAN/NetKAN#9958 and KSP-CKAN/NetKAN#9960.

Changes

Now the default for this column is dict, which is how pynamodb requires you to say {}.

https://pynamodb.readthedocs.io/en/latest/api.html#pynamodb.attributes.Attribute