cloudutils: use ip command instead of route in networkConfig.py (#10726)

This commit is contained in:
Wei Zhou 2025-05-01 07:57:59 +02:00 committed by GitHub
parent 9d9737ae04
commit 7f16a207e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,7 +41,7 @@ class networkConfig:
return devs
@staticmethod
def getDefaultNetwork():
cmd = bash("route -n|awk \'/^0.0.0.0/ {print $2,$8}\'")
cmd = bash("ip route show default | awk \'{print $3,$5}\'")
if not cmd.isSuccess():
logging.debug("Failed to get default route")
raise CloudRuntimeException("Failed to get default route")