mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-28 19:11:19 +00:00
fix: push account duplicate (#9336)
Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
parent
c2a8acb73b
commit
4bef48eb6a
@ -21,14 +21,15 @@ class PushAccountManager(PushOrVerifyHostCallbackMixin, AccountBasePlaybookManag
|
||||
|
||||
def create_nonlocal_accounts(self, accounts, snapshot_account_usernames, asset):
|
||||
secret = self.execution.snapshot['secret']
|
||||
usernames = accounts.filter(secret_type=self.secret_type).values_list(
|
||||
secret_type = self.secret_type
|
||||
usernames = accounts.filter(secret_type=secret_type).values_list(
|
||||
'username', flat=True
|
||||
)
|
||||
create_usernames = set(snapshot_account_usernames) - set(usernames)
|
||||
create_account_objs = [
|
||||
Account(
|
||||
name=username, username=username, secret=secret,
|
||||
secret_type=self.secret_type, asset=asset,
|
||||
name=f'{username}-{secret_type}', username=username,
|
||||
secret=secret, secret_type=secret_type, asset=asset,
|
||||
)
|
||||
for username in create_usernames
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user