diff --git a/oci-arm-monitor.py b/oci-arm-monitor.py index f7c4594..a974faf 100644 --- a/oci-arm-monitor.py +++ b/oci-arm-monitor.py @@ -61,9 +61,10 @@ while True: send_email("OCI ARM Instance Created!", msg) sys.exit(0) except oci.exceptions.ServiceError as e: - if "capacity" in str(e.message).lower() or "host" in str(e.message).lower(): + msg_lower = str(e.message).lower() + if "capacity" in msg_lower or "host" in msg_lower or e.status >= 500: attempts += 1 - print(f"{time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(time.time() + 8*3600))} No capacity. Retrying in {INTERVAL}s...", flush=True) + print(f"{time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(time.time() + 8*3600))} {'No capacity' if 'capacity' in msg_lower else e.message}. Retrying in {INTERVAL}s...", flush=True) else: print(f"Unexpected error: {e.message}", flush=True) send_email("OCI ARM Monitor Error", str(e.message))