mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-21 11:28:38 +00:00
perf: 优化账号任务
This commit is contained in:
@@ -284,7 +284,5 @@ class Asset(NodesRelationMixin, AbsConnectivity, JMSOrgBaseModel):
|
||||
('push_assetaccount', _('Can push account to asset')),
|
||||
('test_account', _('Can verify account')),
|
||||
('match_asset', _('Can match asset')),
|
||||
('add_assettonode', _('Add asset to node')),
|
||||
('move_assettonode', _('Move asset to node')),
|
||||
('remove_assetfromnode', _('Remove asset from node'))
|
||||
('change_assettonode', _('Can change asset nodes')),
|
||||
]
|
||||
|
@@ -30,11 +30,11 @@ class Domain(JMSOrgBaseModel):
|
||||
|
||||
def random_gateway(self):
|
||||
gateways = [gw for gw in self.active_gateways if gw.is_connective]
|
||||
|
||||
if not gateways:
|
||||
logger.warn(f'Gateway all bad. domain={self}, gateway_num={len(gateways)}.')
|
||||
gateways = self.active_gateways
|
||||
if not gateways:
|
||||
logger.warn(f'Not active gateway. domain={self}')
|
||||
logger.warn(f'Not active gateway, domain={self}, pass')
|
||||
return None
|
||||
return random.choice(gateways)
|
||||
|
||||
|
Reference in New Issue
Block a user