Skip to content

Commit

Permalink
fixup! daemon: Add a sanitycheck(/bin/true) before we deploy a tree
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Jul 26, 2017
1 parent a541ec7 commit 3c7c2e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/daemon/rpmostree-sysroot-upgrader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,9 +1018,10 @@ rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
return FALSE;

/* Also do a sanitycheck even if there's no local mutation; it's basically free
* and might save someone in the future.
* and might save someone in the future. The RPMOSTREE_SKIP_SANITYCHECK
* environment variable is just used by test-basic.sh currently.
*/
if (!self->final_revision)
if (!self->final_revision && !getenv ("RPMOSTREE_SKIP_SANITYCHECK"))
{
g_autofree char *deployment_path = ostree_sysroot_get_deployment_dirpath (self->sysroot, new_deployment);
glnx_fd_close int deployment_dfd = -1;
Expand Down
9 changes: 8 additions & 1 deletion src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ rpmostree_treespec_new_from_keyfile (GKeyFile *keyfile,
}
add_canonicalized_string_array (&builder, "instlangs", "instlangs-all", keyfile);

if (g_key_file_get_boolean (keyfile, "tree", "skip-sanity-check", NULL))
g_variant_builder_add (&builder, "{sv}", "skip-sanity-check", g_variant_new_boolean (TRUE));

{ gboolean documentation = TRUE;
g_autofree char *value = g_key_file_get_value (keyfile, "tree", "documentation", NULL);

Expand Down Expand Up @@ -2987,7 +2990,11 @@ rpmostree_context_assemble_tmprootfs (RpmOstreeContext *self,
/* We want this to be the first error message if something went wrong
* with a script; see https://github.com/projectatomic/rpm-ostree/pull/888
*/
if (!rpmostree_deployment_sanitycheck (tmprootfs_dfd, cancellable, error))

gboolean skip_sanity_check = FALSE;
g_variant_dict_lookup (self->spec->dict, "skip-sanity-check", "b", &skip_sanity_check);
if (!skip_sanity_check &&
!rpmostree_deployment_sanitycheck (tmprootfs_dfd, cancellable, error))
return FALSE;

if (have_systemctl)
Expand Down
1 change: 1 addition & 0 deletions tests/check/test-ucontainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cat > foo.conf <<EOF
ref=foo
packages=foo
repos=test-repo
skip-sanity-check=true
EOF

rpm-ostree ex container assemble foo.conf
Expand Down
1 change: 1 addition & 0 deletions tests/utils/setup-session.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ EOF

# Tell rpm-ostree to connect to the session bus instead of system
export RPMOSTREE_USE_SESSION_BUS=1
export RPMOSTREE_SKIP_SANITYCHECK=1

exec dbus-run-session --config-file=${test_tmpdir}/session.conf $@

0 comments on commit 3c7c2e2

Please sign in to comment.