From 6af33964dd7adbfe1f4dc67681556965b1e8635b Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Mon, 3 Dec 2018 15:36:42 +0100 Subject: [PATCH] Check ip_address in ping_ip_address function. Change-Id: I234ff0f3717af1f7fd2ec47f799f2a580459daf9 --- tobiko/common/utils/network.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tobiko/common/utils/network.py b/tobiko/common/utils/network.py index f7c278525..b36ea886f 100644 --- a/tobiko/common/utils/network.py +++ b/tobiko/common/utils/network.py @@ -93,6 +93,8 @@ def get_packet_loss(ip): def ping_ip_address(ip_address, should_succeed=True, ping_timeout=None, mtu=None, fragmentation=True): + if not ip_address: + raise ValueError("Invalid IP address: {!r}".format(ip_address)) timeout = ping_timeout or 10 cmd = ['ping', '-c1', '-w1']