Ido Barkan has posted comments on this change. Change subject: Parsing of file /etc/resolv.conf to return nameservers listed in it Unit testcases for the above functionality ......................................................................
Patch Set 1: (1 comment) https://gerrit.ovirt.org/#/c/39460/1/lib/vdsm/netinfo.py File lib/vdsm/netinfo.py: Line 87: """ Returns a list of nameservers listed in /etc/resolv.conf """ Line 88: dnss = []; Line 89: lines = filetext.splitlines(); Line 90: for line in lines: Line 91: words = line.split(' ',1); > 1. Using maxsplit argument so that following entries from /etc/resolv.conf 1. you are already filtering using the if statement. 2. 'white spaces' can also include 'tab' ('\t') characters, and even if this is not parsed well by the resolver, using the default value also works, and shorter too. Line 92: if words[0] == 'nameserver': Line 93: dnss.append(words[1]); Line 94: return dnss; Line 95: -- To view, visit https://gerrit.ovirt.org/39460 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3ce8a0e2bf93b118620739b144e70c576f03cd08 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Priya Avhad <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Ido Barkan <[email protected]> Gerrit-Reviewer: Priya Avhad <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
