diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py index 660e6a0..d7b949f 100644 --- a/pagure/hooks/__init__.py +++ b/pagure/hooks/__init__.py @@ -435,10 +435,9 @@ def run_project_hooks( if hook.startswith(hooktype + "."): hookfile = os.path.join(hookdir, hook) - # Determine if this is an actual hook, or if it's a remnant - # from a hook that was installed before it was moved to the - # runner system. - if os.path.realpath(hookfile) == pagure.lib.query.HOOK_DNE_TARGET: + # By-pass all the old hooks that pagure may have created before + # moving to the runner architecture + if hook in pagure.lib.query.ORIGINAL_PAGURE_HOOK: continue # Execute diff --git a/pagure/lib/query.py b/pagure/lib/query.py index 87b90b5..ecf7434 100644 --- a/pagure/lib/query.py +++ b/pagure/lib/query.py @@ -69,9 +69,23 @@ from pagure.lib import tasks_services REDIS = None PAGURE_CI = None _log = logging.getLogger(__name__) -# The target for hooks migrated to the Runner system, to be able to detect -# whether a hook was migrated without having to open and read the file -HOOK_DNE_TARGET = "/does/not/exist" +# List of all the possible hooks pagure could generate before it was moved +# to the runner architecture we now use. +# This list is kept so we can ignore all of these hooks. +ORIGINAL_PAGURE_HOOK = [ + "post-receive.default", + "post-receive.fedmsg", + "post-receive.irc", + "post-receive.mail", + "post-receive.mirror", + "post-receive.pagure", + "post-receive.pagure-requests", + "post-receive.pagure-ticket", + "post-receive.rtd", + "pre-receive.pagure_no_new_branches", + "pre-receive.pagureforcecommit", + "pre-receive.pagureunsignedcommit", +] def get_repotypes(): diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index a3deb4e..051d785 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -605,7 +605,6 @@ def move_to_repospanner(self, session, name, namespace, user, region): raise Exception("Project is already on repoSpanner") # Make sure that no non-runner hooks are enabled for this project - compatible_targets = [pagure.lib.query.HOOK_DNE_TARGET] incompatible_hooks = [] for repotype in pagure.lib.query.get_repotypes(): path = project.repopath(repotype) @@ -620,8 +619,7 @@ def move_to_repospanner(self, session, name, namespace, user, region): if hook.endswith(".sample"): # Ignore the samples that Git inserts continue - hookfile = os.path.join(hookpath, hook) - if os.path.realpath(hookfile) not in compatible_targets: + if hook not in pagure.lib.query.ORIGINAL_PAGURE_HOOK: incompatible_hooks.append((repotype, hook)) if incompatible_hooks: