Example #1
0
def list_sources(cfg_list, depends):
    retlist = []
    for ds_coll in cfg_list:
        mod_name = settings.src_mod_tpl % (ds_coll)
        log.debug("Importing source module: %s", mod_name)
        mod = importer.import_module(mod_name)
        lister = getattr(mod, "get_datasource_list", None)
        if lister:
            retlist.extend(lister(depends))
    return retlist
Example #2
0
    def handle(self, name, args, freq=None):
        real_name = name.replace("-", "_")
        mod_name = cc_mod_tpl % (real_name)
        log.debug("Importing handler module: %s", mod_name)

        mod = importer.import_module(mod_name)
        def_freq = getattr(mod, "frequency", per_instance)
        handler = getattr(mod, "handle")

        if not freq:
            freq = def_freq

        self.cloud.sem_and_run("config-" + name, freq, handler,
            [name, self.cfg, self.cloud, log, args])