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

Merge branch 'debug_paas_ci' into 'main'

Update script.py due to a new function name

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