api.payload: Have GeneratePayload return paths
We should have this endpoint tell us where it placed the artifacts it
generated. We'll constrain this to the local delta path as well as the
remote path if it was configured to upload.
In the future we might consider changing lib/paygen to give us a
complete listing of generated files, as some files here still escape
(i.e. are placed on gs but not returned). These include hashes and other
control files.
BUG=chromium:1122854
TEST=./run_tests.py
Change-Id: I2ba07c222980493b67b3dd22cfa3b0e87a699ed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2535713
Reviewed-by: LaMont Jones <lamontjones@chromium.org>
Commit-Queue: George Engelbrecht <engeg@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
diff --git a/api/controller/payload.py b/api/controller/payload.py
index 4e36742..1253406 100644
--- a/api/controller/payload.py
+++ b/api/controller/payload.py
@@ -86,20 +86,23 @@
return controller.RETURN_CODE_VALID_INPUT
# Do payload generation.
- paygen_ok = payload_config.GeneratePayload()
- _SetGeneratePayloadOutputProto(output_proto, paygen_ok)
+ local_path, remote_uri = payload_config.GeneratePayload()
+ _SetGeneratePayloadOutputProto(output_proto, local_path, remote_uri)
- if paygen_ok:
+ if remote_uri or not upload and local_path:
return controller.RETURN_CODE_SUCCESS
else:
return controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY
-def _SetGeneratePayloadOutputProto(output_proto, generate_payload_ok):
+def _SetGeneratePayloadOutputProto(output_proto, local_path, remote_uri):
"""Set the output proto with the results from the service class.
Args:
output_proto (PayloadGenerationResult_pb2): The output proto.
- generate_payload_ok (bool): value to set output_proto.success.
+ local_path (str): set output_proto with the local path, or None.
+ remote_uri (str): set output_proto with the remote uri, or None.
"""
- output_proto.success = generate_payload_ok
+ output_proto.success = True
+ output_proto.local_path = local_path
+ output_proto.remote_uri = remote_uri