#164 Remove pdc queries from pagure-dist-git
Merged 10 months ago by humaton. Opened a year ago by lenkaseg.
lenkaseg/pagure-dist-git pdc-lstree  into  master

file modified
+31 -30
@@ -34,7 +34,7 @@ 

  except ImportError:

      # From pagure 5.2, code has been moved to pagure.lib.query

      from pagure.lib.query import get_user

- from pagure.lib.git import is_forced_push

+ from pagure.lib.git import is_forced_push, read_git_output

  from pagure.lib.git_auth import GitAuthHelper, _read_file

  from pagure.utils import is_repo_collaborator

  
@@ -73,16 +73,22 @@ 

          self.protected_namespaces = pagure_config.get(

              "ACL_PROTECTED_NAMESPACES", ["rpms"]

          )

+         self.bodhi_url = pagure_config.get("BODHI_URL")

  

-         self.pdc_url = pagure_config.get("PDC_URL")

+     def is_not_retired_package(self, branch, abspath):

+         """Returns if the package is NOT retired on the branch,

+         that means it does not contain dead.package"""

+         cmd = ["ls-tree", branch, "--name-only", "--", "dead.package"]

+         return read_git_output(cmd, abspath) != "dead.package"

  

-     def is_supported_branch(self, project, refname):

+     def is_supported_branch(self, project, refname, repodir):

          """Returns whether a specific branch is currently supported for Fedora

  

          This retrieves the information about EOL status from PDC, to prevent

          EOL branches being pushed to.

          """

-         if not self.pdc_url:

+ 

+         if not self.bodhi_url:

              # No way to confirm this is a supported branch, not supported

              return None

          if not refname.startswith("refs/heads/"):
@@ -90,29 +96,23 @@ 

              return None

          refname = refname[len("refs/heads/") :]

  

-         namespace2pdctype = {

-             "rpms": "rpm",

-             "modules": "module",

-             "container": "container",

-         }

-         name = urllib.parse.quote(project.name)

-         resp = requests.get(

-             f"{self.pdc_url}component-branches/?global_component={name}"

-             f"&name={refname}&type={namespace2pdctype[project.namespace]}&fields=active"

-         )

+         # Check if the branch is active on Bodhi

+         if refname not in ["main", "rawhide"]:

+             resp = requests.get(f"{self.bodhi_url}releases/{refname}")

  

-         res = []

-         if resp.ok:

-             res = resp.json().get("results")

+             if resp.ok:

+                 resp = resp.json().get("state")

+                 if not resp:  # case when response is empty

+                     return None

+                 if resp not in ["current", "pending", "frozen"]:

+                     return False

+             else:

+                 return None

  

-         if len(res) == 0:

-             # No status

-             return None

-         if len(res) != 1:

-             # PDC couldn't make up its mind....

-             # Should never happen, but just in case...

-             raise ValueError("PDC was unable to make up its mind")

-         return res[0]["active"]

+         # Branch can be supported, but package can be retired,

+         # in that case don't push

+         active = self.is_not_retired_package(refname, repodir)

+         return active

  

      def info(self, msg):

          """Function to print information.
@@ -245,9 +245,12 @@ 

              branch_overrides = pagure_config.get("PDC_BRANCH_OVERRIDES") or {}

              if refname in (branch_overrides.get(project.namespace) or []):

                  pdc_ref = branch_overrides[project.namespace][refname]

-             is_supported = self.is_supported_branch(project, pdc_ref)

+             is_supported = self.is_supported_branch(project, pdc_ref, repodir)

              if is_supported is False:

-                 self.info("Branch %s is unsupported. Cannot push to a disabled branch (maybe eol?)." % refname)

+                 self.info(

+                     "Branch %s is unsupported. Cannot push to a disabled branch (maybe eol?)."

+                     % refname

+                 )

                  return False

              elif is_supported is True:

                  self.debug("Branch %s is supported" % refname)
@@ -257,9 +260,7 @@ 

              # This allows to block anything that is not allowed, so no

              # random branch creation.

              if self.block_unspecified:

-                 self.info(

-                     "Access to namespace %s is restricted" % project.namespace

-                 )

+                 self.info("Access to namespace %s is restricted" % project.namespace)

                  return False

  

              # For branches that are not explicitely active in PDC, check

file modified
+26 -53
@@ -108,68 +108,38 @@ 

              401, error_code=APIERROR.EMODIFYPROJECTNOTALLOWED

          )

  

-     # Check if the project is retired in PDC

-     active = _is_active_in_pdc(repo.name, repo.namespace)

+     # Check if the project is retired

+     active = _is_active_project(repo.name, repo.namespace)

  

      output = {"active": active}

      return flask.jsonify(output)

  

  

- def _is_active_in_pdc(name, namespace):

-     """Queries PDC and return whether the project is active on the master

