mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-02 16:05:29 +00:00
perf: applet host accounts should be inactive by default
This commit is contained in:
@@ -11,7 +11,6 @@ from common.db.models import JMSBaseModel
|
|||||||
from common.utils import random_string
|
from common.utils import random_string
|
||||||
from assets.models import Host
|
from assets.models import Host
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['AppletHost', 'AppletHostDeployment']
|
__all__ = ['AppletHost', 'AppletHostDeployment']
|
||||||
|
|
||||||
|
|
||||||
@@ -70,8 +69,8 @@ class AppletHost(Host):
|
|||||||
status_applets['published'].append(applet)
|
status_applets['published'].append(applet)
|
||||||
|
|
||||||
for status, applets in status_applets.items():
|
for status, applets in status_applets.items():
|
||||||
self.publications.filter(applet__in=applets)\
|
self.publications.filter(applet__in=applets) \
|
||||||
.exclude(status=status)\
|
.exclude(status=status) \
|
||||||
.update(status=status)
|
.update(status=status)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -95,7 +94,7 @@ class AppletHost(Host):
|
|||||||
account = account_model(
|
account = account_model(
|
||||||
username=username, secret=password, name=username,
|
username=username, secret=password, name=username,
|
||||||
asset_id=self.id, secret_type='password', version=1,
|
asset_id=self.id, secret_type='password', version=1,
|
||||||
org_id=self.LOCKING_ORG
|
org_id=self.LOCKING_ORG, is_active=False,
|
||||||
)
|
)
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
bulk_create_with_history(accounts, account_model, batch_size=20)
|
bulk_create_with_history(accounts, account_model, batch_size=20)
|
||||||
|
Reference in New Issue
Block a user