diff --git a/.obs/wait_obs.py b/.obs/wait_obs.py index 5fe1501..001ce7c 100644 --- a/.obs/wait_obs.py +++ b/.obs/wait_obs.py @@ -12,6 +12,8 @@ def get_buildstatus(project: str) -> ET.Element: output = subprocess.check_output(["osc", "pr", "--xml", project]) return ET.fromstring(output) except subprocess.CalledProcessError: + # Don't retry immediatly just in case is a network error + time.sleep(5) continue print("Failed to get buildstatus from OBS") @@ -20,6 +22,12 @@ def do_wait(project:str, commit:str) -> ET.Element: while True: time.sleep(5) status = get_buildstatus(project) + + # Just in case the buildstatus fails + if status is None: + print("Could not retrieve status, retrying...") + continue + if last_state == status.get("state"): continue else: @@ -80,4 +88,4 @@ def main(): sys.exit(print_results(status)) if __name__ == "__main__": - main() \ No newline at end of file + main()