Don't fail if missing IP (#9253)

This commit is contained in:
Pere Miquel Brull 2022-12-13 07:17:15 +01:00 committed by GitHub
parent 9a4e3a7a46
commit 4fbab2d8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,10 +79,8 @@ def get_fn(blueprint: Blueprint) -> Callable:
if host_ip: if host_ip:
return ApiResponse.success({"ip": host_ip}) return ApiResponse.success({"ip": host_ip})
return ApiResponse.error( # If we cannot fetch the IP, still return a 200 but without informing the IP.
status=ApiResponse.STATUS_SERVER_ERROR, return ApiResponse.success({"ip": "unknown"})
error=f"Could not extract the host IP from neither {IP_SERVICES}. Verify connectivity.",
)
except Exception as exc: except Exception as exc:
msg = f"Internal error obtaining host IP due to [{exc}] " msg = f"Internal error obtaining host IP due to [{exc}] "