Priya Avhad 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); > please refer to https://docs.python.org/2/library/stdtypes.html#str.split 1. Using maxsplit argument so that following entries from /etc/resolv.conf will get automatically filtered out - 1. search search list 2. sortlist IP/NETMASK 3. options option .. which can have more than one value separated by tabs or spaces.So entries which we'll get after maxsplit of 1 will be in the form --> Keyword Value 2. Using default value for delimiter because as per 'man 5 resolv.conf', value follows the keyword, separated by white space 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
