perf: 修改 port (#10049)

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2023-03-23 14:13:08 +08:00
committed by GitHub
parent 3b45ad0c61
commit 166d074adb
2 changed files with 11 additions and 11 deletions

View File

@@ -2,11 +2,10 @@
#
from django.utils.translation import ugettext_lazy as _
from orgs.mixins.models import OrgManager
from assets.models.platform import Platform
from assets.const import GATEWAY_NAME
from assets.models.platform import Platform
from common.utils import get_logger, lazyproperty
from orgs.mixins.models import OrgManager
from .asset.host import Host
logger = get_logger(__file__)
@@ -57,6 +56,14 @@ class Gateway(Host):
account = self.select_account
return account.password if account else None
@lazyproperty
def port(self):
protocol = self.protocols.filter(name='ssh').first()
if protocol:
return protocol.port
else:
return '22'
@lazyproperty
def private_key(self):
account = self.select_account