Red Hat Bugzilla – Bug 1276367
[RFE] Add priority for each plugin hook
Last modified: 2017-04-25 12:14:42 EDT
Created attachment 1087563 [details]
Potential way to add priority ordering to plugin hooks
There isn't any way to control the order that plugins execute. I created a plugin which was triggered using the 'postinit' hook. I wanted it to be trigger before the root_cache plugin so that my changes can also be cached. Unfortunately the plugin just stores an array of hooks with no way to control the order they are run.
Attached is a possible solution it could be further extended so that the priority was configurable via the config file. But if all the existing hooks had a priority of 0, then a new hook could be added with -1 to make sure it went before them or +1 to make sure it when after.