mirror of https://github.com/jumpserver/jumpserver
fix: 修复 Host name 中包含 [ 导致 ansible 错误的问题
parent
ed5f4a227f
commit
29fdeef45f
|
@ -163,8 +163,9 @@ class JMSInventory:
|
|||
|
||||
protocol = self.get_primary_protocol(ansible_config, protocols)
|
||||
|
||||
name = asset.name.replace(' ', '_').replace('[', '_').replace(']', '_')
|
||||
host = {
|
||||
'name': '{}'.format(asset.name.replace(' ', '_')),
|
||||
'name': name,
|
||||
'jms_asset': {
|
||||
'id': str(asset.id), 'name': asset.name, 'address': asset.address,
|
||||
'type': asset.type, 'category': asset.category,
|
||||
|
@ -281,7 +282,6 @@ class JMSInventory:
|
|||
data = {'all': {'hosts': {}}}
|
||||
for host in hosts:
|
||||
name = host.pop('name')
|
||||
name = name.replace('[', '_').replace(']', '_')
|
||||
data['all']['hosts'][name] = host
|
||||
if not self.exclude_localhost:
|
||||
data['all']['hosts'].update({
|
||||
|
|
Loading…
Reference in New Issue