Skip to content

Commit

Permalink
daemon: Add a bit more error prefixing
Browse files Browse the repository at this point in the history
Motivated by seeing a recent issue around the base commit being
pruned.
  • Loading branch information
cgwalters committed Jan 3, 2024
1 parent 8f7adb2 commit a827afb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/daemon/rpmostreed-deployment-utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,15 @@ filter_commit_meta (GVariant *commit_meta)
return g_variant_dict_end (&dict);
}

// This function takes an ostree deployment and reads lots of metadata associated with
// it and generates a GVariant (serialized snapshot) as a single unit.
// It is this GVariant format which appears on DBus.
gboolean
rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment *deployment,
const char *booted_id, OstreeRepo *repo, gboolean filter,
GVariant **out_variant, GError **error)
{
GLNX_AUTO_PREFIX_ERROR ("Reading deployment metadata", error);
g_autoptr (GVariantDict) dict = g_variant_dict_new (NULL);

ROSCXX_TRY (deployment_populate_variant (*sysroot, *deployment, *dict), error);
Expand Down Expand Up @@ -179,7 +183,7 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment
{
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, base_checksum, &base_commit,
error))
return FALSE;
return glnx_prefix_error (error, "Reading base commit");

g_variant_dict_insert (dict, "base-checksum", "s", base_checksum);
variant_add_commit_details (dict, "base-", base_commit);
Expand Down Expand Up @@ -248,15 +252,15 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment
g_autofree char *pending_base_commitrev = NULL;
if (!ostree_repo_resolve_rev (repo, r.refspec.c_str (), TRUE, &pending_base_commitrev,
error))
return FALSE;
return glnx_prefix_error (error, "Resolving target ref");

if (pending_base_commitrev && !g_str_equal (pending_base_commitrev, base_checksum))
{
g_autoptr (GVariant) pending_base_commit = NULL;

if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, pending_base_commitrev,
&pending_base_commit, error))
return FALSE;
return glnx_prefix_error (error, "Reading pending base commit");

g_variant_dict_insert (dict, "pending-base-checksum", "s", pending_base_commitrev);
variant_add_commit_details (dict, "pending-base-", pending_base_commit);
Expand Down
2 changes: 2 additions & 0 deletions src/libpriv/rpmostree-util.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ rpmostree_deployment_get_layered_info (OstreeRepo *repo, OstreeDeployment *deplo
GVariant **out_replaced_base_local_pkgs,
GVariant **out_replaced_base_remote_pkgs, GError **error)
{
GLNX_AUTO_PREFIX_ERROR ("Getting layered info", error);

const char *csum = ostree_deployment_get_csum (deployment);
g_autoptr (GVariant) commit = NULL;
if (!ostree_repo_load_commit (repo, csum, &commit, NULL, error))
Expand Down

0 comments on commit a827afb

Please sign in to comment.