Reland: api: artifacts, payload: Properly plumb chroot parameters for tempdir
Originally at:
https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4621999
With missing changes for cbuildbot/commands.py / GeneratePayloads
---
The payload and artifacts services tend to be using the wrong chroot tmp
directory, because they use chroot_util.TempDirInChroot(), which doesn't
provide the ability to map non-default chroot parameters. This sometimes
works out OK if the exact path doesn't matter, but sometimes we hit up
against non-existent paths or other mismatches.
Drop chroot_util.TempDirInChroot() and use chroot_lib.Chroot.tempdir()
(where Chroot encourages carrying the correct parameters), and plumb the
Chroot params through the payload APIs.
For a few of these refactorings, construct a default Chroot object
instead of bothering with all the plumbing (even though that's likely
incorrect in some cases), because:
(1) it's functionally equivalent and
(2) I suspect some of it only sources back to (dead?) cbuildbot code.
SignerPayloadsClientGoogleStorage note: this class didn't require a work
directory, but all users pass one. Make this param required, so we can
drop any directory-creating fallback.
BUG=b:265885353
TEST=./run_tests
Change-Id: I2b5a4d44b36e95a9d2a9dfa153b08d084780f233
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4638455
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Commit-Queue: Brian Norris <briannorris@chromium.org>
diff --git a/api/controller/artifacts_unittest.py b/api/controller/artifacts_unittest.py
index aba247b..3519891 100644
--- a/api/controller/artifacts_unittest.py
+++ b/api/controller/artifacts_unittest.py
@@ -611,7 +611,7 @@
self.PatchObject(constants, "SOURCE_ROOT", new=self.source_root)
- def MockPayloads(image_path, archive_dir):
+ def MockPayloads(_, image_path, archive_dir):
osutils.WriteFile(
os.path.join(archive_dir, "payload1.bin"), image_path
)