def setup_projects(backend): project_files = [ f for f in listdir("./project_config") if isfile(join("./project_config", f)) and f.endswith(".json") ] if cmd_args.start_datasources: print("Each data source created will also be started") else: print("") print( "Skipping starting the datasources. Pass in --start_datasources if you wish to start them when bootstrapping" ) for file in project_files: #TODO: what's the python way here? print("Creating Project for %s" % file) project = json.load(open(join("./project_config", file))) print("Bootstrapping configs for %s..." % project["name"]) #create the data sources datasources = [] (twitter_config, jira_config, mailbox_configs, wiki_configs, website_configs, github_configs, stack_configs) = backend.create_or_update_datasources(project) datasources.append(twitter_config) datasources.append(jira_config) datasources.extend(mailbox_configs) datasources.extend(wiki_configs) datasources.extend(website_configs) datasources.extend(github_configs) datasources.extend(stack_configs) for datasource in datasources: if datasource: # start the data sources if cmd_args.start_datasources: print("Stop existing datasource %s if it exists" % datasource["id"]) backend.stop_datasource(datasource, abort=True) print("Starting datasource %s" % datasource["id"]) #TODO backend.start_datasource(datasource["id"])
def setup_projects(backend): project_files = [f for f in listdir("./project_config") if isfile(join("./project_config", f)) and f.endswith(".json")] if cmd_args.start_datasources: print("Each data source created will also be started") else: print("") print("Skipping starting the datasources. Pass in --start_datasources if you wish to start them when bootstrapping") for file in project_files: #TODO: what's the python way here? print ("Creating Project for %s" % file) project = json.load(open(join("./project_config", file))) print("Bootstrapping configs for %s..." % project["name"]) #create the data sources datasources = [] (twitter_config, jira_config, mailbox_configs, wiki_configs, website_configs, github_configs, stack_configs) = backend.create_or_update_datasources(project) datasources.append(twitter_config) datasources.append(jira_config) datasources.extend(mailbox_configs) datasources.extend(wiki_configs) datasources.extend(website_configs) datasources.extend(github_configs) datasources.extend(stack_configs) for datasource in datasources: if datasource: # start the data sources if cmd_args.start_datasources: print ("Stop existing datasource %s if it exists" % datasource["id"]) backend.stop_datasource(datasource, abort=True) print("Starting datasource %s" % datasource["id"]) #TODO backend.start_datasource(datasource["id"])