mirror of https://github.com/jumpserver/jumpserver
Merge pull request #11003 from jumpserver/pr@dev@fix_ansiblejobrunerror
fix: 修复批量执行命令时资产名称包含 [ 特殊字符执行报错的问题(issue: 10986)pull/11009/head
commit
0c34a41381
|
@ -268,6 +268,7 @@ class JMSInventory:
|
||||||
data = {'all': {'hosts': {}}}
|
data = {'all': {'hosts': {}}}
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
name = host.pop('name')
|
name = host.pop('name')
|
||||||
|
name = name.replace('[', '_').replace(']', '_')
|
||||||
data['all']['hosts'][name] = host
|
data['all']['hosts'][name] = host
|
||||||
if self.exclude_localhost and data['all']['hosts'].__contains__('localhost'):
|
if self.exclude_localhost and data['all']['hosts'].__contains__('localhost'):
|
||||||
data['all']['hosts'].update({'localhost': {'ansible_host': '255.255.255.255'}})
|
data['all']['hosts'].update({'localhost': {'ansible_host': '255.255.255.255'}})
|
||||||
|
|
Loading…
Reference in New Issue