Skip to content
Snippets Groups Projects
Commit 37187951 authored by Gioacchino Vino's avatar Gioacchino Vino
Browse files

Reviewed code

parent ad851c83
No related branches found
No related tags found
1 merge request!143Debug paas ci
......@@ -404,10 +404,34 @@ class Task:
def __del__(self):
self.delete()
def qwe__get_info(self, filter: str) -> List[dict]:
res = []
tasks = self.client.get_tasks(filter_string = filter) \
.xpath('task')
for t in tasks:
t_name = str(t.xpath(GVM_XPATH_NAME_TEXT)[0])
t_id = str(t.xpath(GVM_XPATH_ID)[0])
t_in_use = str(t.xpath(GVM_XPATH_INUSE_TEXT)[0])
t_status = str(t.xpath(GVM_XPATH_STATUS_TEXT_3)[0])
t_dict = {"name": t_name,
"id": t_id,
"in_use": t_in_use,
"status": t_status}
try:
t_report_id = t.xpath(GVM_XPATH_LAST_REPORT_ID)[0]
except Exception:
pass
else:
t_dict['report_id'] = t_report_id
res.append(t_dict)
return res
def update_status(self):
tasks_info = self.client.get_tasks(filter_string = self.id)
task_info = tasks_info.xpath('task')[0]
task_info = self.client.get_tasks(filter_string = self.id) \
.xpath('task')[0]
logging.debug(f"task_info: {task_info}")
self.name = task_info.xpath(GVM_XPATH_NAME_TEXT)[0]
self.status = task_info.xpath(GVM_XPATH_STATUS_TEXT_2)
logging.debug(f"task status: {self.status}")
......@@ -424,7 +448,7 @@ class Task:
"progress":self.progress,
"in_use":self.in_use,
}
logging.debug(pretty_json(d))
logging.debug(f"update_status: \n {pretty_json(d)}")
def wait(self, timeout: int = 7200) -> bool:
start_time = time()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment