Ondřej Svoboda has uploaded a new change for review.

Change subject: netinfo: Reflect the order of parsing in the order of branches, 
to aid reading
......................................................................

netinfo: Reflect the order of parsing in the order of branches, to aid reading

First we have to encounter the line "lease {", not the lines that follow it.
The original order was for "speed reasons", but for what cost? Let us prefer
readability.

Change-Id: I532dcbac047d6d6ec9eb77b88d7a84a3fe967bb8
Signed-off-by: Ondřej Svoboda <[email protected]>
---
M lib/vdsm/netinfo.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/36851/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 2b58d66..778b385 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -518,6 +518,11 @@
     dhcpv4_ifaces = set()
 
     for line in lease_file:
+        if line == 'lease {\n':
+            family = 4
+            iface = None
+            continue
+
         if family:
             if line.startswith(IFACE) and line.endswith(IFACE_END):
                 iface = line[len(IFACE):-len(IFACE_END)]
@@ -536,10 +541,6 @@
                 family = None
                 if iface:
                     dhcpv4_ifaces.add(iface)
-
-        elif line == 'lease {\n':
-            family = 4
-            iface = None
 
     return dhcpv4_ifaces
 


-- 
To view, visit http://gerrit.ovirt.org/36851
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I532dcbac047d6d6ec9eb77b88d7a84a3fe967bb8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to