def iter(context, **kwargs): return base.iter(context, RESOURCE, **kwargs)
if not os.path.exists(filter_file_path): print("File %s does not exists." % filter_file_path) sys.exit(1) # get the filtering rules gfilter = json.loads(open('./%s' % filter_file_path).read()) gcontext = dci_context.build_dci_context( dci_cs_url=dci_cs_url, dci_login=dci_login, dci_password=dci_password) # to get the last job of a remoteci, we loop over all job sorted by date # and get the first status to have the last status of a remoteci. print("[*] Get all jobs") ljobs = [r for r in base.iter(gcontext, 'jobs', sort='-created_at', embed='components', limit=128)] # get all topics to get the association topic_id -> topic_name # which will be used below print("[*] Get all topics") ltopics = topic.list(gcontext).json()['topics'] topicids_to_name = {} for current_topic in ltopics: topicids_to_name[current_topic['id']] = current_topic['name'] # get all teams to get association team_id -> team_name print("[*] Get all teams") lteams = team.list(gcontext).json()['teams'] teams_to_name = {} for current_team in lteams: teams_to_name[current_team['id']] = current_team['name']
print("File %s does not exists." % filter_file_path) sys.exit(1) # get the filtering rules gfilter = json.loads(open('./%s' % filter_file_path).read()) gcontext = dci_context.build_dci_context(dci_cs_url=dci_cs_url, dci_login=dci_login, dci_password=dci_password) # to get the last job of a remoteci, we loop over all job sorted by date # and get the first status to have the last status of a remoteci. print("[*] Get all jobs") ljobs = [ r for r in base.iter(gcontext, 'jobs', sort='-created_at', embed='components,jobdefinition', limit=128) ] # get all topics to get the association topic_id -> topic_name # which will be used below print("[*] Get all topics") ltopics = topic.list(gcontext).json()['topics'] topicids_to_name = {} for current_topic in ltopics: topicids_to_name[current_topic['id']] = current_topic['name'] # get all teams to get association team_id -> team_name print("[*] Get all teams") lteams = team.list(gcontext).json()['teams']
def list_files_iter(context, id, **kwargs): return base.iter(context, RESOURCE, id=id, subresource="files", **kwargs)