#4846 Fix mirroring in projects hosted elsewhere
Merged 3 years ago by pingou. Opened 3 years ago by pingou.

file modified
+1 -5
@@ -320,11 +320,7 @@ 

      # First we run dynamic ACLs

      authbackend = get_git_auth_helper()

  

-     if (

-         is_internal

-         and username == "pagure"

-         and repotype in ("tickets", "requests")

-     ):

+     if is_internal and username == "pagure":

          if debug:

              print("This is an internal push, dynamic ACL is pre-approved")

      elif not authbackend.is_dynamic:

file modified
+2 -1
@@ -3036,13 +3036,14 @@ 

          env = os.environ.copy()

          env["GL_USER"] = "pagure"

          env["GL_BYPASS_ACCESS_CHECKS"] = "1"

+         env["internal"] = "yes"

          if pagure_config.get("GITOLITE_HOME"):

              env["HOME"] = pagure_config["GITOLITE_HOME"]

          env.update(environ)

          env.update(extra)

          out = subprocess.check_output(

              command, cwd=repopath, stderr=subprocess.STDOUT, env=env

-         )

+         ).decode("utf-8")

          log = "Output from %s:" % command

          logs.append(log)

          logs.append(out)

@@ -60,7 +60,7 @@ 

          tmp = MagicMock()

          tmp.communicate.return_value = ("", "")

          popen_mock.return_value = tmp

-         ck_out_mock.return_value = "all good"

+         ck_out_mock.return_value = b"all good"

  

          output = pagure.lib.git.mirror_pull_project(self.session, self.project)

  

To fix this we needed to support internal push to the main repo, so
not just "tickets" and "requests".
We also needed to ensure that the push was marked as internal.
Finally we needed to convert to unicode the output of the subprocess
command which in python3 returns bytes.

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto c791b80f34b9193f98c547bd16c643c2e6218ff7

3 years ago
15:44:35  Failed tests:
15:44:35  FAILED test: py3-test_pagure_lib_git_mirror_project

rebased onto 79303ac6787f948c5b5246432f1fa37a3e15131f

3 years ago

rebased onto 08cdff0

3 years ago

Pull-Request has been merged by pingou

3 years ago