lib: chroot_lib: Add {sudo_,}run() wrapper
It's easy for cros_build_lib.run(enter_chroot=True) callers to get
chroot parameters wrong. Supply a helper, which makes doing the Right
Thing a lot shorter to type.
So far, I'm only converting callers that already supplied chroot_args.
BUG=none
TEST=./run_tests
Change-Id: Ice0f82eea1744d6f9a53e7b5a9e89031ae50423a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4704418
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
diff --git a/api/router.py b/api/router.py
index ea59e8c..50fe6fe 100644
--- a/api/router.py
+++ b/api/router.py
@@ -543,13 +543,10 @@
]
try:
- result = cros_build_lib.run(
+ result = chroot.run(
cmd,
- enter_chroot=True,
cwd=constants.SOURCE_ROOT,
- chroot_args=chroot.get_enter_args(),
check=False,
- extra_env=chroot.env,
)
except cros_build_lib.RunCommandError:
# A non-zero return code will not result in an error, but one