Below is the file 'phonehome.py' from this revision. You can also download the file.
#!/usr/bin/python # # the phonehome client # # python program with plugins; runs each plugin according to the configuration file # # import sys import os import config import traceback if __name__ == '__main__': # load each of the plugins results = [] sys.path.insert(0, config.plugin_path) for plugin_name in config.plugins: def run_plugin(): mod = __import__(plugin_name, globals(), locals(), ['']) return mod.run() # each plugin should return a list of results # if there are no results it should return the empty list, [] # the format of results is (urgency, description) try: result = run_plugin() except: result = [ ("critical", traceback.format_exc()) ] result = [(plugin_name,) + t for t in result] results += result for plugin_name, urgency, description in results: print plugin_name, urgency, description