diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 187: put delimiters around the ip address so that we can be sure we are matching all of it

Message ID 20120104212614.24834.19110.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Jan. 4, 2012, 9:26 p.m. UTC
------------------------------------------------------------
revno: 187
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: get-the-whole-ip-address-bug-906772
timestamp: Thu 2012-01-05 10:16:34 +1300
message:
  put delimiters around the ip address so that we can be sure we are matching all of it
modified:
  lava_dispatcher/client/master.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py	2011-12-19 02:23:53 +0000
+++ lava_dispatcher/client/master.py	2012-01-04 21:16:34 +0000
@@ -220,15 +220,14 @@ 
             logging.warning(traceback.format_exc())
             return None
         #tty device uses minimal match, see pexpect wiki
-        #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
-        pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"
+        pattern1 = "<(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)>"
         cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
-                "awk '{print $1}'" % self._client.default_network_interface)
+                "awk '{print \"<\" $1 \">\"}'" % self._client.default_network_interface)
         self.run(
             cmd, [pattern1, pexpect.EOF, pexpect.TIMEOUT], timeout=5)
         if self.match_id == 0:
             logging.info("\nmatching pattern is %s" % self.match_id)
-            ip = self.match.groups()[0]
+            ip = self.match.group(1)
             logging.info("Master IP is %s" % ip)
             return ip
         return None