Skip to content

Commit

Permalink
fix: 修复订阅关联 CMDB 进程获取不到的问题 (fixed TencentBlueKing#2237)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuoZhuoCrayon authored and chalice-1831 committed Jun 24, 2024
1 parent db6614e commit c56e681
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
16 changes: 0 additions & 16 deletions apps/backend/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,3 @@ def needs_batch_request(self) -> bool:
return False

return True


class CMDBInstanceChoices(enum.EnhanceEnum):
HOST = "cmdb_instance.host"
SCOPE = "cmdb_instance.scope"
PROCESS = "cmdb_instance.process"
SERVICE = "cmdb_instance.service"

@classmethod
def _get_member__alias_map(cls) -> Dict[Enum, str]:
return {
cls.HOST: _("cmdb_instance.host参数"),
cls.SCOPE: _("cmdb_instance.scope参数"),
cls.PROCESS: _("cmdb_instance.process参数"),
cls.SERVICE: _("cmdb_instance.service参数"),
}
5 changes: 3 additions & 2 deletions apps/backend/subscription/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from django.utils import timezone

from apps.backend.components.collections import core
from apps.backend.constants import CMDBInstanceChoices, FilterFieldName, InstNodeType
from apps.backend.constants import FilterFieldName, InstNodeType
from apps.backend.subscription import task_tools
from apps.backend.subscription.commons import get_host_by_inst, list_biz_hosts
from apps.backend.subscription.constants import SUBSCRIPTION_SCOPE_CACHE_TIME
Expand Down Expand Up @@ -833,7 +833,8 @@ def get_instances_by_scope_with_checker(
scope["with_info"] = {"process": False}

for step in steps:
if CMDBInstanceChoices.PROCESS.value in json.dumps(step.params):
params_str: str = json.dumps(step.params)
if "cmdb_instance.process" in params_str or "target.process" in params_str:
scope["with_info"]["process"] = True
break

Expand Down

0 comments on commit c56e681

Please sign in to comment.