#4209 Don't try mirroring if we failed generating private key
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+8 -1
@@ -203,13 +203,20 @@ 

      repofolder = pagure_config["GIT_FOLDER"]

      repopath = os.path.join(repofolder, project.path)

      if not os.path.exists(repopath):

-         _log.info("Git folder not found at: %s, bailing", repopath)

+         _log.warning("Git folder not found at: %s, bailing", repopath)

          return

  

      ssh_folder = pagure_config["MIRROR_SSHKEYS_FOLDER"]

      public_key_name = werkzeug.secure_filename(project.fullname)

      private_key_file = os.path.join(ssh_folder, public_key_name)

  

+     if not os.path.exists(private_key_file):

+         _log.warning("No %s key found, bailing", private_key_file)

+         project.mirror_hook.last_log = "Private key not found on disk, bailing"

+         session.add(project.mirror_hook)

+         session.commit()

+         return

+ 

      # Add the utility script allowing this feature to work on old(er) git.

      here = os.path.join(os.path.dirname(os.path.abspath(__file__)))

      script_file = os.path.join(here, "ssh_script.sh")

If we failed generating the private key there is no point in trying
to push anything with it.
I believe this also fixes the issue we've seen with the mirroring
service as the mirroring task was failing this was impacting other
tasks while at it.

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

This should probably be a warning level.

1 new commit added

  • Change couple of log entries from info to warning
5 years ago

Aside from the test run exploding, code looks good to me. :thumbsup:

pretty please pagure-ci rebuild

5 years ago

Tests pass, let's get this in :)

Thanks for the review @ngompa !

Pull-Request has been merged by pingou

5 years ago