[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] Importer Sync APIs



On 11/22/2011 07:43 AM, Jay Dobies wrote:
I also know there are at least two other teams interested in writing
plugins that I'd like to give some feedback on how this will meet their
needs.

I just hit something that's a user-friendliness problem: the content free nature of the "validate_config" boolean result. Currently, there's no mechanism to report to a user detailed information on *why* their configuration failed.

So, there's two pieces of feedback coming from this:

1. From *all* the plugin methods, it would be good to be able to gain access to an appropriately scoped Python logger. Perhaps this can be made an API on the Importer and Distributor base classes? Something like:

    def get_logger(self):
        logger_name = "pulp.plugins." + type(self).__module__
        return logging.getLogger(logger_name)

2. It would be good to have a richer return value from validate_config() that allows a plugin to supply an error message to be displayed to the user. I think the simplest way to go on that front is to make the return value from validate_config() an error message string, with a return value of "None" used to indicate that no error occurred and the configuration is fine.

You could probably do something fancier by using exceptions, but "error message or None" seems to cover all the important aspects.

Cheers,
Nick.

--
Nick Coghlan
Red Hat Engineering Operations, Brisbane


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]