> On June 30, 2015, 12:27 a.m., Alejandro Fernandez wrote: > > Thisremoves whitespace from both before making the comparison. Can you > > explain how this works in the case you mentioned?
Hello Alenjandro, Thanks for reviewing the code for me. The code change in this patch does: 1. Wrap the logic in the "get_ip_address_by_ifname" function with a try/except block (without the try/except, the script exits execution with an exception, thus the err reported in the JIRA) 2. The "get_ip_address_by_ifname" function returns None if it can't find the IP for the network interface passed in. 3. The "for i in re.findall" loop first gets a return value from "get_ip_address_by_ifname" function. This is where you saw the new change >> "ip_address_by_iframe = self.get_ip_address_by_ifname(i.strip());". Then do the "if primary_ip == ip_address_by_iframe.strip():" check So the code you asked about was the code for step 3 where the script first gets the value returned from the "get_ip_address_by_ifname" function, then makes sure it's not None, then compares it (after strip it first) with the primary IP the code got earlier on with FQDN. > On June 30, 2015, 12:27 a.m., Alejandro Fernandez wrote: > > ambari-agent/src/main/python/ambari_agent/Facter.py, line 384 > > <https://reviews.apache.org/r/35876/diff/1/?file=992157#file992157line384> > > > > semicolon is not needed. > > variable should be called ip_address_by_ifname Please use AMBARI-11854-no-semicolon-right-var-name.patch where both the semicolon and the var name issues are fixed. - Di ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/35876/#review89832 ----------------------------------------------------------- On June 25, 2015, 2:49 p.m., Di Li wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/35876/ > ----------------------------------------------------------- > > (Updated June 25, 2015, 2:49 p.m.) > > > Review request for Ambari and Alejandro Fernandez. > > > Bugs: AMBARI-11854 > https://issues.apache.org/jira/browse/AMBARI-11854 > > > Repository: ambari > > > Description > ------- > > In a cluster with nodes that has multiple network interfaces. Ambari-agent > fails to start due to one or more active network interface did not bind to an > IP address. This happens when the eth0 network interface does not have an IP > address. > > > Diffs > ----- > > ambari-agent/src/main/python/ambari_agent/Facter.py 94a0ab1 > ambari-agent/src/test/python/ambari_agent/TestHardware.py 61456c5 > > Diff: https://reviews.apache.org/r/35876/diff/ > > > Testing > ------- > > 1. unit test > 2. manually run the script on a cluster where the eth0 network interface does > not have an IP address assigned. > > > Thanks, > > Di Li > >
