mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-26 23:07:24 +00:00
perf: 优化 protocol 选择
This commit is contained in:
parent
ba076f6612
commit
59d9572d07
@ -99,7 +99,8 @@ class JMSInventory:
|
||||
if gateway:
|
||||
host.update(self.make_proxy_command(gateway))
|
||||
|
||||
def asset_to_host(self, asset, account, automation, protocols, platform):
|
||||
@staticmethod
|
||||
def get_primary_protocol(protocols):
|
||||
primary_protocol = [p for p in protocols if p.primary]
|
||||
if len(primary_protocol) >= 1:
|
||||
primary = primary_protocol[0]
|
||||
@ -114,6 +115,10 @@ class JMSInventory:
|
||||
else:
|
||||
protocol = 'null'
|
||||
port = 0
|
||||
return protocol, port
|
||||
|
||||
def asset_to_host(self, asset, account, automation, protocols, platform):
|
||||
protocol, port = self.get_primary_protocol(protocols)
|
||||
|
||||
host = {
|
||||
'name': '{}'.format(asset.name.replace(' ', '_')),
|
||||
|
Loading…
Reference in New Issue
Block a user