mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-24 09:00:23 +00:00
perf: push account without increasing version.
This commit is contained in:
parent
02bdd0f07d
commit
3cd68ba0a9
@ -161,7 +161,7 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
||||
return inventory_hosts
|
||||
|
||||
@staticmethod
|
||||
def need_change_account_version(account, recorder):
|
||||
def require_update_version(account, recorder):
|
||||
return account.secret != recorder.new_secret
|
||||
|
||||
def on_host_success(self, host, result):
|
||||
@ -176,6 +176,7 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
||||
print("Account not found, deleted ?")
|
||||
return
|
||||
|
||||
version_update_required = self.require_update_version(account, recorder)
|
||||
account.secret = recorder.new_secret
|
||||
account.date_updated = timezone.now()
|
||||
|
||||
@ -186,7 +187,7 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
||||
try:
|
||||
recorder.save()
|
||||
account_update_fields = ['secret', 'date_updated']
|
||||
if self.need_change_account_version(account, recorder):
|
||||
if version_update_required:
|
||||
account_update_fields.append('version')
|
||||
account.save(update_fields=account_update_fields)
|
||||
break
|
||||
|
@ -9,7 +9,7 @@ logger = get_logger(__name__)
|
||||
class PushAccountManager(ChangeSecretManager, AccountBasePlaybookManager):
|
||||
|
||||
@staticmethod
|
||||
def need_change_account_version(account, recorder):
|
||||
def require_update_version(account, recorder):
|
||||
account.skip_history_when_saving = True
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user