Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复cmdb查询主机接口返回bk_cloud_id字段类型 #951

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions bcs-app/backend/apps/cluster/flow_views/tools/gse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
from typing import Dict, List

from backend.components import gse


class GSEClient:
@classmethod
def get_agent_status(cls, request, ip_list):
def get_agent_status(cls, username: str, ip_list: List[Dict]) -> List[Dict]:
""""""
hosts = []
for info in ip_list:
plat_info = info.get('bk_cloud_id') or []
plat_id = plat_info[0]['id'] if plat_info else 0
bk_cloud_id = info.get('bk_cloud_id') or 0
hosts.extend(
[{'plat_id': plat_id, 'bk_cloud_id': plat_id, 'ip': ip} for ip in info.get('inner_ip', '').split(',')]
[
{'plat_id': bk_cloud_id, 'bk_cloud_id': bk_cloud_id, 'ip': ip}
for ip in info.get('inner_ip', '').split(',')
]
)
return gse.get_agent_status(request.user.username, hosts)
return gse.get_agent_status(username, hosts)
2 changes: 1 addition & 1 deletion bcs-app/backend/apps/cluster/views/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def post(self, request, project_id):
pagination_data = custom_paginator(host_list, data['offset'], limit=data['limit'])
# for frontend display
cc_host_map = self.get_cc_host_mappings(pagination_data['results'])
gse_host_status = gse.GSEClient.get_agent_status(request, cc_host_map.values())
gse_host_status = gse.GSEClient.get_agent_status(request.user.username, cc_host_map.values())
# compose the host list with gse status and host status
self.update_agent_status(cc_host_map, gse_host_status)

Expand Down
8 changes: 8 additions & 0 deletions docs/release.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# 发布日志
## release-1.4.5
#### 修复
- [#951](https://github.com/Tencent/bk-bcs-saas/pull/951)修复由于CMDB主机列表接口返回字段(bk_cloud_id)类型变动导致的问题
- [#941](https://github.com/Tencent/bk-bcs-saas/pull/941)修复用户是超级管理员时,项目权限异常的问题

#### 优化
- Mesos允许通过prometheus获取集群和节点metric功能


## release-1.4.1
#### 新增
Expand Down