From 996c7e8a4084969d8d3aace25c24e2110089c5a1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 16 2019 13:14:27 +0000 Subject: Don't try mirroring if we failed generating private key 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 --- diff --git a/pagure/lib/tasks_mirror.py b/pagure/lib/tasks_mirror.py index 2f9bd7c..2b2e815 100644 --- a/pagure/lib/tasks_mirror.py +++ b/pagure/lib/tasks_mirror.py @@ -210,6 +210,13 @@ def mirror_project(self, session, username, namespace, name): 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.info("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")