From 9388f37c39ffc8480047d3fa488e03971bb39f66 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Thu, 23 Jun 2022 18:32:36 +0800 Subject: [PATCH] fix: ticket bug --- apps/assets/models/cmd_filter.py | 2 +- apps/tickets/migrations/0017_auto_20220623_1027.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/assets/models/cmd_filter.py b/apps/assets/models/cmd_filter.py index 4e8e20cd9..d91d50988 100644 --- a/apps/assets/models/cmd_filter.py +++ b/apps/assets/models/cmd_filter.py @@ -173,7 +173,7 @@ class CommandFilterRule(OrgModelMixin): 'apply_run_user_id': session.user_id, 'apply_run_asset_id': session.asset_id, 'apply_run_system_user_id': session.system_user_id, - 'apply_run_command': run_command[:4096], + 'apply_run_command': run_command[:4090], 'apply_from_session_id': str(session.id), 'apply_from_cmd_filter_rule_id': str(cmd_filter_rule.id), 'apply_from_cmd_filter_id': str(cmd_filter_rule.filter.id), diff --git a/apps/tickets/migrations/0017_auto_20220623_1027.py b/apps/tickets/migrations/0017_auto_20220623_1027.py index 1738de35a..258ff676a 100644 --- a/apps/tickets/migrations/0017_auto_20220623_1027.py +++ b/apps/tickets/migrations/0017_auto_20220623_1027.py @@ -240,17 +240,19 @@ def command_confirm_migrate(apps, *args): tickets = ticket_model.objects.filter(type=TicketType.command_confirm) session_ids = tickets.values_list('meta__apply_from_session_id', flat=True) - session_ids = session_model.objects.filter(id__in=session_ids).values_list('id', flat=True) - + session_ids = session_model.objects.filter(id__in=list(session_ids)).values_list('id', flat=True) + session_ids = [str(i) for i in session_ids] command_filter_ids = tickets.values_list('meta__apply_from_cmd_filter_id', flat=True) command_filter_ids = command_filter_model.objects\ - .filter(id__in=command_filter_ids)\ + .filter(id__in=list(command_filter_ids))\ .values_list('id', flat=True) - + command_filter_ids = [str(i) for i in command_filter_ids] command_filter_rule_ids = tickets.values_list('meta__apply_from_cmd_filter_rule_id', flat=True) command_filter_rule_ids = command_filter_rule_model.objects\ - .filter(id__in=command_filter_rule_ids)\ + .filter(id__in=list(command_filter_rule_ids))\ .values_list('id', flat=True) + command_filter_rule_ids = [str(i) for i in command_filter_rule_ids] + ticket_apply_command_model = apps.get_model('tickets', 'ApplyCommandTicket') for instance in tickets: @@ -287,7 +289,7 @@ def command_confirm_migrate(apps, *args): 'apply_run_user': apply_run_user, 'apply_run_asset': apply_run_asset, 'apply_run_system_user': apply_run_system_user, - 'apply_run_command': meta.get('apply_run_command', '')[:4096], + 'apply_run_command': meta.get('apply_run_command', '')[:4090], 'apply_from_session_id': apply_from_session_id, 'apply_from_cmd_filter_id': apply_from_cmd_filter_id, 'apply_from_cmd_filter_rule_id': apply_from_cmd_filter_rule_id,