David Caro has posted comments on this change.
Change subject: Added the hook dispatcher
......................................................................
Patch Set 2: (4 inline comments)
....................................................
File hooks/hook-dispatcher
Line 25: from collections import OrderedDict
Line 26: from dulwich.repo import Repo
Line 27:
Line 28:
Line 29: def ignore(ignored_hooks, current_hooks, args):
The idea is to have a common interface so you were able to define new functions
and have the args used to call the script available. Actually ythe ignore,
run_only and rerun methods are called the same way.
That is to have an easy way of adding new 'tags' and methods.
Line 30: """
Line 31: Return the hooks list without the given hooks
Line 32:
Line 33: :param ignored_hooks; csv lis tof the hooks to ignore
Line 32:
Line 33: :param ignored_hooks; csv lis tof the hooks to ignore
Line 34: :param current_hooks: array with the currently available hooks
Line 35: """
Line 36: ignored_hooks = set([hook.strip() for hook in
ignored_hooks.split(',')])
but that will not match regular expressions
Line 37: logging.info(" Ignoring the hooks %s", ignored_hooks)
Line 38: for hook in ignored_hooks:
Line 39: match = filter(lambda h: re.match(hook, h), current_hooks)
Line 40: if match:
Line 44:
Line 45:
Line 46: def run_only(to_run_hooks, current_hooks, args):
Line 47: """
Line 48: Handles the Run-Only tag, removes all the hooks not macching the
given
Done
Line 49: hooks
Line 50:
Line 51: :param to_run_hooks: array with the csv string passed to the tag
Line 52: :param current_hooks: array with the current available hooks
Line 50:
Line 51: :param to_run_hooks: array with the csv string passed to the tag
Line 52: :param current_hooks: array with the current available hooks
Line 53: """
Line 54: to_run_hooks = set([hook.strip() for hook in
to_run_hooks.split(',')])
Done
Line 55: logging.info(" Running only the hooks %s", to_run_hooks)
Line 56: to_run = []
Line 57: for hook in to_run_hooks:
Line 58: if hook in current_hooks:
--
To view, visit http://gerrit.ovirt.org/15386
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iada3d1bef5357366d5f319561efac8ee85a614f0
Gerrit-PatchSet: 2
Gerrit-Project: gerrit-admin
Gerrit-Branch: master
Gerrit-Owner: David Caro <[email protected]>
Gerrit-Reviewer: David Caro <[email protected]>
Gerrit-Reviewer: Eyal Edri <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Ohad Basan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches