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

Update script.py due to a new function name

parent 9bdbd3fc
No related branches found
No related tags found
1 merge request!44Update script.py due to a new function name
......@@ -62,7 +62,7 @@ def get_port_lists(filter_str="rows=-1"):
def delete_port_list(port_list):
gmp = create_connection()
res = gmp.delete_portlist(port_list['id'])
res = gmp.delete_port_list(port_list['id'])
status = res.xpath('@status')[0]
status_text = res.xpath('@status_text')[0]
if status == "200":
......@@ -271,7 +271,7 @@ def get_progress(task):
progress = int(task_info['progress'])# 0 0 0 0 -> 100 -1
return status, progress
def wait_for_task_completition(task, timeout=3600):
def wait_for_task_ending(task, timeout=3600):
start_time = time()
while True:
status, progress = get_progress(task)
......@@ -280,7 +280,7 @@ def wait_for_task_completition(task, timeout=3600):
if status == "Done" and progress == -1:
return True
if time() - start_time > timeout:
print("TIMEOUT during waiting for task completition")
print("TIMEOUT during waiting for task ending")
return False
sleep(60)
......@@ -409,8 +409,6 @@ auth_name = os.getenv('GMP_USER')
auth_passwd = os.getenv('GMP_PASSWORD')
print(auth_name, auth_passwd)
logging.basicConfig(filename='debug.log', level=logging.DEBUG)
#local_ip = socket.gethostbyname(socket.gethostname())
#local_ip = '127.0.0.1'
local_ip = os.getenv('HOST_IP')
connection = TLSConnection(hostname=local_ip)
transform = EtreeTransform()
......@@ -457,7 +455,7 @@ for host,ports in endpoints.items():
print_pretty_json(task)
if task['status'] == 'New':
task = start_task(task)
if wait_for_task_completition(task,wait_timeout):
if wait_for_task_ending(task,wait_timeout):
save_report(task,report_formats.txt, report_filename)
severities[host] = get_severity(task)
else:
......
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