|
|
Created:
9 years, 10 months ago by zbehan Modified:
9 years, 7 months ago CC:
chromium-os-reviews_chromium.org, Mandeep Singh Baines, anush, sosa Visibility:
Public. |
Descriptionau_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
Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=c264a45
Patch Set 1 #Patch Set 2 : 80 chars #
Messages
Total messages: 7 (0 generated)
LGTM! Thanks for the fix On Thu, Feb 17, 2011 at 5:05 PM, <zbehan@chromium.org> wrote: > http://codereview.chromium.org/6541008/ >
sudo seems like overkill here. This is a PATH issue and not a permission issue. Just use /sbin/ifconfig. That is the standard location. Was hoping to reference a standard but couldn't find a reference. zbehan@chromium.org (zbehan@chromium.org) wrote: > Reviewers: sosa, dgarrett, > > Description: > 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 > > Please review this at http://codereview.chromium.org/6541008/ > > SVN Base: ssh://git@gitrw.chromium.org:9222/crosutils.git@master > > Affected files: > M bin/cros_au_test_harness.py > M lib/cros_build_lib.py > > > Index: bin/cros_au_test_harness.py > diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py > index 994476caaca7a0d7b09f523edf9eb5b9faea4665..e398625d938142a1b70fc05b533c07c147bb9a71 > 100755 > --- a/bin/cros_au_test_harness.py > +++ b/bin/cros_au_test_harness.py > @@ -482,7 +482,7 @@ class RealAUTest(unittest.TestCase, AUTest): > > def PrepareBase(self, image_path): > """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', > proxy_port=None, private_key_path=None): > Index: lib/cros_build_lib.py > diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py > index 11fa40cac9cf94813f27c70fda281940124f1f96..f37b1ef5976f4dffc2def8b4fc5c0f5854f23def > 100644 > --- a/lib/cros_build_lib.py > +++ b/lib/cros_build_lib.py > @@ -256,7 +256,7 @@ def GetIPAddress(device='eth0'): > 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. > """ > - ifconfig_output = RunCommand(['ifconfig', device], redirect_stdout=True, > + ifconfig_output = RunCommand(['sudo', 'ifconfig', device], > redirect_stdout=True, > print_cmd=False) > match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output) > if match: > >
I couldn't find a standard either, that's why i used sudo. Technically, ifconfig will be half-functional for a normal user anyway. You won't be able to modify any parameters, for example. Also, we use sudo all across anyway. On Fri, Feb 18, 2011 at 4:53 PM, Mandeep Singh Baines <msb@chromium.org>wrote: > sudo seems like overkill here. This is a PATH issue and not a permission > issue. Just use /sbin/ifconfig. That is the standard location. Was hoping > to reference a standard but couldn't find a reference. > > zbehan@chromium.org (zbehan@chromium.org) wrote: > > Reviewers: sosa, dgarrett, > > > > Description: > > 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 > > > > Please review this at http://codereview.chromium.org/6541008/ > > > > SVN Base: ssh://git@gitrw.chromium.org:9222/crosutils.git@master > > > > Affected files: > > M bin/cros_au_test_harness.py > > M lib/cros_build_lib.py > > > > > > Index: bin/cros_au_test_harness.py > > diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py > > index > 994476caaca7a0d7b09f523edf9eb5b9faea4665..e398625d938142a1b70fc05b533c07c147bb9a71 > > 100755 > > --- a/bin/cros_au_test_harness.py > > +++ b/bin/cros_au_test_harness.py > > @@ -482,7 +482,7 @@ class RealAUTest(unittest.TestCase, AUTest): > > > > def PrepareBase(self, image_path): > > """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', > > proxy_port=None, private_key_path=None): > > Index: lib/cros_build_lib.py > > diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py > > index > 11fa40cac9cf94813f27c70fda281940124f1f96..f37b1ef5976f4dffc2def8b4fc5c0f5854f23def > > 100644 > > --- a/lib/cros_build_lib.py > > +++ b/lib/cros_build_lib.py > > @@ -256,7 +256,7 @@ def GetIPAddress(device='eth0'): > > 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. > > """ > > - ifconfig_output = RunCommand(['ifconfig', device], > redirect_stdout=True, > > + ifconfig_output = RunCommand(['sudo', 'ifconfig', device], > > redirect_stdout=True, > > print_cmd=False) > > match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', > ifconfig_output) > > if match: > > > > >
Zdenek Behan (zbehan@chromium.org) wrote: > I couldn't find a standard either, http://www.pathname.com/fhs/pub/fhs-2.3.html > that's why i used sudo. Technically, > ifconfig will > be half-functional for a normal user anyway. You won't be able to modify any > parameters, for example. Also, we use sudo all across anyway. > Still. It would be nice to keep sudo to a minimum. Here sudo is not required. > On Fri, Feb 18, 2011 at 4:53 PM, Mandeep Singh Baines <msb@chromium.org>wrote: > > > sudo seems like overkill here. This is a PATH issue and not a permission > > issue. Just use /sbin/ifconfig. That is the standard location. Was hoping > > to reference a standard but couldn't find a reference. > > > > zbehan@chromium.org (zbehan@chromium.org) wrote: > > > Reviewers: sosa, dgarrett, > > > > > > Description: > > > 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 > > > > > > Please review this at http://codereview.chromium.org/6541008/ > > > > > > SVN Base: ssh://git@gitrw.chromium.org:9222/crosutils.git@master > > > > > > Affected files: > > > M bin/cros_au_test_harness.py > > > M lib/cros_build_lib.py > > > > > > > > > Index: bin/cros_au_test_harness.py > > > diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py > > > index > > 994476caaca7a0d7b09f523edf9eb5b9faea4665..e398625d938142a1b70fc05b533c07c147bb9a71 > > > 100755 > > > --- a/bin/cros_au_test_harness.py > > > +++ b/bin/cros_au_test_harness.py > > > @@ -482,7 +482,7 @@ class RealAUTest(unittest.TestCase, AUTest): > > > > > > def PrepareBase(self, image_path): > > > """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', > > > proxy_port=None, private_key_path=None): > > > Index: lib/cros_build_lib.py > > > diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py > > > index > > 11fa40cac9cf94813f27c70fda281940124f1f96..f37b1ef5976f4dffc2def8b4fc5c0f5854f23def > > > 100644 > > > --- a/lib/cros_build_lib.py > > > +++ b/lib/cros_build_lib.py > > > @@ -256,7 +256,7 @@ def GetIPAddress(device='eth0'): > > > 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. > > > """ > > > - ifconfig_output = RunCommand(['ifconfig', device], > > redirect_stdout=True, > > > + ifconfig_output = RunCommand(['sudo', 'ifconfig', device], > > > redirect_stdout=True, > > > print_cmd=False) > > > match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', > > ifconfig_output) > > > if match: > > > > > > > >
OK. I can change it, in both places where I used this. On Fri, Feb 18, 2011 at 6:10 PM, Mandeep Singh Baines <msb@chromium.org>wrote: > Zdenek Behan (zbehan@chromium.org) wrote: > > I couldn't find a standard either, > > http://www.pathname.com/fhs/pub/fhs-2.3.html > > > that's why i used sudo. Technically, > > ifconfig will > > be half-functional for a normal user anyway. You won't be able to modify > any > > parameters, for example. Also, we use sudo all across anyway. > > > > Still. It would be nice to keep sudo to a minimum. Here sudo is not > required. > > > On Fri, Feb 18, 2011 at 4:53 PM, Mandeep Singh Baines <msb@chromium.org > >wrote: > > > > > sudo seems like overkill here. This is a PATH issue and not a > permission > > > issue. Just use /sbin/ifconfig. That is the standard location. Was > hoping > > > to reference a standard but couldn't find a reference. > > > > > > zbehan@chromium.org (zbehan@chromium.org) wrote: > > > > Reviewers: sosa, dgarrett, > > > > > > > > Description: > > > > 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 > > > > > > > > Please review this at http://codereview.chromium.org/6541008/ > > > > > > > > SVN Base: ssh://git@gitrw.chromium.org:9222/crosutils.git@master > > > > > > > > Affected files: > > > > M bin/cros_au_test_harness.py > > > > M lib/cros_build_lib.py > > > > > > > > > > > > Index: bin/cros_au_test_harness.py > > > > diff --git a/bin/cros_au_test_harness.py > b/bin/cros_au_test_harness.py > > > > index > > > > 994476caaca7a0d7b09f523edf9eb5b9faea4665..e398625d938142a1b70fc05b533c07c147bb9a71 > > > > 100755 > > > > --- a/bin/cros_au_test_harness.py > > > > +++ b/bin/cros_au_test_harness.py > > > > @@ -482,7 +482,7 @@ class RealAUTest(unittest.TestCase, AUTest): > > > > > > > > def PrepareBase(self, image_path): > > > > """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', > > > > proxy_port=None, private_key_path=None): > > > > Index: lib/cros_build_lib.py > > > > diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py > > > > index > > > > 11fa40cac9cf94813f27c70fda281940124f1f96..f37b1ef5976f4dffc2def8b4fc5c0f5854f23def > > > > 100644 > > > > --- a/lib/cros_build_lib.py > > > > +++ b/lib/cros_build_lib.py > > > > @@ -256,7 +256,7 @@ def GetIPAddress(device='eth0'): > > > > 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. > > > > """ > > > > - ifconfig_output = RunCommand(['ifconfig', device], > > > redirect_stdout=True, > > > > + ifconfig_output = RunCommand(['sudo', 'ifconfig', device], > > > > redirect_stdout=True, > > > > print_cmd=False) > > > > match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', > > > ifconfig_output) > > > > if match: > > > > > > > > > > > > |