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

daemon: Retain pinned deployments #1309

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions src/daemon/rpmostree-sysroot-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,10 @@ rpmostree_syscore_filter_deployments (OstreeSysroot *sysroot,
continue;
}

/* Is this deployment for a different osname? Keep it. */
if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
const gboolean osname_matches =
strcmp (ostree_deployment_get_osname (deployment), osname) == 0;
/* Retain deployments for other osnames, as well as pinned ones */
if (!osname_matches || ostree_deployment_is_pinned (deployment))
{
g_ptr_array_add (new_deployments, g_object_ref (deployment));
continue;
Expand Down
10 changes: 10 additions & 0 deletions tests/vmcheck/test-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ vm_rpmostree status > status.txt
assert_not_file_has_content status.txt "Pinned: yes"
echo "ok pinning"

vm_cmd ostree admin pin 0
vm_rpmostree reload # Try to avoid reload races
vm_rpmostree cleanup -p
vm_assert_status_jq ".deployments|length == 2"
vm_cmd ostree admin pin -u 0
vm_rpmostree reload # Try to avoid reload races
vm_rpmostree cleanup -p
vm_assert_status_jq ".deployments|length == 1"
echo "ok pinned retained"

# https://github.com/ostreedev/ostree/pull/1055
vm_cmd ostree commit -b vmcheck --tree=ref=vmcheck --timestamp=\"October 25 1985\"
if vm_rpmostree upgrade 2>err.txt; then
Expand Down