[Kimchi-devel] [PATCH] Change function that verifies network interface status
Crístian Viana
vianac at linux.vnet.ibm.com
Thu Aug 21 13:54:16 UTC 2014
On 20-08-2014 11:58, Ramon Medeiros wrote:
> LTC Bugzilla #115031 - LTCTest: build-8: List interfaces which are
> active
>
> The old way does just consider if the interface has connectivity, not
> the interface status. The new file can determine if the interface is up
> or down and if cable is connected or not.
>
> Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
There are trailing white spaces in your patch. Please remove them.
> + # try to read interface status
> + try:
> + status = open(NET_STATE % dev).readline().strip()
> + except IOError:
> + pass
> +
> + # when IOError is raised, interface is down
> + if status == None:
> + return "down"
If you want to return "down" when IOError is raised, do it inside the
"except IOError" block (which actually exists but does nothing). I know
both codes are similar, but the one in this patch is less clear.
More information about the Kimchi-devel
mailing list