Convert argument elements of task status to types

This commit is contained in:
Joshua Boniface 2021-08-09 09:33:51 -04:00
parent d3392c0282
commit 3b41beb0f3
1 changed files with 3 additions and 2 deletions

View File

@ -20,6 +20,7 @@
############################################################################### ###############################################################################
from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor
from ast import literal_eval
import pvc.cli_lib.ansiprint as ansiprint import pvc.cli_lib.ansiprint as ansiprint
from pvc.cli_lib.common import UploadProgressBar, call_api from pvc.cli_lib.common import UploadProgressBar, call_api
@ -723,10 +724,10 @@ def task_status(config, task_id=None, is_watching=False):
task['type'] = task_type task['type'] = task_type
task['worker'] = task_host task['worker'] = task_host
task['id'] = task_job.get('id') task['id'] = task_job.get('id')
task_args = task_job.get('args') task_args = literal_eval(task_job.get('args'))
task['vm_name'] = task_args[0] task['vm_name'] = task_args[0]
task['vm_profile'] = task_args[1] task['vm_profile'] = task_args[1]
task_kwargs = task_job.get('kwargs') task_kwargs = literal_eval(task_job.get('kwargs'))
task['vm_define'] = str(bool(task_kwargs['define_vm'])) task['vm_define'] = str(bool(task_kwargs['define_vm']))
task['vm_start'] = str(bool(task_kwargs['start_vm'])) task['vm_start'] = str(bool(task_kwargs['start_vm']))
task_data.append(task) task_data.append(task)