mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-29 11:23:17 +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):
|
def create_nonlocal_accounts(self, accounts, snapshot_account_usernames, asset):
|
||||||
secret = self.execution.snapshot['secret']
|
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
|
'username', flat=True
|
||||||
)
|
)
|
||||||
create_usernames = set(snapshot_account_usernames) - set(usernames)
|
create_usernames = set(snapshot_account_usernames) - set(usernames)
|
||||||
create_account_objs = [
|
create_account_objs = [
|
||||||
Account(
|
Account(
|
||||||
name=username, username=username, secret=secret,
|
name=f'{username}-{secret_type}', username=username,
|
||||||
secret_type=self.secret_type, asset=asset,
|
secret=secret, secret_type=secret_type, asset=asset,
|
||||||
)
|
)
|
||||||
for username in create_usernames
|
for username in create_usernames
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user