Skip to content

Commit

Permalink
feature: Job 支持容器执行 - 脚本任务 TencentBlueKing#2631
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Feb 1, 2024
1 parent 49148ac commit 45d5395
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,20 @@ private List<PermissionResource> convertDynamicGroupsToPermissionResourceList(Ap
return hostResources;
}

private List<PermissionResource> convertContainersToPermissionResourceList(AppResourceScope appResourceScope) {
List<PermissionResource> hostResources = new ArrayList<>();
PermissionResource resource = new PermissionResource();
resource.setResourceId(appResourceScope.getId());
resource.setResourceType(ResourceTypeEnum.HOST);
resource.setSubResourceType("container");
resource.setResourceName(getResourceName(appResourceScope));
resource.setSystemId(SystemId.CMDB);
resource.setType(CcNodeTypeEnum.BIZ.getType());
resource.setParentHierarchicalResources(null);
hostResources.add(resource);
return hostResources;
}

private List<PermissionResource> convertHostsToPermissionResourceList(AppResourceScope appResourceScope,
ExecuteObjectsDTO servers) {
List<PermissionResource> hostResources = new ArrayList<>();
Expand All @@ -475,6 +489,10 @@ private List<PermissionResource> convertHostsToPermissionResourceList(AppResourc
if (!CollectionUtils.isEmpty(servers.getDynamicServerGroups())) {
hostResources.addAll(convertDynamicGroupsToPermissionResourceList(appResourceScope, servers));
}
// 静态容器
if (!CollectionUtils.isEmpty(servers.getStaticContainerList())) {
hostResources.addAll(convertContainersToPermissionResourceList(appResourceScope));
}
return hostResources;
}

Expand Down

0 comments on commit 45d5395

Please sign in to comment.