Blame SOURCES/0001-daemon-Make-failure-to-query-base-image-non-fatal.patch

b70fb6
From a0f1275dfbd835b704355d095e610ac1f1254f25 Mon Sep 17 00:00:00 2001
b70fb6
From: Colin Walters <walters@verbum.org>
b70fb6
Date: Sun, 11 Dec 2022 13:40:15 -0500
b70fb6
Subject: [PATCH] daemon: Make failure to query base image non-fatal
b70fb6
b70fb6
We had a GC bug which then propagates into a hard daemon
b70fb6
failure right now because we try to gather data on all deployments.
b70fb6
b70fb6
Make this non-fatal; we should try to stumble forward as much
b70fb6
as possible so that one can e.g. perform an upgrade operation.
b70fb6
b70fb6
(cherry picked from commit 8dd45f293afc1ca32b42bda86dde47c66e652dda)
b70fb6
---
b70fb6
 src/app/rpmostree-builtin-status.cxx       | 12 +++++++++---
b70fb6
 src/daemon/rpmostreed-deployment-utils.cxx | 20 ++++++++++++++------
b70fb6
 2 files changed, 23 insertions(+), 9 deletions(-)
b70fb6
b70fb6
diff --git a/src/app/rpmostree-builtin-status.cxx b/src/app/rpmostree-builtin-status.cxx
b70fb6
index cec0a2e3..ee82e589 100644
b70fb6
--- a/src/app/rpmostree-builtin-status.cxx
b70fb6
+++ b/src/app/rpmostree-builtin-status.cxx
b70fb6
@@ -688,9 +688,15 @@ print_one_deployment (RPMOSTreeSysroot *sysroot_proxy, GVariant *child, gint ind
b70fb6
           break;
b70fb6
         case rpmostreecxx::RefspecType::Container:
b70fb6
           {
b70fb6
-            g_assert (g_variant_dict_lookup (dict, "container-image-reference-digest", "s",
b70fb6
-                                             &container_image_reference_digest));
b70fb6
-            g_print ("%s", origin_refspec);
b70fb6
+            if (g_variant_dict_lookup (dict, "container-image-reference-digest", "s",
b70fb6
+                                       &container_image_reference_digest))
b70fb6
+              {
b70fb6
+                g_print ("%s", origin_refspec);
b70fb6
+              }
b70fb6
+            else
b70fb6
+              {
b70fb6
+                g_print ("(error fetching image metadata)");
b70fb6
+              }
b70fb6
           }
b70fb6
           break;
b70fb6
         }
b70fb6
diff --git a/src/daemon/rpmostreed-deployment-utils.cxx b/src/daemon/rpmostreed-deployment-utils.cxx
b70fb6
index b7b27fed..48480509 100644
b70fb6
--- a/src/daemon/rpmostreed-deployment-utils.cxx
b70fb6
+++ b/src/daemon/rpmostreed-deployment-utils.cxx
b70fb6
@@ -214,12 +214,20 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment
b70fb6
     case rpmostreecxx::RefspecType::Container:
b70fb6
       {
b70fb6
         g_variant_dict_insert (dict, "container-image-reference", "s", refspec);
b70fb6
-        CXX_TRY_VAR (state, rpmostreecxx::query_container_image_commit (*repo, base_checksum),
b70fb6
-                     error);
b70fb6
-        g_variant_dict_insert (dict, "container-image-reference-digest", "s",
b70fb6
-                               state->image_digest.c_str ());
b70fb6
-        if (state->version.size () > 0)
b70fb6
-          g_variant_dict_insert (dict, "version", "s", state->version.c_str ());
b70fb6
+        // For now, make this non-fatal https://github.com/coreos/rpm-ostree/issues/4185
b70fb6
+        try
b70fb6
+          {
b70fb6
+            auto state = rpmostreecxx::query_container_image_commit (*repo, base_checksum);
b70fb6
+            g_variant_dict_insert (dict, "container-image-reference-digest", "s",
b70fb6
+                                   state->image_digest.c_str ());
b70fb6
+            if (state->version.size () > 0)
b70fb6
+              g_variant_dict_insert (dict, "version", "s", state->version.c_str ());
b70fb6
+          }
b70fb6
+        catch (std::exception &e)
b70fb6
+          {
b70fb6
+            sd_journal_print (LOG_ERR, "failed to query container image base metadata: %s",
b70fb6
+                              e.what ());
b70fb6
+          }
b70fb6
       }
b70fb6
       break;
b70fb6
     case rpmostreecxx::RefspecType::Checksum:
b70fb6
-- 
b70fb6
2.31.1
b70fb6