perf: 主机名包含/ 可以执行ansible任务 (#11772)

Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
fit2bot
2023-10-09 16:05:42 +08:00
committed by GitHub
parent e00c804a5a
commit c981e9cd9f
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
# ~*~ coding: utf-8 ~*~
import json
import os
import re
from collections import defaultdict
from django.utils.translation import gettext as _
@@ -159,7 +160,7 @@ class JMSInventory:
protocol = self.get_primary_protocol(ansible_config, protocols)
tp, category = asset.type, asset.category
name = asset.name.replace(' ', '_').replace('[', '_').replace(']', '_')
name = re.sub(r'[ \[\]/]', '_', asset.name)
secret_info = {k: v for k, v in asset.secret_info.items() if v}
host = {
'name': name,