Skip to content

Commit 2a9aff3

Browse files
committed
add sync_errata command for easier manual linking
1 parent 4d33907 commit 2a9aff3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from django.conf import settings
2+
from django.core.management.base import BaseCommand, CommandError
3+
4+
from collectors.errata.core import get_erratum, link_bugs_to_errata
5+
from osidb.core import set_user_acls
6+
7+
8+
class Command(BaseCommand):
9+
help = "Synchronize a list of errata by id to OSIDB"
10+
set_user_acls(settings.ALL_GROUPS)
11+
12+
def add_arguments(self, parser):
13+
parser.add_argument(
14+
"errata_id", nargs="*", type=str, help="errata id list (e.g. 1234 5678)"
15+
)
16+
17+
def handle(self, *args, **options):
18+
if not args:
19+
raise CommandError("You must provide a list of IDs.")
20+
erratum_json_list = [get_erratum(errata_id) for errata_id in args]
21+
link_bugs_to_errata(erratum_json_list)

0 commit comments

Comments
 (0)