Merge pull request #11442 from jumpserver/pr@dev@fix_migrate_sftp

fix: 修复迁移的 sftp 数量不对
pull/11455/head
老广 2023-08-28 19:03:28 +08:00 committed by GitHub
commit 904406c5c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -49,11 +49,11 @@ def migrate_assets_sftp_protocol(apps, schema_editor):
count = 0
print("\nAsset add sftp protocol: ")
asset_ids = asset_cls.objects\
asset_ids = list(asset_cls.objects\
.filter(platform__in=sftp_platforms)\
.exclude(protocols__name='sftp')\
.distinct()\
.values_list('id', flat=True)
.values_list('id', flat=True))
while True:
_asset_ids = asset_ids[count:count + 1000]
if not _asset_ids: