EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 441ad3ed authored by Fabian Schindler's avatar Fabian Schindler
Browse files

Allow case where no mapping is found for a product

parent fdf46046
No related branches found
No related tags found
1 merge request!82Staging to master
......@@ -257,13 +257,22 @@ class EOxServerBackend(Backend):
stac_item = read_json(source, item.path)
if not item.product_type:
if not mapping:
product_type, _ = create_product_type_from_stac_item(
stac_item,
product_type_name=item.product_type,
ignore_existing=True,
coverage_mapping=None
)
elif not item.product_type:
product_type, _ = create_product_type_from_stac_item(
stac_item,
product_type_name=None,
ignore_existing=True,
coverage_mapping=mapping.get('coverages', {})
)
else:
try:
product_type = mapping['product_type_name']
......@@ -297,11 +306,12 @@ class EOxServerBackend(Backend):
)
# get the mapping for this particular item
mapping = {}
try:
type_mapping = self.mapping[item.product_type]
mapping = type_mapping.get(item.product_level) or type_mapping.get(None) or {}
except KeyError:
raise RegistrationError(f'Could not find mapping for {item.product_type} in configuration')
mapping = type_mapping.get(item.product_level) or type_mapping.get(None) or {}
pass
# branch here for STAC Item registration, as a product type can be dynamically generated
if item.scheme == 'stac-item':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment