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

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