From 536c186f4b0eb06f71ba7aa8d1399a85e852b885 Mon Sep 17 00:00:00 2001 From: Slavek Kabrda Date: Nov 12 2018 13:30:00 +0000 Subject: Only display info about running hooks when debugging, add hooktype --- diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py index 4824074..660e6a0 100644 --- a/pagure/hooks/__init__.py +++ b/pagure/hooks/__init__.py @@ -525,7 +525,8 @@ def run_hook_file(hooktype): "%s - %s" % (repotype, username, namespace, repo) ) - print("Running hooks for %s" % project.fullname) + if pagure_config.get("HOOK_DEBUG", False): + print("Running %s hooks for %s" % (hooktype, project.fullname)) run_project_hooks( session, pushuser, diff --git a/tests/test_pagure_lib_git_auth.py b/tests/test_pagure_lib_git_auth.py index 62301e9..937a6d3 100644 --- a/tests/test_pagure_lib_git_auth.py +++ b/tests/test_pagure_lib_git_auth.py @@ -108,7 +108,7 @@ class PagureLibGitAuthtests(tests.Modeltests): self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( - "Remote hook declined the push: Running hooks for hooktest\n" + "Remote hook declined the push: " "Denied push for ref 'refs/heads/master' for user 'pingou'\n" "All changes have been rejected", output_text @@ -147,7 +147,7 @@ class PagureLibGitAuthtests(tests.Modeltests): self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( - "Remote hook declined the push: Running hooks for hooktest\n" + "Remote hook declined the push: " "Denied push for ref 'refs/heads/master' for user 'pingou'\n" "All changes have been rejected", output_text