mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-19 09:16:57 +00:00
perf: 优化一个函数名
This commit is contained in:
parent
6aaa20ba17
commit
cbe384161a
@ -107,7 +107,7 @@ class JMSInventory:
|
|||||||
host.update(self.make_proxy_command(gateway))
|
host.update(self.make_proxy_command(gateway))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_ansible_protocol(ansible_config, protocols):
|
def get_primary_protocol(ansible_config, protocols):
|
||||||
invalid_protocol = type('protocol', (), {'name': 'null', 'port': 0})
|
invalid_protocol = type('protocol', (), {'name': 'null', 'port': 0})
|
||||||
ansible_connection = ansible_config.get('ansible_connection')
|
ansible_connection = ansible_config.get('ansible_connection')
|
||||||
# 数值越小,优先级越高,若用户在 ansible_config 中配置了,则提高用户配置方式的优先级
|
# 数值越小,优先级越高,若用户在 ansible_config 中配置了,则提高用户配置方式的优先级
|
||||||
@ -136,7 +136,7 @@ class JMSInventory:
|
|||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
ansible_config = {}
|
ansible_config = {}
|
||||||
|
|
||||||
protocol = self.get_ansible_protocol(ansible_config, protocols)
|
protocol = self.get_primary_protocol(ansible_config, protocols)
|
||||||
|
|
||||||
host = {
|
host = {
|
||||||
'name': '{}'.format(asset.name.replace(' ', '_')),
|
'name': '{}'.format(asset.name.replace(' ', '_')),
|
||||||
|
Loading…
Reference in New Issue
Block a user