service: Raise exception when payload generation is skipped
Continuation of crrev.com/3856784 where Rubik handlers need exception
raised to skip upload check.
BUG=b:243792598
TEST=./run_tests -- -x service
Change-Id: I5e5d7ad925cf0ae708dd261248419f3c02209dcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3857493
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: George Engelbrecht <engeg@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: George Engelbrecht <engeg@google.com>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/api/controller/payload.py b/api/controller/payload.py
index dc11e0c..600f8de 100644
--- a/api/controller/payload.py
+++ b/api/controller/payload.py
@@ -100,11 +100,11 @@
local_path, remote_uri = '', ''
try:
local_path, remote_uri = payload_config.GeneratePayload()
- except paygen_payload_lib.PayloadGenerationSkippedException as e:
+ except paygen_payload_lib.PayloadGenerationSkippedException:
# If paygen was skipped, provide a reason if possible.
- if isinstance(e, paygen_payload_lib.NoMiniOSPartitionException):
- reason = payload_pb2.GenerationResponse.NOT_MINIOS_COMPATIBLE
- output_proto.failure_reason = reason
+ # Only reason to skip right now is missing miniOS partitions.
+ reason = payload_pb2.GenerationResponse.NOT_MINIOS_COMPATIBLE
+ output_proto.failure_reason = reason
_SetGeneratePayloadOutputProto(output_proto, local_path, remote_uri)
if remote_uri or input_proto.dryrun and local_path: