diff --git a/dbm-ui/backend/flow/utils/cc_manage.py b/dbm-ui/backend/flow/utils/cc_manage.py index 41d47d1516..ada3298989 100644 --- a/dbm-ui/backend/flow/utils/cc_manage.py +++ b/dbm-ui/backend/flow/utils/cc_manage.py @@ -180,7 +180,12 @@ def batch_update_host(host_info_list: List[Dict[str, Any]], need_monitor: bool): def update_host_properties( self, bk_host_ids: List[int], need_monitor: bool, dbm_meta=None, update_operator: bool = True ): - """批量更新主机属性""" + """ + 批量更新主机属性 + """ + # 给业务主机模型增加dbm_meta自定义字段 + Services.init_cc_dbm_meta(self.bk_biz_id) + # 如果传递了dbm_meta信息和选择不更新维护人,则无需查询machine表,可以直接构造主机属性 if dbm_meta is not None and not update_operator: dbm_meta = json.dumps(dbm_meta) diff --git a/dbm-ui/backend/tests/db_meta/api/cluster/tendbha/test_handler.py b/dbm-ui/backend/tests/db_meta/api/cluster/tendbha/test_handler.py index 9fc66dccde..46a0ad945e 100644 --- a/dbm-ui/backend/tests/db_meta/api/cluster/tendbha/test_handler.py +++ b/dbm-ui/backend/tests/db_meta/api/cluster/tendbha/test_handler.py @@ -31,6 +31,7 @@ class TestHandler: @patch("backend.db_meta.api.machine.apis.CCApi", CCApiMock()) @patch("backend.db_meta.models.app.CCApi", CCApiMock()) @patch("backend.flow.utils.cc_manage.CCApi", CCApiMock()) + @patch("backend.dbm_init.services.CCApi", CCApiMock()) @patch("backend.flow.utils.cc_manage.ResourceQueryHelper", ResourceQueryHelperMock()) def test_create_success(self, init_db_module, create_city): cluster_name = "test" diff --git a/dbm-ui/backend/tests/mock_data/components/cc.py b/dbm-ui/backend/tests/mock_data/components/cc.py index 28d0c00554..c0e66a307f 100644 --- a/dbm-ui/backend/tests/mock_data/components/cc.py +++ b/dbm-ui/backend/tests/mock_data/components/cc.py @@ -16,6 +16,7 @@ MOCK_SEARCH_SET_RETURN = {"info": [{"bk_set_id": constant.BK_SET_ID, "bk_set_name": "mock集群"}], "count": 1} MOCK_SEARCH_MODULE_RETURN = {"info": [{"bk_module_id": constant.DB_MODULE_ID, "bk_biz_name": "mock模块"}], "count": 1} MOCK_LIST_SERVICE_INSTANCE_DETAIL_RETURN = {"info": []} +MOCK_SEARCH_OBJECT_ATTRIBUTE_RETURN = [] MOCK_SEARCH_BUSINESS_WITH_MULTI_BIZ_RETURN = { "info": [ @@ -158,6 +159,7 @@ class CCApiMock(object): find_host_biz_relations_return = copy.deepcopy(MOCK_FIND_HOST_BIZ_RELATIONS_RETURN) get_biz_internal_module_return = copy.deepcopy(MOCK_GET_BIZ_INTERNAL_MODULE_RETURN) list_service_instance_detail_return = copy.deepcopy(MOCK_LIST_SERVICE_INSTANCE_DETAIL_RETURN) + search_object_attribute_return = copy.deepcopy(MOCK_SEARCH_OBJECT_ATTRIBUTE_RETURN) def __init__( self, @@ -167,6 +169,7 @@ def __init__( search_module_return=None, find_host_biz_relations_return=None, list_service_instance_detail_return=None, + search_object_attribute_return=None, ): # 提供接口默认返回值,可根据不同的需求进行构造 self.search_business_return = search_business_return or self.search_business_return @@ -177,6 +180,7 @@ def __init__( self.list_service_instance_detail_return = ( list_service_instance_detail_return or self.list_service_instance_detail_return ) + self.search_object_attribute_return = search_object_attribute_return or self.search_object_attribute_return def search_business(self, *args, **kwargs): return self.search_business_return @@ -202,6 +206,9 @@ def list_hosts_without_biz(self, *args, **kwargs): def list_biz_hosts(self, *args, **kwargs): return self.list_hosts_without_biz_return + def search_object_attribute(self, *args, **kwargs): + return self.search_object_attribute_return + @staticmethod def batch_update_host(*args, **kwargs): if kwargs.get("raw"): @@ -226,6 +233,10 @@ def create_module(*args, **kwargs): def transfer_host_module(*args, **kwargs): return {} + @staticmethod + def create_biz_custom_field(*args, **kwargs): + return {} + @staticmethod def add_label_for_service_instance(*args, **kwargs): return {} diff --git a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml index 7d52f1f055..e4f0e8c999 100644 --- a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 0.0.1-alpha.81 +appVersion: 0.0.1-alpha.82 description: A Helm chart for Kubernetes name: db-resource type: application