[autotest] Silence the stupid message in utils.is_in_container().
This changes site_utils.is_in_container() to change the arguments
passed to base_utils.run() so as not to log that it calls a shell
command. This is to prevent the message from showing up on every
'atest' invocation.
BUG=chromium:504984
TEST=`atest host list >/dev/null`, see no extra output
Change-Id: Iad9fb29cba327b6b564ecc9fd620cd190f6026c5
Reviewed-on: https://chromium-review.googlesource.com/282310
Tested-by: Richard Barnette <jrbarnette@google.com>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
diff --git a/client/common_lib/site_utils.py b/client/common_lib/site_utils.py
index 48c7175..cf69027 100644
--- a/client/common_lib/site_utils.py
+++ b/client/common_lib/site_utils.py
@@ -549,8 +549,6 @@
@return: True if the process is running inside a container, otherwise False.
"""
- try:
- base_utils.run('cat /proc/1/cgroup | grep "/lxc/" || false')
- return True
- except error.CmdError:
- return False
\ No newline at end of file
+ result = base_utils.run('grep -q "/lxc/" /proc/1/cgroup',
+ verbose=False, ignore_status=True)
+ return result.exit_status == 0