-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1587 from aboutcode-org/nvd-importer-pipeline
Migrate NVD importer to aboutcode pipeline
- Loading branch information
Showing
7 changed files
with
145 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
vulnerabilities/migrations/0068_update_nvd_advisory_created_by.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 4.2.15 on 2024-09-27 19:38 | ||
|
||
from django.db import migrations | ||
|
||
""" | ||
Update the created_by field on Advisory from the old qualified_name | ||
to the new pipeline_id. | ||
""" | ||
|
||
|
||
def update_created_by(apps, schema_editor): | ||
from vulnerabilities.pipelines.nvd_importer import NVDImporterPipeline | ||
|
||
Advisory = apps.get_model("vulnerabilities", "Advisory") | ||
Advisory.objects.filter(created_by="vulnerabilities.importers.nvd.NVDImporter").update( | ||
created_by=NVDImporterPipeline.pipeline_id | ||
) | ||
|
||
|
||
|
||
def reverse_update_created_by(apps, schema_editor): | ||
from vulnerabilities.pipelines.nvd_importer import NVDImporterPipeline | ||
|
||
Advisory = apps.get_model("vulnerabilities", "Advisory") | ||
Advisory.objects.filter(created_by=NVDImporterPipeline.pipeline_id).update( | ||
created_by="vulnerabilities.importers.nvd.NVDImporter" | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("vulnerabilities", "0067_update_github_advisory_created_by"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_created_by, reverse_code=reverse_update_created_by), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters