cbuildbot: only check for inside the chroot after parsing args
This allows cbuildbot_unittest to run inside the chroot. Some of the
unit tests only test argument parsing and fail incorrectly without this
change.
BUG=none
TEST=unit tests
Change-Id: I1294d1e498f2a9b598780719eb5d05ce504437d8
Reviewed-on: https://gerrit.chromium.org/gerrit/32027
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 5b0e8ec..ea49e93 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -1096,14 +1096,15 @@
# Set umask to 022 so files created by buildbot are readable.
os.umask(022)
- if cros_build_lib.IsInsideChroot():
- cros_build_lib.Die('Please run cbuildbot from outside the chroot.')
-
parser = _CreateParser()
(options, args) = _ParseCommandLine(parser, argv)
_PostParseCheck(options, args)
+ if cros_build_lib.IsInsideChroot():
+ cros_build_lib.Die('Please run cbuildbot from outside the chroot.')
+
+
if options.remote:
cros_build_lib.logger.setLevel(logging.WARNING)