mirror of https://github.com/jumpserver/jumpserver
fix: gather account sync account to asset
parent
4fa88aa226
commit
827c829658
|
@ -358,7 +358,6 @@ class GatherAccountsManager(AccountBasePlaybookManager):
|
|||
for asset, accounts_data in self.asset_account_info.items():
|
||||
ori_users = self.ori_asset_usernames[str(asset.id)]
|
||||
with tmp_to_org(asset.org_id):
|
||||
gathered_accounts = []
|
||||
for d in accounts_data:
|
||||
username = d["username"]
|
||||
ori_account = self.ori_gathered_accounts_mapper.get(
|
||||
|
@ -374,6 +373,9 @@ class GatherAccountsManager(AccountBasePlaybookManager):
|
|||
self.create_gathered_account.finish()
|
||||
self.update_gathered_account.finish()
|
||||
self.update_gather_accounts_status(asset)
|
||||
if not self.is_sync_account:
|
||||
continue
|
||||
gathered_accounts = GatheredAccount.objects.filter(asset=asset)
|
||||
GatheredAccount.sync_accounts(gathered_accounts, self.is_sync_account)
|
||||
# 因为有 bulk create, bulk update, 所以这里需要 sleep 一下,等待数据同步
|
||||
time.sleep(0.5)
|
||||
|
|
Loading…
Reference in New Issue