lib/sysroot: Fix retrieving non-booted pending deployment

If we're booted into a deployment, then any queries for the pending
merge deployment of a non-booted OS will fail due all of them being
considered rollback.

Fix this by filtering by `osname` *before* determining if we've crossed
the booted deployment yet.

Closes: #1472
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-02-28 17:30:18 +00:00 committed by Atomic Bot
parent 6db6268dfd
commit 530043fcf6

View File

@ -1202,6 +1202,10 @@ ostree_sysroot_query_deployments_for (OstreeSysroot *self,
{
OstreeDeployment *deployment = self->deployments->pdata[i];
/* Ignore deployments not for this osname */
if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
/* Is this deployment booted? If so, note we're past the booted */
if (self->booted_deployment != NULL &&
ostree_deployment_equal (deployment, self->booted_deployment))
@ -1210,10 +1214,6 @@ ostree_sysroot_query_deployments_for (OstreeSysroot *self,
continue;
}
/* Ignore deployments not for this osname */
if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
if (!found_booted && !ret_pending)
ret_pending = g_object_ref (deployment);
else if (found_booted && !ret_rollback)