plugable: replace API.import_plugins with new API.add_package

Replace API.import_plugins with a new method API.add_package which allows
loading plugin packages into an API object from a package object.

This makes loading of plugin packages loading consistent with loading of
plugin modules and classes.

Rename API.modules to API.packages and use package objects where
implemented to reflect the change.

https://fedorahosted.org/freeipa/ticket/4739

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta
2016-03-16 11:22:00 +01:00
parent 3f5091b55a
commit 0d62968b6f
3 changed files with 33 additions and 34 deletions

View File

@@ -127,7 +127,11 @@ class Advice(Plugin):
class AdviseAPI(API):
bases = (Advice,)
modules = ('ipaserver.advise.plugins.*',)
@property
def packages(self):
import ipaserver.advise.plugins
return (ipaserver.advise.plugins,)
advise_api = AdviseAPI()