Skip to content

Commit

Permalink
added robot queries to include all robots from all projects
Browse files Browse the repository at this point in the history
  • Loading branch information
peters-david committed Mar 13, 2024
1 parent 1eb71e7 commit ea1708f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/harbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,23 @@ async def construct_full_robot_name(target_robot: Robot) -> str:


async def sync_robot_accounts(target_robots: [Robot]):
# Get all system level robots
current_system_robots = await client.get_robots(query='Level=system')
current_project_robots = await client.get_robots(query='Level=project')

# Get all project level robots
current_projects = await client.get_projects()
current_project_ids = [
current_project.project_id
for current_project in current_projects
]
current_projects_robots = []
for current_project_id in current_project_ids:
project_robots = await client.get_robots(
query=f'Level=project,ProjectID={current_project_id}'
)
current_projects_robots += project_robots

# Combine system and project robots to get a list of all robots
current_robots = current_system_robots + current_project_robots
current_robot_names = [
current_robot.name for current_robot in current_robots
Expand Down

0 comments on commit ea1708f

Please sign in to comment.