def gatherModules(): dists = {} for ep in iter_entry_points(group='cape.components', name=None): try: logger.systemdebug("Inspecting module '%s'" % ep) if not dists.has_key(ep.dist): dists[ep.dist] = {} dists[ep.dist][ep.name] = ep.load() except Exception as e: # TODO: # fine grained error analysis, helps the developer logger.systemerror("Broken component found! Exception: '%s'" % str(e)) for dist, mods in dists.items(): logger.systemdebug("Module Entrypoint: [%s] ('%s')" % (dist, mods)) for templatename, template in mods.items(): logger.systemdebug("Component template found: [%s]" % templatename) ComponentTemplates[str(templatename)] = [ template, template.__doc__ ] logger.systemdebug("Found Distributions: %s" % dists.keys()) logger.systemdebug("Found Templates: %s" % ComponentTemplates.keys()) logger.systeminfo("Found %i Templates." % len(ComponentTemplates))
def setupidentity(): global SystemName global SystemClass global SystemUUID global Systemidentity if 'IDENTITY' in configuration.Configuration: config = configuration.Configuration['IDENTITY'] SystemName = config.get('name', None) if not SystemName: SystemName = DefaultSystemName logger.systemwarn("No SystemName set! Using default: '%s'" % SystemName) SystemClass = config.get('class', None) if not SystemClass: SystemClass = DefaultSystemClass logger.systemwarn("No SystemClass set! Using default: '%s'" % SystemClass) SystemUUID = config.get('UUID', None) if not SystemUUID: SystemUUID = DefaultSystemUUID logger.systemwarn("No SystemUUID set! Using default: '%s'" % SystemUUID) logger.systeminfo("System name configured from configuration", facility="IDENTITY") else: logger.systemwarn("Uh oh.", facility='IDENTITY') if version.node: SystemName = DefaultSystemClass + version.node SystemClass = DefaultSystemClass SystemUUID = DefaultSystemUUID logger.systemwarn( "No configured name. You might want to configure this.", facility="IDENTITY") else: SystemName = DefaultSystemClass + DefaultSystemName SystemClass = DefaultSystemClass SystemUUID = DefaultSystemUUID logger.systemwarn( "Default system name chosen! You might want to configure this.", facility="IDENTITY") Systemidentity = { 'name': SystemName, 'class': SystemClass, 'UUID': SystemUUID } configuration.Configuration['IDENTITY'] = Systemidentity
def setupidentity(): global SystemName global SystemClass global SystemUUID global Systemidentity if "IDENTITY" in configuration.Configuration: config = configuration.Configuration["IDENTITY"] SystemName = config.get("name", None) if not SystemName: SystemName = DefaultSystemName logger.systemwarn("No SystemName set! Using default: '%s'" % SystemName) SystemClass = config.get("class", None) if not SystemClass: SystemClass = DefaultSystemClass logger.systemwarn("No SystemClass set! Using default: '%s'" % SystemClass) SystemUUID = config.get("UUID", None) if not SystemUUID: SystemUUID = DefaultSystemUUID logger.systemwarn("No SystemUUID set! Using default: '%s'" % SystemUUID) logger.systeminfo("System name configured from configuration", facility="IDENTITY") else: logger.systemwarn("Uh oh.", facility="IDENTITY") if version.node: SystemName = DefaultSystemClass + version.node SystemClass = DefaultSystemClass SystemUUID = DefaultSystemUUID logger.systemwarn("No configured name. You might want to configure this.", facility="IDENTITY") else: SystemName = DefaultSystemClass + DefaultSystemName SystemClass = DefaultSystemClass SystemUUID = DefaultSystemUUID logger.systemwarn("Default system name chosen! You might want to configure this.", facility="IDENTITY") Systemidentity = {"name": SystemName, "class": SystemClass, "UUID": SystemUUID} configuration.Configuration["IDENTITY"] = Systemidentity
def gatherModules(): dists = {} for ep in iter_entry_points(group='cape.components', name=None): try: logger.systemdebug("Inspecting module '%s'" % ep) if not dists.has_key(ep.dist): dists[ep.dist] = {} dists[ep.dist][ep.name] = ep.load() except Exception as e: # TODO: # fine grained error analysis, helps the developer logger.systemerror("Broken component found! Exception: '%s'" % str(e)) for dist, mods in dists.items(): logger.systemdebug("Module Entrypoint: [%s] ('%s')" % (dist, mods)) for templatename, template in mods.items(): logger.systemdebug("Component template found: [%s]" % templatename) ComponentTemplates[str(templatename)] = [template, template.__doc__] logger.systemdebug("Found Distributions: %s" % dists.keys()) logger.systemdebug("Found Templates: %s" % ComponentTemplates.keys()) logger.systeminfo("Found %i Templates." % len(ComponentTemplates))