-     branch in PDC or not.

+ def _is_active_project(name, namespace):

+     """Queries distgit/lookaside and returns whether the project is not retired

+     (=active) on the master branch in distgit lookaside or not.

      """

-     pdc_url = flask.current_app.config.get("PDC_URL")

-     if not pdc_url:

+     distgit_url = flask.current_app.config.get("APP_URL")

+     branch = "rawhide"

+     if not distgit_url:

          raise pagure.exceptions.APIError(

              500,

              error_code=APIERROR.ENOCODE,

-             error="This pagure instance has no PDC_URL configured, please "

+             error="This pagure instance has no APP_URL configured, please "

              "inform your pagure administrators",

          )

      else:

-         pdc_url = "%s/component-branches/" % pdc_url.rstrip("/")

+         _log.debug("Based distgit lookaside url: %s", distgit_url)

+         distgit_url = f"{distgit_url}lookaside/retired_in_{branch}.json"

  

-     _log.debug("Based PDC url: %s", pdc_url)

- 

-     to_pdc_namespace = {

-         "rpms": "rpm",

-         "modules": "module",

-         "container": "container",

-         "flatpaks": "flatpak",

-     }

-     to_pdc_namespace = flask.current_app.config.get("PDC_NAMESPACES") or to_pdc_namespace

- 

-     try:

-         pdc_namespace = to_pdc_namespace[namespace]

-     except Exception:

-         raise pagure.exceptions.APIError(

-             500,

-             error_code=APIERROR.ENOCODE,

-             error="Namespace: %s could not be converted to a PDC namespace" % namespace,

-         )

- 

-     branch = "master"

-     if namespace in ["rpms", "container"]:

-         branch = "rawhide"

-     elif namespace == "flatpaks":

-         branch = "stable"

- 

-     url = "%s?global_component=%s&name=%s&type=%s" % (

-         pdc_url,

-         name,

-         branch,

-         pdc_namespace,

-     )

- 

-     _log.info("Querying PDC at: %s", url)

+     _log.info("Querying distgit lookaside at: {distgit_url} (PDC is retired!)")

      try:

-         req = requests.get(url, timeout=(30, 30))

+         req = requests.get(distgit_url, timeout=(30, 30))

      except requests.RequestException as err:

          raise pagure.exceptions.APIError(

              500,

              error_code=APIERROR.ENOCODE,

-             error="An error occured while querying pdc: %s" % err,

+             error="An error occured while querying distgit lookaside: %s" % err,

          )

  

      try:
@@ -181,8 +151,8 @@ 

              error="The output of %s could not be converted to JSON" % req.url,

          )

  

-     _log.info("%s/%s is active: %s", namespace, name, data["results"][0]["active"])

-     return data["results"][0]["active"] is True

+     _log.info("%s/%s is active: %s", namespace, name, name not in data[branch])

+     return name not in req

  

  

  @DISTGIT_NS.route("/orphan/<namespace>/<repo>", methods=["GET"])
@@ -355,8 +325,8 @@ 

              errors="You must be a packager to adopt a package.",

          )

  

-     # Check if the project is retired in PDC

-     if not _is_active_in_pdc(repo.name, repo.namespace):

