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

RHINENG-2867: fix store to advisory metadata and system advisories when update does not have an erratum #1337

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

psegedy
Copy link
Member

@psegedy psegedy commented Nov 6, 2023

When vmaas (or yum_updates) reports an update without erratum, then this erratum is returned as '' by getReportedAdvisories and in turn getAdvisoriesFromDB creates empty AdvisoryMetadata{} due to an issue with slice initialization. Empty AdvisoryMetadata has ID: 0 which cannot be stored to system_advisories since advisory with id=0 does not exist in advisory_metadata table.

2023/11/06 16:26:10 /go/src/app/evaluator/evaluate_advisories.go:149
[0.916ms] [rows:0] SELECT id, name FROM "advisory_metadata" WHERE name IN ('')
{"@timestamp":"2023-11-06T16:26:10.118Z","installable":1,"inventoryID":"b46d27c1-a747-4638-8c3a-1362bd5efa22","level":"info","message":"installable advisories"}

2023/11/06 16:26:10 /go/src/app/base/database/batch.go:72 ERROR: insert or update on table "system_advisories_24" violates foreign key constraint "advisory_metadata_id" (SQLSTATE 23503)
[1.183ms] [rows:-] INSERT INTO "system_advisories" ("advisory_id", "first_reported", "rh_account_id", "status_id", "system_id") VALUES (0, NULL, 1, 0, 4200239) ON CONFLICT (rh_account_id, system_id, advisory_id) DO UPDATE SET status_id = excluded.status_id RETURNING *
{"@timestamp":"2023-11-06T16:26:10.124Z","err":"unable to evaluate in database: evaluation with vmaas failed: Unable to evaluate and store results: Advisory analysis failed: Unable to store advisory data: Unable to update system advisories: ERROR: insert or update on table \"system_advisories_24\" violates foreign key constraint \"advisory_metadata_id\" (SQLSTATE 23503)","evalLabel":"upload","inventoryID":"b46d27c1-a747-4638-8c3a-1362bd5efa22","level":"error","message":"Eval message handling"}

Secure Coding Practices Checklist GitHub Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Copy link

jira-linking bot commented Nov 6, 2023

Referenced Jiras:
https://issues.redhat.com/browse/RHINENG-2867

@psegedy psegedy requested a review from MichaelMraka November 6, 2023 17:08
@psegedy psegedy merged commit bbc1205 into RedHatInsights:master Nov 7, 2023
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.

2 participants