treecompose: Add various g_prefix_error()

To help debug a problem which turned out to be in SELinux postprocessing for
RHELAH.

Closes: #830
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-06-15 13:29:06 -04:00 committed by Atomic Bot
parent 4a61e55663
commit 9f671efc60
2 changed files with 29 additions and 19 deletions

View File

@ -1008,12 +1008,18 @@ rpmostree_compose_builtin_tree (int argc,
if (!rpmostree_treefile_postprocessing (rootfs_fd, self->treefile_context_dirs->pdata[0], if (!rpmostree_treefile_postprocessing (rootfs_fd, self->treefile_context_dirs->pdata[0],
self->serialized_treefile, treefile, self->serialized_treefile, treefile,
next_version, cancellable, error)) next_version, cancellable, error))
{
g_prefix_error (error, "Postprocessing: ");
goto out; goto out;
}
if (!rpmostree_prepare_rootfs_for_commit (self->workdir_dfd, &rootfs_fd, rootfs_name, if (!rpmostree_prepare_rootfs_for_commit (self->workdir_dfd, &rootfs_fd, rootfs_name,
treefile, treefile,
cancellable, error)) cancellable, error))
{
g_prefix_error (error, "Preparing rootfs for commit: ");
goto out; goto out;
}
if (!rpmostree_copy_additional_files (yumroot, self->treefile_context_dirs->pdata[0], treefile, cancellable, error)) if (!rpmostree_copy_additional_files (yumroot, self->treefile_context_dirs->pdata[0], treefile, cancellable, error))
goto out; goto out;
@ -1021,12 +1027,18 @@ rpmostree_compose_builtin_tree (int argc,
if (!rpmostree_check_passwd (repo, yumroot, treefile_dirpath, treefile, if (!rpmostree_check_passwd (repo, yumroot, treefile_dirpath, treefile,
previous_checksum, previous_checksum,
cancellable, error)) cancellable, error))
{
g_prefix_error (error, "Handling passwd db: ");
goto out; goto out;
}
if (!rpmostree_check_groups (repo, yumroot, treefile_dirpath, treefile, if (!rpmostree_check_groups (repo, yumroot, treefile_dirpath, treefile,
previous_checksum, previous_checksum,
cancellable, error)) cancellable, error))
{
g_prefix_error (error, "Handling group db: ");
goto out; goto out;
}
/* Insert our input hash */ /* Insert our input hash */
g_hash_table_replace (metadata_hash, g_strdup ("rpmostree.inputhash"), g_hash_table_replace (metadata_hash, g_strdup ("rpmostree.inputhash"),

View File

@ -654,10 +654,7 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
name = dent->d_name; name = dent->d_name;
if (renameat (dfd_iter.fd, name, etc_selinux_dfd, name) != 0) if (renameat (dfd_iter.fd, name, etc_selinux_dfd, name) != 0)
{ return glnx_throw_errno_prefix (error, "rename(%s)", name);
glnx_set_error_from_errno (error);
return FALSE;
}
} }
return TRUE; return TRUE;
@ -794,13 +791,19 @@ create_rootfs_from_yumroot_content (int target_root_dfd,
/* NSS configuration to look at the new files */ /* NSS configuration to look at the new files */
if (!replace_nsswitch (src_rootfs_fd, cancellable, error)) if (!replace_nsswitch (src_rootfs_fd, cancellable, error))
{
g_prefix_error (error, "nsswitch replacement: ");
goto out; goto out;
}
if (selinux) if (selinux)
{ {
if (!postprocess_selinux_policy_store_location (src_rootfs_fd, cancellable, error)) if (!postprocess_selinux_policy_store_location (src_rootfs_fd, cancellable, error))
{
g_prefix_error (error, "SELinux postprocess: ");
goto out; goto out;
} }
}
/* We take /usr from the yum content */ /* We take /usr from the yum content */
g_print ("Moving /usr and /etc to target\n"); g_print ("Moving /usr and /etc to target\n");
@ -1615,17 +1618,15 @@ rpmostree_prepare_rootfs_for_commit (int workdir_dfd,
glnx_fd_close int target_root_dfd = -1; glnx_fd_close int target_root_dfd = -1;
if (mkdirat (workdir_dfd, temp_new_root, 0755) < 0) if (mkdirat (workdir_dfd, temp_new_root, 0755) < 0)
{ return glnx_throw_errno_prefix (error, "creating %s", temp_new_root);
glnx_set_error_from_errno (error);
return FALSE;
}
if (!glnx_opendirat (workdir_dfd, temp_new_root, TRUE, if (!glnx_opendirat (workdir_dfd, temp_new_root, TRUE,
&target_root_dfd, error)) &target_root_dfd, error))
return FALSE; return FALSE;
if (!create_rootfs_from_yumroot_content (target_root_dfd, *inout_rootfs_fd, treefile, if (!create_rootfs_from_yumroot_content (target_root_dfd, *inout_rootfs_fd, treefile,
cancellable, error)) cancellable, error))
return FALSE; return glnx_prefix_error (error, "Finalizing rootfs");
(void) close (*inout_rootfs_fd); (void) close (*inout_rootfs_fd);
@ -1634,10 +1635,7 @@ rpmostree_prepare_rootfs_for_commit (int workdir_dfd,
if (TEMP_FAILURE_RETRY (renameat (workdir_dfd, temp_new_root, if (TEMP_FAILURE_RETRY (renameat (workdir_dfd, temp_new_root,
workdir_dfd, rootfs_name)) != 0) workdir_dfd, rootfs_name)) != 0)
{ return glnx_throw_errno_prefix (error, "rename(%s, %s)", temp_new_root, rootfs_name);
glnx_set_error_from_errno (error);
return FALSE;
}
*inout_rootfs_fd = target_root_dfd; *inout_rootfs_fd = target_root_dfd;
target_root_dfd = -1; /* Transfer ownership */ target_root_dfd = -1; /* Transfer ownership */