From 15a2e8d3a65f9d2929510940d1dd7b8db48b3540 Mon Sep 17 00:00:00 2001 From: osoukup Date: Mon, 25 Nov 2024 16:41:34 +0100 Subject: [PATCH] tmp --- osidb/models/flaw/flaw.py | 3 +++ osidb/sync_manager.py | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/osidb/models/flaw/flaw.py b/osidb/models/flaw/flaw.py index dbb65e53f..0b8f0d66f 100644 --- a/osidb/models/flaw/flaw.py +++ b/osidb/models/flaw/flaw.py @@ -1100,6 +1100,9 @@ def _create_task(): task_download_manager = models.ForeignKey( JiraTaskDownloadManager, null=True, blank=True, on_delete=models.CASCADE ) + # task_sync_manager = models.ForeignKey( + # JiraTaskSyncManager, null=True, blank=True, on_delete=models.CASCADE + # ) bzsync_manager = models.ForeignKey( BZSyncManager, null=True, blank=True, on_delete=models.CASCADE ) diff --git a/osidb/sync_manager.py b/osidb/sync_manager.py index c7b0f66f4..5dd6f28dd 100644 --- a/osidb/sync_manager.py +++ b/osidb/sync_manager.py @@ -690,6 +690,50 @@ def __str__(self): return result +# class JiraTaskSyncManager(SyncManager): +# """ +# Sync manager class for OSIDB => Jira Task synchronization. +# """ + +# @staticmethod +# @app.task(name="sync_manager.jira_task_sync", bind=True) +# def sync_task(self, flaw_id): +# """ +# perform the sync of the task of the given flaw to Jira + +# the task may not be exising yet when performing the first +# sync therefore we use the flaw UUID as the identifier +# """ +# from osidb.models import Flaw + +# JiraTaskSyncManager.started(flaw_id, self) + +# set_user_acls(settings.ALL_GROUPS) + +# try: +# flaw = Flaw.objects.get(uuid=flaw_id) +# flaw._perform_tasksync() +# except Exception as e: +# JiraTaskSyncManager.failed(flaw_id, e) +# else: +# JiraTaskSyncManager.finished(flaw_id) + +# def update_synced_links(self): +# from osidb.models import Flaw + +# Flaw.objects.filter(uuid=self.sync_id).update(bzsync_manager=self) + +# def __str__(self): +# from osidb.models import Flaw + +# result = super().__str__() +# flaws = Flaw.objects.filter(uuid=self.sync_id) +# cves = [f.cve_id or f.uuid for f in flaws] +# result += f"Flaws: {cves}\n" + +# return result + + class JiraTrackerDownloadManager(SyncManager): """ Sync manager class for Jira => OSIDB Tracker synchronization.