mirror of https://github.com/jumpserver/jumpserver
perf: When account push change secret windows only modify the type equal to password
parent
ceb2a9bb17
commit
8506ae9edd
|
@ -8,7 +8,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
from xlsxwriter import Workbook
|
from xlsxwriter import Workbook
|
||||||
|
|
||||||
from accounts.const import AutomationTypes, SecretType, SSHKeyStrategy, SecretStrategy, ChangeSecretRecordStatusChoice
|
from accounts.const import AutomationTypes, SecretType, SSHKeyStrategy, SecretStrategy, ChangeSecretRecordStatusChoice
|
||||||
from accounts.models import ChangeSecretRecord
|
from accounts.models import ChangeSecretRecord, BaseAccountQuerySet
|
||||||
from accounts.notifications import ChangeSecretExecutionTaskMsg, ChangeSecretFailedMsg
|
from accounts.notifications import ChangeSecretExecutionTaskMsg, ChangeSecretFailedMsg
|
||||||
from accounts.serializers import ChangeSecretRecordBackUpSerializer
|
from accounts.serializers import ChangeSecretRecordBackUpSerializer
|
||||||
from assets.const import HostTypes
|
from assets.const import HostTypes
|
||||||
|
@ -68,10 +68,10 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
||||||
else:
|
else:
|
||||||
return self.secret_generator(secret_type).get_secret()
|
return self.secret_generator(secret_type).get_secret()
|
||||||
|
|
||||||
def get_accounts(self, privilege_account):
|
def get_accounts(self, privilege_account) -> BaseAccountQuerySet | None:
|
||||||
if not privilege_account:
|
if not privilege_account:
|
||||||
print(f'not privilege account')
|
print('Not privilege account')
|
||||||
return []
|
return
|
||||||
|
|
||||||
asset = privilege_account.asset
|
asset = privilege_account.asset
|
||||||
accounts = asset.accounts.all()
|
accounts = asset.accounts.all()
|
||||||
|
@ -108,6 +108,9 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
||||||
print(f'Windows {asset} does not support ssh key push')
|
print(f'Windows {asset} does not support ssh key push')
|
||||||
return inventory_hosts
|
return inventory_hosts
|
||||||
|
|
||||||
|
if asset.type == HostTypes.WINDOWS:
|
||||||
|
accounts = accounts.filter(secret_type=SecretType.PASSWORD)
|
||||||
|
|
||||||
host['ssh_params'] = {}
|
host['ssh_params'] = {}
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
h = deepcopy(host)
|
h = deepcopy(host)
|
||||||
|
|
Loading…
Reference in New Issue