scripts: run_chroot_version_hooks: Update failure messaging
Add messaging when chroot version hooks fail to tell the user the
issue can be bypassed by replacing the chroot.
BUG=None
TEST=manual
Change-Id: I695f21539df0df33a7a74c5d01149c1cd2c836bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3971940
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Auto-Submit: Alex Klein <saklein@chromium.org>
Commit-Queue: Gilberto Contreras <gcontreras@google.com>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: Gilberto Contreras <gcontreras@google.com>
diff --git a/scripts/run_chroot_version_hooks.py b/scripts/run_chroot_version_hooks.py
index 5cdb66c..fdcdc4f 100644
--- a/scripts/run_chroot_version_hooks.py
+++ b/scripts/run_chroot_version_hooks.py
@@ -11,6 +11,8 @@
not strongly correlated.
"""
+import logging
+
from chromite.lib import commandline
from chromite.lib import cros_build_lib
from chromite.lib import cros_sdk_lib
@@ -43,7 +45,7 @@
def main(argv):
"""Main function."""
- cros_build_lib.AssertInsideChroot()
+ commandline.RunInsideChroot()
opts = _ParseArgs(argv)
@@ -52,5 +54,15 @@
else:
try:
cros_sdk_lib.RunChrootVersionHooks()
- except cros_sdk_lib.Error as e:
+ except cros_sdk_lib.InvalidChrootVersionError as e:
cros_build_lib.Die(e)
+ except cros_sdk_lib.Error as e:
+ logging.error(e)
+ logging.warning(
+ "Chroot version hooks failed. Please file a bug with the CrOS "
+ "Build team with the output above (go/cros-build-bug). "
+ "If you are willing to lose all built boards, you can bypass "
+ "the issue by replacing your chroot with:\n"
+ "\tcros_sdk --replace"
+ )
+ return 1