Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix entity refresh for entities that have not been migrated #4378

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Sep 5, 2024

Summary

  • Add a setter for properties - Adds a utility function to set a property so that we don't have to construct a map to construct properties to merge properties.
  • Derive the name property from entity name for entities that have not migrated fully - We have entities in the database that have an entity instance, but no corresponding property because they have not been migrated properly. In that case, we can't use properties to refresh the entity because the properties are not there. The entity itself has a name, though, so let's use it to backfill the name property so that the properties object can always be used to refresh the rest.
  • Improve error message - This would actually tell us what entity failed to refresh

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

unit tests

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

Adds a utility function to set a property so that we don't have to
construct a map to construct properties to merge properties.
…migrated fully

We have entities in the database that have an entity instance, but no
corresponding property because they have not been migrated properly. In
that case, we can't use properties to refresh the entity because the
properties are not there. The entity itself has a name, though, so let's
use it to backfill the name property so that the properties object can
always be used to refresh the rest.
This would actually tell us what entity failed to refresh
@coveralls
Copy link

Coverage Status

coverage: 52.865% (+0.1%) from 52.75%
when pulling 34db5a6 on jhrozek:fix_entity_lookup
into 2056a62 on stacklok:main.

@jhrozek jhrozek merged commit c8c9c1d into mindersec:main Sep 5, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants