Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: Don't fail if loading composefs configuration fails due to mi… #3189

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,10 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, OstreeDeploy
return glnx_prefix_error (error, "Parsing prepare-root config");
// We always parse the composefs config, because we want to detect and error
// out if it's enabled, but not supported at compile time.
// However, we don't load the keys here, because they may not exist, such
// as in the initial deploy
g_autoptr (ComposefsConfig) composefs_config
= otcore_load_composefs_config (prepare_root_config, error);
= otcore_load_composefs_config (prepare_root_config, FALSE, error);
if (!composefs_config)
return glnx_prefix_error (error, "Reading composefs config");

Expand Down
4 changes: 2 additions & 2 deletions src/libotcore/otcore-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ otcore_free_composefs_config (ComposefsConfig *config)

// Parse the [composefs] section of the prepare-root.conf.
ComposefsConfig *
otcore_load_composefs_config (GKeyFile *config, GError **error)
otcore_load_composefs_config (GKeyFile *config, gboolean load_keys, GError **error)
{
GLNX_AUTO_PREFIX_ERROR ("Loading composefs config", error);

Expand All @@ -178,7 +178,7 @@ otcore_load_composefs_config (GKeyFile *config, GError **error)
&ret->signature_pubkey, error))
return NULL;

if (ret->is_signed)
if (ret->is_signed && load_keys)
{
ret->pubkeys = g_ptr_array_new_with_free_func ((GDestroyNotify)g_bytes_unref);

Expand Down
3 changes: 2 additions & 1 deletion src/libotcore/otcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ typedef struct
void otcore_free_composefs_config (ComposefsConfig *config);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ComposefsConfig, otcore_free_composefs_config)

ComposefsConfig *otcore_load_composefs_config (GKeyFile *config, GError **error);
ComposefsConfig *otcore_load_composefs_config (GKeyFile *config, gboolean load_keys,
GError **error);

// Our directory with transient state (eventually /run/ostree-booted should be a link to
// /run/ostree/booted)
Expand Down
3 changes: 2 additions & 1 deletion src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ main (int argc, char *argv[])

// We always parse the composefs config, because we want to detect and error
// out if it's enabled, but not supported at compile time.
g_autoptr (ComposefsConfig) composefs_config = otcore_load_composefs_config (config, &error);
g_autoptr (ComposefsConfig) composefs_config
= otcore_load_composefs_config (config, TRUE, &error);
if (!composefs_config)
errx (EXIT_FAILURE, "%s", error->message);

Expand Down
Loading