launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29305
[Merge] ~lgp171188/launchpad:handle-alternative-esm-format-uctimport into launchpad:master
Guruprasad has proposed merging ~lgp171188/launchpad:handle-alternative-esm-format-uctimport into launchpad:master.
Commit message:
Handle another esm name format in the uct import script
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/431501
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:handle-alternative-esm-format-uctimport into launchpad:master.
diff --git a/lib/lp/bugs/scripts/tests/test_uct.py b/lib/lp/bugs/scripts/tests/test_uct.py
index 00bc2c8..2f27ef0 100644
--- a/lib/lp/bugs/scripts/tests/test_uct.py
+++ b/lib/lp/bugs/scripts/tests/test_uct.py
@@ -428,6 +428,17 @@ class TestCVE(TestCaseWithFactory):
self.assertListEqual(self.uct_record.packages, uct_record.packages)
self.assertDictEqual(self.uct_record.__dict__, uct_record.__dict__)
+ def test_get_distro_series_esm_patterns(self):
+ ubuntu_esm = self.factory.makeDistribution(name="ubuntu-esm")
+ xenial = self.factory.makeDistroSeries(
+ distribution=ubuntu_esm, name="xenial"
+ )
+ precise = self.factory.makeDistroSeries(
+ distribution=ubuntu_esm, name="precise"
+ )
+ self.assertEqual(xenial, CVE.get_distro_series("esm-infra/xenial"))
+ self.assertEqual(precise, CVE.get_distro_series("precise/esm"))
+
class TestUCTImporterExporter(TestCaseWithFactory):
diff --git a/lib/lp/bugs/scripts/uct/models.py b/lib/lp/bugs/scripts/uct/models.py
index b7b7f6e..e5405b5 100644
--- a/lib/lp/bugs/scripts/uct/models.py
+++ b/lib/lp/bugs/scripts/uct/models.py
@@ -805,9 +805,14 @@ class CVE:
cls, distro_series_name: str
) -> Optional[DistroSeries]:
if "/" in distro_series_name:
- series_name, distro_name = distro_series_name.split("/", 1)
- if distro_name == "esm":
+ if distro_series_name.startswith("esm-"):
distro_name = "ubuntu-esm"
+ series_name = distro_series_name.split("/", 1)[1]
+ elif distro_series_name.endswith("/esm"):
+ distro_name = "ubuntu-esm"
+ series_name = distro_series_name.split("/", 1)[0]
+ else:
+ series_name, distro_name = distro_series_name.split("/", 1)
else:
distro_name = "ubuntu"
series_name = distro_series_name