Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions osidb/management/commands/sync_errata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError

from collectors.errata.core import get_erratum, link_bugs_to_errata
from osidb.core import set_user_acls


class Command(BaseCommand):
help = "Synchronize a list of errata by id to OSIDB"

def add_arguments(self, parser):
parser.add_argument(
"errata_id", nargs="*", type=str, help="errata id list (e.g. 1234 5678)"
)

def handle(self, *args, **options):
if not args:
raise CommandError("You must provide a list of IDs.")
set_user_acls(settings.ALL_GROUPS)
erratum_json_list = [get_erratum(errata_id) for errata_id in args]
link_bugs_to_errata(erratum_json_list)
Comment on lines +20 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be ideal for longer lists as any random failure during the process of getting the errata from ET would just fail the whole syncing process.

Loading