From 477de51e32201d63f3e638a9eb8eea8fdbf2eb87 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 05 2016 14:40:33 +0000 Subject: Fix uninstalling the mirroring hook Remove the private key when removing the mirror hook Clean the ~/.ssh/config file for this project --- diff --git a/pagure/hooks/mirror_hook.py b/pagure/hooks/mirror_hook.py index 6c4b795..6cccf53 100644 --- a/pagure/hooks/mirror_hook.py +++ b/pagure/hooks/mirror_hook.py @@ -324,13 +324,17 @@ class MirrorHook(BaseHook): os.makedirs(ssh_folder) public_key_name = werkzeug.secure_filename(project.fullname) + private_key_file = os.path.join(ssh_folder, public_key_name) public_key_file = os.path.join( ssh_folder, '%s.pub' % public_key_name) + if os.path.exists(private_key_file): + os.unlink(private_key_file) + if os.path.exists(public_key_file): os.unlink(public_key_file) - clean_ssh_config(ssh_folder, key_name, target) + clean_ssh_config(ssh_folder, public_key_name, project.mirror_hook.target) repopaths = [get_repo_path(project)]