Reland "Artifacts service: add support for license_credits.html"

This is a reland of 2ffee8ae6a2f012f1868bc902abf3b23adffcf99

Original change's description:
> Artifacts service: add support for license_credits.html
>
> BUG=b:191479981
> TEST=unit tests (no coverage for relevant endpoint, though)
>
> Change-Id: Ibf03f934ebed4d6f1ca537b8b2f24e79233bf1bc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2972282
> Reviewed-by: Alex Klein <saklein@chromium.org>
> Reviewed-by: George Engelbrecht <engeg@google.com>
> Tested-by: Jack Neus <jackneus@google.com>
> Commit-Queue: Jack Neus <jackneus@google.com>

BUG=b:191479981
TEST=none

Change-Id: If954c6809f5c6feaa07b4a049b4f80fb271e7282
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2997542
Tested-by: Jack Neus <jackneus@google.com>
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Jack Neus <jackneus@google.com>
diff --git a/api/controller/sysroot.py b/api/controller/sysroot.py
index 0dc1f1e..602037a 100644
--- a/api/controller/sysroot.py
+++ b/api/controller/sysroot.py
@@ -68,24 +68,21 @@
     A list of dictionary mappings of ArtifactType to list of paths.
   """
   generated = []
+  artifact_types = {
+    in_proto.ArtifactType.BREAKPAD_DEBUG_SYMBOLS: sysroot.BundleBreakpadSymbols,
+    in_proto.ArtifactType.DEBUG_SYMBOLS: sysroot.BundleDebugSymbols
+  }
+
   for output_artifact in in_proto.output_artifacts:
-    if (in_proto.ArtifactType.BREAKPAD_DEBUG_SYMBOLS
-        in output_artifact.artifact_types):
-      result_path = sysroot.BundleBreakpadSymbols(chroot, sysroot_class,
-                                                  build_target, output_dir)
-      if result_path:
-        generated.append({
-            'paths': [result_path],
-            'type': in_proto.ArtifactType.BREAKPAD_DEBUG_SYMBOLS,
-        })
-    if in_proto.ArtifactType.DEBUG_SYMBOLS in output_artifact.artifact_types:
-      result_path = sysroot.BundleDebugSymbols(chroot, sysroot_class,
-                                               build_target, output_dir)
-      if result_path:
-        generated.append({
-            'paths': [result_path],
-            'type': in_proto.ArtifactType.DEBUG_SYMBOLS,
-        })
+    for artifact_type, func in artifact_types.items():
+      if artifact_type in output_artifact.artifact_types:
+        result = func(chroot, sysroot_class, build_target, output_dir)
+        if result:
+          generated.append({
+              'paths': [result] if isinstance(result, str) else result,
+              'type': artifact_type,
+          })
+
   return generated