sysroot.py & image.py: Add no specific packages failed condition.

Handling for when there was a failure but nothing to report.

BUG=chromium:983279
TEST=run_tests

Change-Id: I2b82492ae2b2f534f587d7f45df86fbc2ddd4ce5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1697376
Commit-Queue: Alex Klein <saklein@chromium.org>
Commit-Queue: Evan Hernandez <evanhernandez@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
Auto-Submit: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/image.py b/api/controller/image.py
index aaa505b..97b7e8a 100644
--- a/api/controller/image.py
+++ b/api/controller/image.py
@@ -68,7 +68,10 @@
     # Success -- we need to list out the images we built in the output.
     _PopulateBuiltImages(board, image_types, output_proto)
   else:
-    # Failure -- include all of the failed packages in the output.
+    # Failure, include all of the failed packages in the output when available.
+    if not result.failed_packages:
+      return controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY
+
     for package in result.failed_packages:
       current = output_proto.failed_packages.add()
       current.category = package.category