thoth-station / storages

Storage and database adapters for project Thoth
https://thoth-station.github.io/
GNU General Public License v3.0
14 stars 16 forks source link

package_license metadata throwing attribute error #2703

Closed harshad16 closed 2 years ago

harshad16 commented 2 years ago

Bug description

The graph sync job which uses storage to sync data to the database is failing. with the following issue:

  File "app.py", line 125, in _do_sync
    stats = sync_documents(
  File "/opt/app-root/lib64/python3.8/site-packages/thoth/storages/sync.py", line 616, in sync_documents
    stats_change = handler(
  File "/opt/app-root/lib64/python3.8/site-packages/thoth/storages/sync.py", line 143, in sync_solver_documents
    graph.sync_solver_result(document, force=force)
  File "/opt/app-root/lib64/python3.8/site-packages/thoth/storages/graph/postgres.py", line 6051, in sync_solver_result
    license_name=package_license["license"].get("full_name"),
AttributeError: 'str' object has no attribute 'get'

Steps to Reproduce

Steps to reproduce the behavior:

  1. Schedule an solver run
  2. See error

Additional context

solver-rhel-8-py38-220914201834-2e90a53ac16cc0b0-3334486321-main.log

harshad16 commented 2 years ago

/sig stack-guidance /priority critical-urgent

This is required for unblocking ingestion.

mayaCostantini commented 2 years ago

From the logs, it seems like we don't handle properly the case when the license is undetected:

license {'license': 'UNDETECTED', 'license_identifier': 'UNDETECTED', 'license_version': 'UNDETECTED', 'warning': True}

We should catch the UNDETECTED values and set the corresponding fields to None.

harshad16 commented 2 years ago

This has been fixed with help of the pr and issue linked in this issue. with update in database with https://github.com/thoth-station/storages/issues/2713#issuecomment-1252833725 we can be close this for now. thanks everyone for working on this.