Skip to content

Commit

Permalink
fix /usr/lib/ostree-boot/kargs not existing, make quick ostree= edit …
Browse files Browse the repository at this point in the history
…to let test pass
  • Loading branch information
Robert Fairley committed Apr 10, 2019
1 parent 74bc7d8 commit f268595
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,7 @@ deployment_get_kargs_config_contents (OstreeSysroot *self,
{
glnx_autofd int deployment_dfd = -1;
g_autofree char *deployment_path = ostree_sysroot_get_deployment_dirpath (self, deployment);
g_print ("deployment_path: %s\n", deployment_path);
if (!glnx_opendirat (self->sysroot_fd, deployment_path, TRUE,
&deployment_dfd, error))
return FALSE;
Expand Down Expand Up @@ -2624,18 +2625,28 @@ deployment_merge_opts (OstreeSysroot *self,
&kargs_config_contents,
cancellable, error))
return FALSE;
g_print ("kargs_config_contents: %s\n", kargs_config_contents);
g_ptr_array_add (kargs_configs, g_steal_pointer (&kargs_config_contents));
g_print ("revision: %s\n", revision);
g_autoptr(GFile) root = NULL;
if (!ostree_repo_read_commit (ostree_sysroot_repo (self), revision, &root,
NULL, cancellable, error))
return FALSE;
g_print("g_file_get_parse_name(root): %s\n", g_file_get_parse_name(root));
g_autoptr(GFile) base_file = g_file_resolve_relative_path (root, _OSTREE_SYSROOT_DEPLOYMENT_KARGS_BASE);
g_print("g_file_get_parse_name(base_file): %s\n", g_file_get_parse_name(base_file));
if (!g_file_load_contents (base_file, cancellable, &kargs_config_contents, NULL, NULL, error))
return FALSE;

GError *local_error = NULL;
if (!g_file_load_contents (base_file, cancellable, &kargs_config_contents, NULL, NULL, &local_error))
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
g_clear_error (&local_error);
kargs_config_contents = g_strdup ("");
}
else
{
g_propagate_error (error, local_error);
return FALSE;
}
}
g_print ("kargs_config_contents: %s\n", kargs_config_contents);
g_ptr_array_add (kargs_configs, g_steal_pointer (&kargs_config_contents));

Expand Down
4 changes: 2 additions & 2 deletions tests/test-admin-deploy-karg-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ assert_has_dir sysroot/boot/ostree/testos-${bootcsum}

# Commit to and deploy a repo that has a default kargs file.
mkdir -p osdata/usr/lib/ostree-boot
os_tree_write_file "usr/lib/ostree-boot/kargs" "FOO=USR_1 MOO=USR_2 WOO=USR_3"
os_tree_write_file "usr/lib/ostree-boot/kargs" "FOO=USR_1 MOO=USR_2 WOO=USR_3 ostree=yay"
os_repository_commit "testos-repo" "1"

${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime
Expand All @@ -50,7 +50,7 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'FOO=US
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
export rev
echo "rev=${rev}"
etc=sysroot/ostree/deploy/testos/deploy/${rev}.1/etc
etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc
cd ${etc}
mkdir -p ostree
cd ${test_tmpdir}
Expand Down

0 comments on commit f268595

Please sign in to comment.