o ¶žâcûã@sTddlmZddlZddlmZGdd„deƒZGdd„deƒZGd d „d eƒZ dS) é)Úabsolute_importNé)Ú format_objectc@seZdZdZdS)ÚPluginConfigErrorz7There was an error registering or configuring a plugin.N)Ú__name__Ú __module__Ú __qualname__Ú__doc__©r r ú6/usr/lib/python3/dist-packages/landscape/lib/plugin.pyrsrc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚPluginRegistryz(A central integration point for plugins.cCsg|_i|_dS)N)Ú_pluginsÚ _plugin_names©Úselfr r r Ú__init__s zPluginRegistry.__init__cCs@t dt|ƒ¡|j |¡t|dƒr||j|j<| |¡dS)aRegister a plugin. The plugin's C{register} method will be called with this registry as its argument. If the plugin has a C{plugin_name} attribute, it will be possible to look up the plugin later with L{get_plugin}. zRegistering plugin %s.Ú plugin_nameN) ÚloggingÚinforr ÚappendÚhasattrrrÚregister)rÚpluginr r r Úadds    zPluginRegistry.addcCs|jS)zGet the list of plugins.)r rr r r Ú get_plugins"szPluginRegistry.get_pluginscCs |j|S)z Get a particular plugin by name.)r)rÚnamer r r Ú get_plugin&s zPluginRegistry.get_pluginN)rrrr rrrrr r r r r s  r c@seZdZdZdZdd„ZdS)ÚPlugina˜A convenience for writing plugins. This provides a register method which will set up a bunch of reactor handlers in the idiomatic way. If C{run} is defined on subclasses, it will be called every C{run_interval} seconds after being registered. @cvar run_interval: The interval, in seconds, to execute the C{run} method. If set to C{None}, then C{run} will not be scheduled. écCs8||_t|dƒr|jdur|j |j|j¡dSdSdS)NÚrun)ÚregistryrÚ run_intervalÚreactorÚ call_everyr)rr r r r r;sÿzPlugin.registerN)rrrr r!rr r r r r+s r) Ú __future__rrÚformatrÚ ExceptionrÚobjectr rr r r r Ús