fix: 修复批量执行命令时资产名称包含 [ 特殊字符执行报错的问题(issue: 10986)

pull/11003/head
Bai 2023-07-18 18:05:45 +08:00
parent de5b501ebf
commit 8ed3da85f2
1 changed files with 1 additions and 0 deletions

View File

@ -268,6 +268,7 @@ class JMSInventory:
data = {'all': {'hosts': {}}}
for host in hosts:
name = host.pop('name')
name = name.replace('[', '_').replace(']', '_')
data['all']['hosts'][name] = host
if self.exclude_localhost and data['all']['hosts'].__contains__('localhost'):
data['all']['hosts'].update({'localhost': {'ansible_host': '255.255.255.255'}})