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

Co-authored-by: feng <1304903146@qq.com>
pull/11774/head
fit2bot 2023-10-09 16:05:42 +08:00 committed by GitHub
parent e00c804a5a
commit c981e9cd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -16,7 +16,7 @@ class SecretGenerator:
@staticmethod
def generate_ssh_key():
private_key, public_key = ssh_key_gen()
private_key, __ = ssh_key_gen()
return private_key
def generate_password(self):

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,