Change in vdsm[master]: Parsing of file /etc/resolv.conf to return nameservers liste...

avhad.priya24 at gmail.com avhad.priya24 at gmail.com
Sun Apr 5 06:46:54 UTC 2015


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 <avhad.priya24 at gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Priya Avhad <avhad.priya24 at gmail.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list