0

I have written a custom plugin which has different hooks of yum viz. config_hook, postreposetup_hook, exclude_hook, preresolve_hook etc... The problem is that sometimes the postreposetup and exclude hooks are not getting called on a new machine when the yum command is executed. I have also written another plugin with simple print statements in each hook and each hook in that plugin is getting called. I am not able to figure out what the problem is.

Below is the simple plugin that is working and unfortunately I cannot share the code of other plugin here but it connects to a server in postreposetup_hook and exclude_hook does the package exclusions. Any pointers will be really helpful.

import yum
from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE

requires_api_version='2.3'
plugin_type=(TYPE_CORE)
def config_hook(conduit):
    print 'In config'

def init_hook(conduit):
    print 'In init'
def prereposetup_hook(conduit):
    print 'In prereposetup'
def postreposetup_hook(conduit):
    print 'In postreposetup'
def exclude_hook(conduit):
    print 'In exclude'
def preresolve_hook(conduit):
    print 'In preresolve'
def postresolve_hook(conduit):
    print 'In postreposetup'
Arif
  • 196
  • 2
  • 3
  • 9
  • If you stick those *exact same* print lines in the other script (well modify them to indicate which plugin they are coming from first) and enable both scripts on the same machine you see the lines printed from this script for each hook but not for each hook from the other plugin? – Etan Reisner Jan 20 '15 at 13:50
  • I tried the same thing. Each hook from the above plugin is called but only config_hook, preresolve_hook are called from other plugin. postreposetup_hook and exclude_hook are not getting called. I cleared all the code from the hooks of the plugin which was not working and put these print statements and it worked and then I put my code again and it was working. So I don't know why it didn't work earlier and how it started working later. I need to find this out as this is show stopper for the plugin. Can you give me any inputs on how to reach to the root cause? – Arif Jan 20 '15 at 14:09
  • Sounds like you had a typo/error/etc. in the code which caused a failure and the plugin blew up in the early hooks so the later ones didn't run. I believe turning yum debugging up high enough will show you those failures and might even cause yum to terminate on them immediately. – Etan Reisner Jan 20 '15 at 14:15

0 Answers0