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

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