From 4bef48eb6a8613c2e79ffe5fa450c5a44f3f57ce Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 18 Jan 2023 17:33:10 +0800 Subject: [PATCH] fix: push account duplicate (#9336) Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/automations/push_account/manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/accounts/automations/push_account/manager.py b/apps/accounts/automations/push_account/manager.py index 896304db1..13e30b9bb 100644 --- a/apps/accounts/automations/push_account/manager.py +++ b/apps/accounts/automations/push_account/manager.py @@ -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 ]