Hi,

A while back I got some help writing a python script who extends the user 
classes in ipalib to run
a custom command when a user is added/modified/deleted. This has been working 
perfectly in our
production environment for a few years now, until I upgraded to IPA 3.0 last 
week. The custom
script is no longer executed.

Did the libraries change since 2.2?


The script sits in 
/usr/lib/python2.6/site-packages/ipalib/plugins/user-custom.py and looks like:


#
# Extension to provide user-customizable script when a user id 
added/modified/deleted
#

from ipapython import ipautil

# Extend add

from ipalib.plugins.user import user_add

def script_post_add_callback(inst, ldap, dn, attrs_list, *keys, **options):
     inst.log.info('User added')
     if 'ipa_user_script' in inst.api.env:
         try:
             ipautil.run([inst.api.env.ipa_user_script,"add", dn])
         except:
              pass

     return dn

user_add.register_post_callback(script_post_add_callback)


# Extend delete

from ipalib.plugins.user import user_del

def script_post_del_callback(inst, ldap, dn, attrs_list, *keys, **options):
     inst.log.info('User deleted')
     if 'ipa_user_script' in inst.api.env:
         try:
             ipautil.run([inst.api.env.ipa_user_script,"del", dn])
         except:
              pass

     return dn

user_del.register_post_callback(script_post_del_callback)


# Extend modify

from ipalib.plugins.user import user_mod

def script_post_mod_callback(inst, ldap, dn, attrs_list, *keys, **options):
     inst.log.info('User modified')
     if 'ipa_user_script' in inst.api.env:
         try:
             ipautil.run([inst.api.env.ipa_user_script,"mod", dn])
         except:
              pass

     return dn

user_mod.register_post_callback(script_post_mod_callback)


_______________________________________________
Freeipa-users mailing list
Freeipa-users@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-users

Reply via email to