au_test_harness: fix a function call, add sudo in front of ifconfig

Note: sudo before ifconfig is for running on distros which do not
have /sbin or /usr/sbin in common user's paths, like gentoo.

Change-Id: I85bd379ad059d6ecaa8c11f3167fae27987479dd

BUG=5246
TEST=run cros_au_test_harness and see it not fail

Review URL: http://codereview.chromium.org/6541008
This commit is contained in:
Zdenek Behan 2011-02-18 06:06:55 +01:00
parent 9a776566e9
commit c264a45ba8
2 changed files with 3 additions and 3 deletions

View File

@ -482,7 +482,7 @@ class RealAUTest(unittest.TestCase, AUTest):
def PrepareBase(self, image_path): def PrepareBase(self, image_path):
"""Auto-update to base image to prepare for test.""" """Auto-update to base image to prepare for test."""
_PrepareRealBase(image_path) self._PrepareRealBase(image_path)
def _UpdateImage(self, image_path, src_image_path='', stateful_change='old', def _UpdateImage(self, image_path, src_image_path='', stateful_change='old',
proxy_port=None, private_key_path=None): proxy_port=None, private_key_path=None):

View File

@ -256,8 +256,8 @@ def GetIPAddress(device='eth0'):
this method gives you a generic way to get the address so you are reachable this method gives you a generic way to get the address so you are reachable
either via a VM or remote machine on the same network. either via a VM or remote machine on the same network.
""" """
ifconfig_output = RunCommand(['ifconfig', device], redirect_stdout=True, ifconfig_output = RunCommand(['sudo', 'ifconfig', device],
print_cmd=False) redirect_stdout=True, print_cmd=False)
match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output) match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output)
if match: if match:
return match.group(1) return match.group(1)