+     # Check if the project is not retired

+     if not _is_active_project(repo.name, repo.namespace):

          raise pagure.exceptions.APIError(

              400,

              error_code=APIERROR.EINVALIDREQ,
@@ -439,10 +409,13 @@ 

              errors="You must be in rel-eng or admin group to assign a package.",

          )

  

-     user=flask.request.values.get('user')

+     user = flask.request.values.get("user")

      if not user:

-         raise pagure.exceptions.APIError(404, error_code=APIERROR.ENOUSER,

-             errors="You have to specify a user as point_of_contact.")

+         raise pagure.exceptions.APIError(

+             404,

+             error_code=APIERROR.ENOUSER,

+             errors="You have to specify a user as point_of_contact.",

+         )

  

      user_obj = pagure.lib.query.get_user(flask.g.session, user)

  
@@ -460,8 +433,8 @@ 

              errors="The new POC must be a packager to adopt a package.",

          )

  

-     # Check if the project is retired in PDC

-     if not _is_active_in_pdc(repo.name, repo.namespace):

+     # Check if the project is retired

+     if not _is_active_project(repo.name, repo.namespace):

          raise pagure.exceptions.APIError(

              400,

              error_code=APIERROR.EINVALIDREQ,

@@ -1,4 +1,5 @@ 

  from __future__ import print_function

+ import os

  

  import dist_git_auth

  
@@ -405,6 +406,7 @@ 

          "RCM_BRANCHES": ["refs/heads/f[0-9]+"],

          "ACL_PROTECTED_NAMESPACES": ["rpms", "modules", "container"],

          "PDC_URL": "invalid://",

+         "BODHI_URL": "invalid://",

      }

  

      def test_protected_blacklisted_ref(self):
@@ -451,7 +453,28 @@ 

      def test_protected_unsupported_branch(self, mock_requests):

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": [{"active": False}]}

+         res.json.return_value = {

+             "name": "F34",

+             "long_name": "Fedora 34",

+             "version": "34",

+             "id_prefix": "FEDORA",

+             "branch": "f34",

+             "dist_tag": "f34",

+             "stable_tag": "f34-updates",

+             "testing_tag": "f34-updates-testing",

+             "candidate_tag": "f34-updates-candidate",

+             "pending_signing_tag": "f34-signing-pending",

+             "pending_testing_tag": "f34-updates-testing-pending",

+             "pending_stable_tag": "f34-updates-pending",

+             "override_tag": "f34-override",

+             "mail_template": "fedora_errata_template",

+             "state": "archived",

+             "composed_by_bodhi": True,

+             "create_automatic_updates": False,

+             "package_manager": "dnf",

+             "testing_repository": "updates-testing",

+             "eol": None,

+         }

          mock_requests.get.return_value = res

          project = self.create_namespaced_project("rpms", "test")

  
@@ -470,14 +493,37 @@ 

              )

          )

  

-         self.expect_info_msg("Branch refs/heads/f26 is unsupported. Cannot push to a disabled branch (maybe eol?).")

+         self.expect_info_msg(

+             "Branch refs/heads/f26 is unsupported. Cannot push to a disabled branch (maybe eol?)."

+         )

  

      @patch("dist_git_auth.requests")

      def test_protected_supported_branch_committer(self, mock_requests):

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": [{"active": True}]}

