exit 1 if installation is not successful

This commit is contained in:
fbsanchez 2022-02-02 12:12:41 +01:00
parent 17be6f3ca5
commit d0ebb10925
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Script to install the Pandora FMS Console. # Script to install the Pandora FMS Console.
import os import os
import sys
from pyvirtualdisplay import Display from pyvirtualdisplay import Display
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
@ -35,8 +36,10 @@ try:
browser.find_element_by_name("rn_file").click() browser.find_element_by_name("rn_file").click()
except AssertionError as error: except AssertionError as error:
print("Error " + str(error) + ":\n" + browser.page_source) print("Error " + str(error) + ":\n" + browser.page_source)
sys.exit(1)
except NoSuchElementException as error: except NoSuchElementException as error:
print("Error " + str(error) + ":\n" + browser.page_source) print("Error " + str(error) + ":\n" + browser.page_source)
sys.exit(1)
# Clean-up # Clean-up
browser.quit() browser.quit()