I've been thinking about this a little bit and came up with the following proposition.

All plugin, that are going to be registered in API, will need a version number or preferably two. A major and a minor version number. The major number will only be incremented when a backward incompatible change is made. Method plugins should be able to inherit version number from their parent object.


We should make it possible for plugins to define dependencies on other plugins. This will be probably implemented as a list of tuples containing the plugin name and a major version number. I was thinking about extracting the dependencies automatically, but there doesn't seem to be an easy way to do this "from inside the code". We could have an automated tool, that would validate plugins, checks versions and fill in the dependencies... but that might be overkill.

Dependencies will be checked when API is finalizing.

Version number can be also used when registering plugins. Newer version will automatically override older ones. This will also enable us, to make new versions of plugins, that only extend a previous version. For example:

class user_show(LDAPRetrieve):
    PLUGIN_VERSION = (1, 0)
    ...
    def pre_callback(...):
        ...

api.register(user_show)

class user_show(user_show): # this is legal even in the same file in python!
    PLUGIN_VERSION = (1, 1)
    def pre_callback(...):
        super(user_show, self).pre_callback(...)
        # do something new here
        ...

api.register(user_show) # new version will override old one


Thoughts? Comments?

Pavel

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

Reply via email to