+         res.json.return_value = {

+             "name": "F39",

+             "long_name": "Fedora 39",

+             "version": "39",

+             "id_prefix": "FEDORA",

+             "branch": "f39",

+             "dist_tag": "f39",

+             "stable_tag": "f39-updates",

+             "testing_tag": "f39-updates-testing",

+             "candidate_tag": "f39-updates-candidate",

+             "pending_signing_tag": "f39-signing-pending",

+             "pending_testing_tag": "f39-updates-testing-pending",

+             "pending_stable_tag": "f39-updates-pending",

+             "override_tag": "f39-override",

+             "mail_template": "fedora_errata_template",

+             "state": "current",

+             "composed_by_bodhi": True,

+             "create_automatic_updates": False,

+             "package_manager": "dnf",

+             "testing_repository": "updates-testing",

+             "eol": "2024-11-12",

+         }

          mock_requests.get.return_value = res

  

          self.assertTrue(
@@ -502,7 +548,28 @@ 

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": [{"active": True}]}

+         res.json.return_value = {

+             "name": "F39",

+             "long_name": "Fedora 39",

+             "version": "39",

+             "id_prefix": "FEDORA",

+             "branch": "f39",

+             "dist_tag": "f39",

+             "stable_tag": "f39-updates",

+             "testing_tag": "f39-updates-testing",

+             "candidate_tag": "f39-updates-candidate",

+             "pending_signing_tag": "f39-signing-pending",

+             "pending_testing_tag": "f39-updates-testing-pending",

+             "pending_stable_tag": "f39-updates-pending",

+             "override_tag": "f39-override",

+             "mail_template": "fedora_errata_template",

+             "state": "current",

+             "composed_by_bodhi": True,

+             "create_automatic_updates": False,

+             "package_manager": "dnf",

+             "testing_repository": "updates-testing",

+             "eol": "2024-11-12",

+         }

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -527,7 +594,7 @@ 

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -547,12 +614,23 @@ 

  

          self.expect_info_msg("Unspecified ref refs/heads/f28 is blocked")

  

+     def test_is_not_retired_package(self):

+         projects = tests.create_projects_git(os.path.join(self.path, "repos"), bare=True)

+         tests.add_content_git_repo(projects[0])

+         self.assertTrue(self.dga.is_not_retired_package("master", projects[0]))

+ 

+     def test_is_not_retired_package_false(self):

+         projects = tests.create_projects_git(os.path.join(self.path, "repos"), bare=True)

+         tests.add_content_git_repo(projects[0])

+         tests.add_readme_git_repo(projects[0], readme_name="dead.package")

+         self.assertFalse(self.dga.is_not_retired_package("master", projects[0]))

+ 

      @patch("dist_git_auth.requests")

      def test_protected_unspecified_branch_normal_committer(self, mock_requests):

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertTrue(
@@ -577,7 +655,7 @@ 

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -608,6 +686,7 @@ 

          "RCM_BRANCHES": ["refs/heads/f[0-9]+"],

          "ACL_PROTECTED_NAMESPACES": ["rpms", "modules", "container"],

          "PDC_URL": "invalid://",

+         "BODHI_URL": "invalid://",

      }

  

      def setUp(self):
@@ -633,7 +712,7 @@ 

          project = get_project(self.session, name="test", namespace="rpms")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -659,7 +738,7 @@ 

          project = get_project(self.session, name="test", namespace="rpms")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertTrue(
@@ -801,7 +880,7 @@ 

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -826,7 +905,7 @@ 

          project = self.create_namespaced_project("rpms", "test")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -857,6 +936,7 @@ 

          "RCM_BRANCHES": ["refs/heads/f[0-9]+"],

          "ACL_PROTECTED_NAMESPACES": ["rpms", "modules", "container"],

          "PDC_URL": "invalid://",

+         "BODHI_URL": "invalid://",

          "PDC_BRANCH_OVERRIDES": {"rpms": {"refs/heads/main": "refs/heads/rawhide"}},

      }

  
@@ -880,11 +960,11 @@ 

          self.assertEqual(msg, "User added")

  

      @patch("dist_git_auth.requests")

-     def test_pushing_to_rpms_main_calls_pdc_correctly(self, mock_requests):

+     def test_pushing_to_rpms_main_calls_bodhi_correctly(self, mock_requests):

          project = get_project(self.session, name="test", namespace="rpms")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -905,17 +985,14 @@ 

          self.expect_info_msg("Committer: False")

          self.expect_info_msg("Fall-through deny")

  

-         mock_requests.get.assert_called_with(

-             "invalid://component-branches/?global_component=test"

-             "&name=rawhide&type=rpm&fields=active"

-         )

+         mock_requests.get.assert_not_called()

  

      @patch("dist_git_auth.requests")

      def test_pushing_to_rpms_rawhide_calls_pdc_correctly(self, mock_requests):

          project = get_project(self.session, name="test", namespace="rpms")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertFalse(
@@ -936,17 +1013,14 @@ 

          self.expect_info_msg("Committer: False")

          self.expect_info_msg("Fall-through deny")

  

-         mock_requests.get.assert_called_with(

-             "invalid://component-branches/?global_component=test"

-             "&name=rawhide&type=rpm&fields=active"

-         )

+         mock_requests.get.assert_not_called()

  

      @patch("dist_git_auth.requests")

-     def test_pushing_to_containers_calls_pdc_correctly(self, mock_requests):

+     def test_pushing_to_containers_calls_bodhi_correctly(self, mock_requests):

          project = get_project(self.session, name="cockpit", namespace="container")

          res = Mock()

          res.ok = True

-         res.json.return_value = {"results": []}

+         res.json.return_value = {}

          mock_requests.get.return_value = res

  

          self.assertTrue(
@@ -967,7 +1041,4 @@ 

          self.expect_info_msg("Committer: True")

          self.expect_info_msg("Committer push")

  

-         mock_requests.get.assert_called_with(

-             "invalid://component-branches/?global_component=cockpit"

-             "&name=epel8&type=container&fields=active"

-         )

+         mock_requests.get.assert_called_with("invalid://releases/epel8")

@@ -366,11 +366,11 @@ 

          )

          assert output.status_code == 401

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

+     @patch("pagure_distgit.plugin._is_active_project")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

-     def test_take_orphan(self, mock_log, mock_pdc):

+     def test_take_orphan(self, mock_log, mock_is_active_project):

          """Assert that package is correctly adopted."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          repo = pagure.lib.query.get_authorized_project(

              self.session,
@@ -393,7 +393,7 @@ 

  

          assert mock_log.call_count == 1

  

-     @patch.dict("pagure.config.config", {"PDC_URL": "invalid://"})

+     @patch.dict("pagure.config.config", {"APP_URL": "invalid://"})

      @patch("pagure_distgit.plugin.requests")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

      def test_take_orphan_no_reason(self, mock_log, mock_req):
@@ -403,7 +403,9 @@ 

          """

          resp = MagicMock()

          resp.url = "http://localhost"

-         resp.json.return_value = {"results": [{"active": True}]}

+         resp.json.return_value = {

+             "rawhide": ["advancecomp", "ahc-tools", "airsched", "amavisd-new"]

+         }

          mock_req.get.return_value = resp

          headers = {"Authorization": "token aaabbbcccddd"}

          repo = pagure.lib.query.get_authorized_project(
@@ -430,15 +432,14 @@ 

  

          assert mock_req.get.call_count == 1

          mock_req.get.assert_called_with(

-             "invalid:/component-branches/?"

-             "global_component=test4&name=rawhide&type=rpm",

+             "invalid://lookaside/retired_in_rawhide.json",

              timeout=(30, 30),

          )

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

-     def test_give_orphan_no_user(self, mock_pdc):

+     @patch("pagure_distgit.plugin._is_active_project")

+     def test_give_orphan_no_user(self, mock_is_active_project):

          """Assert that the point_of_contact cannot be updated without specifying user."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          repo = pagure.lib.query.get_authorized_project(

              self.session,
@@ -455,11 +456,11 @@ 

          assert data["error_code"] == "ENOUSER"

          assert data["errors"] == "You have to specify a user as point_of_contact."

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

+     @patch("pagure_distgit.plugin._is_active_project")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

-     def test_give_orphan(self, mock_log, mock_pdc):

+     def test_give_orphan(self, mock_log, mock_is_active_project):

          """Assert that point of contact is correctly updated."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          orphan_user_obj = pagure.lib.query.get_user(self.session, "orphan")

          repo = pagure.lib.query.get_authorized_project(
@@ -476,11 +477,13 @@ 

          data = json.loads(output.get_data(as_text=True))

          self.assertDictEqual(data, {"point_of_contact": "pingou"})

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

+     @patch("pagure_distgit.plugin._is_active_project")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

-     def test_give_orphan_user_not_in_packager_group(self, mock_log, mock_pdc):

+     def test_give_orphan_user_not_in_packager_group(

+         self, mock_log, mock_is_active_project

+     ):

          """Assert that point of contact is correctly updated."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          orphan_user_obj = pagure.lib.query.get_user(self.session, "orphan")

          repo = pagure.lib.query.get_authorized_project(
@@ -505,11 +508,11 @@ 

          assert data["error_code"] == "ENOTHIGHENOUGH"

          assert data["errors"] == "The new POC must be a packager to adopt a package."

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

+     @patch("pagure_distgit.plugin._is_active_project")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

-     def test_give_orphan_repo_user_not_orphan(self, mock_log, mock_pdc):

+     def test_give_orphan_repo_user_not_orphan(self, mock_log, mock_is_active_project):

          """Assert that point of contact is correctly updated."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          orphan_user_obj = pagure.lib.query.get_user(self.session, "pingou")

          repo = pagure.lib.query.get_authorized_project(
@@ -530,11 +533,13 @@ 

          assert data["error"] == "You are not allowed to modify this project"

          assert data["error_code"] == "EMODIFYPROJECTNOTALLOWED"

  

-     @patch("pagure_distgit.plugin._is_active_in_pdc")

+     @patch("pagure_distgit.plugin._is_active_project")

      @patch("pagure_distgit.plugin.pagure.lib.notify.log")

-     def test_give_orphan_user_not_in_releng_or_admin_group(self, mock_log, mock_pdc):

+     def test_give_orphan_user_not_in_releng_or_admin_group(

+         self, mock_log, mock_is_active_project

+     ):

          """Assert that point of contact is correctly updated."""

-         mock_pdc.return_value = True

+         mock_is_active_project.return_value = True

          headers = {"Authorization": "token aaabbbcccddd"}

          repo = pagure.lib.query.get_authorized_project(

              self.session,
@@ -542,12 +547,12 @@ 

              namespace="rpms",

          )

          pagure.lib.query.delete_user_of_group(

-            self.session,

-            "pingou",

-            "rel-eng",

-            "pingou",

-            False,

-            force=True,

+             self.session,

+             "pingou",

+             "rel-eng",

+             "pingou",

+             False,

+             force=True,

          )

          self.session.commit()

  
@@ -558,5 +563,7 @@ 

  

          data = json.loads(output.get_data(as_text=True))

          assert output.status_code == 403

-         assert data["errors"] == "You must be in rel-eng or admin group to assign a package."

+         assert (

+             data["errors"] == "You must be in rel-eng or admin group to assign a package."

+         )

          assert data["error_code"] == "ENOTHIGHENOUGH"

Removed pdc query, which was checking if the branch is active and if the package is not retired on that branch.

Now
- active branches are checked on bodhi
- info about package (active/retired) is taken from a git ls-tree command ran from pagure, PR here: https://pagure.io/pagure/pull-request/5425 and BODHI_URL has to be added to ansible, PR here: https://pagure.io/fedora-infra/ansible/pull-request/1706#

Signed-off-by: Lenka Segura lsegura@redhat.com

LGTM
Do you want me to merge it?

Thanks for the review!
Do not merge for the moment, I have to move the logic from pagure [0] here.
https://pagure.io/pagure/pull-request/5425

rebased onto df0ce6f

a year ago

The tests I added are passing, but it breaks some other. I'll have a look tomorrow.

rebased onto 1af42a7

a year ago

rebased onto 545840b

a year ago

1 new commit added

  • Style changes to make distgit tests happy
a year ago

rebased onto 226b81e

a year ago

rebased onto 5b51f18

a year ago

1 new commit added

  • Remove pdc from plugin.py
a year ago

Pull-Request has been merged by humaton

10 months ago