#917 Clean up installing/removing git hooks
Merged by pingou. Opened by cverna.
cverna/pagure pagure_901  into  master

Download 917.patch

Fixes https://pagure.io/pagure/issue/901 + Create symlink for post/pre-receive script and add x permission in git.

I wonder if we should log which repo was not found, to help admins debug this

My first idea was to use self. variables, but this is cool as well :)

ok this won't fly, we need something more flexible than a relying on a list that we'll forget to update when adding a hook.

Relying on the hook_type here might be the solution

Same as below, we need to be more flexible than a list

Few comments but this looks neat :)

we could just pass the full hook_name in arg, ie pre-receive.pagureforcecommit instead of pagureforcecommit

What do you think ?

That should work.

I wonder if we couldn't rely a little more on the fact that we use inheritance, but otherwise it should work :)

rebased

rebased

Fixes #901

Better yet, use APP.logger then it's the same logger as for the rest of the app

the call to the logger must be before the abort, otherwise we won't run it

If the hook_type is no longer used, then we could drop it while at it :)

1 new commit added

  • Use APP.logger to log repo not found

1 new commit added

  • Remove unused import (logging)

hook_type is used by the BaseHook set_up method so we need it

idea (open for discussion) what if we raised an exception here?
This would allow us to keep this part independent of any web-framework.

What do you think?

rebased

Now using hook_type + exception for git repo not found

We should be able to drop this now :)

These two lines should still be true

If fear this will never fail :)

rebased

11 new commits added

  • Fixed exception handling and test
  • Added exception for repo not found
  • Renamed BaseHook install/remove method
  • Remove unused import (logging)
  • Use APP.logger to log repo not found
  • Pass full hookname to BaseHook to simply logic.
  • Use symlink instead of copy for hook setup.
  • Added 404 error on hook remove method
  • Fixed post-receive pre-receive hook name
  • Reworked Basehook install/remove methods and updated all hooks to call these methods
  • Move install/remove logic to BaseHook, works on fedmsg

rebased

So I guess this is no longer needed :)

We should remove the # pragma: no cover now since, we now run this method and therefore it can be taken into account when checking coverage

cf above :)

1 new commit added

  • Cleaning up code before merge

Thanks :)

Pull-Request has been merged by pingou

Metadata