Skip to content

Commit

Permalink
fix: 清除通过GlobalSettings配置钩子脚本内容 (closed #2412)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 authored and wyyalt committed Aug 23, 2024
1 parent ce72b19 commit a5e8332
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
11 changes: 0 additions & 11 deletions apps/backend/agent/solution_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from apps.core.script_manage.base import ScriptHook
from apps.core.script_manage.data import JUMP_SERVER_POLICY_SCRIPT_INFO
from apps.node_man import constants, models
from apps.node_man.models import GlobalSettings
from apps.utils import basic
from apps.utils.files import PathHandler

Expand Down Expand Up @@ -478,17 +477,7 @@ def build_oneline_script_hook_steps(self) -> typing.List[ExecutionSolutionStep]:
构造可直接执行的脚本钩子步骤
:return:
"""
script_hook_obj_name__script_content_map: typing.Dict[str, str] = GlobalSettings.get_config(
models.GlobalSettings.KeyEnum.AGENT_INSTALL_SCRIPT_HOOK_CONTENT.value, {}
)
script_hook_steps: typing.List[ExecutionSolutionStep] = []

# 如果全局配置中配置了钩子脚本内容,优先使用
for script_hook_obj in self.script_hook_objs:
script_hook_obj.script_info_obj.oneline = script_hook_obj_name__script_content_map.get(
script_hook_obj.script_info_obj.name, script_hook_obj.script_info_obj.oneline
)

oneline_script_hook_objs: typing.List[ScriptHook] = [
script_hook_obj for script_hook_obj in self.script_hook_objs if script_hook_obj.script_info_obj.oneline
]
Expand Down
2 changes: 0 additions & 2 deletions apps/node_man/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ class KeyEnum(Enum):
IP_CHOOSER_ENABLE_SHOW_REALTIME_AGENT_STATE = "IP_CHOOSER_ENABLE_SHOW_REALTIME_AGENT_STATE"
# IP选择器详情接口实时展示agent状态业务白名单
IP_CHOOSER_BIZ_WHITELIST = "IP_CHOOSER_BIZ_WHITELIST"
# 安装agent脚本钩子执行内容
AGENT_INSTALL_SCRIPT_HOOK_CONTENT = "AGENT_INSTALL_SCRIPT_HOOK_CONTENT"

key = models.CharField(_("键"), max_length=255, db_index=True, primary_key=True)
v_json = JSONField(_("值"))
Expand Down

0 comments on commit a5e8332

Please sign in to comment.